mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Unify ranged numbers with flex able, modulo obligation checking
Closes #4594
This commit is contained in:
parent
2a27d3c05f
commit
0bae0aafb6
2 changed files with 38 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue