Unify ranged numbers with flex able, modulo obligation checking

Closes #4594
This commit is contained in:
Ayaz Hafiz 2022-12-01 09:50:29 -06:00
parent 2a27d3c05f
commit 0bae0aafb6
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 38 additions and 1 deletions

View file

@ -650,7 +650,18 @@ fn unify_ranged_number<M: MetaCollector>(
// Int a vs Int <range>, the rigid wins
merge(env, ctx, RigidVar(*name))
}
RecursionVar { .. } | Alias(..) | Structure(..) | RigidAbleVar(..) | FlexAbleVar(..) => {
FlexAbleVar(_, abilities) => {
// Range wins, modulo obligation checking.
merge_flex_able_with_concrete(
env,
ctx,
ctx.second,
*abilities,
RangedNumber(range_vars),
Obligated::Adhoc(ctx.first),
)
}
RecursionVar { .. } | Alias(..) | Structure(..) | RigidAbleVar(..) => {
check_and_merge_valid_range(env, pool, ctx, ctx.first, range_vars, ctx.second)
}
&RangedNumber(other_range_vars) => match range_vars.intersection(&other_range_vars) {