Fix deriving of hash ability for recursive tag unions

This commit is contained in:
Ayaz Hafiz 2022-10-05 12:01:02 -05:00
parent 02b02901bc
commit 2517695ce4
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 25 additions and 8 deletions

View file

@ -2937,7 +2937,6 @@ fn unify_flex_able<M: MetaCollector>(
}
RigidVar(_) => mismatch!("FlexAble can never unify with non-able Rigid"),
RecursionVar { .. } => mismatch!("FlexAble with RecursionVar"),
LambdaSet(..) => mismatch!("FlexAble with LambdaSet"),
Alias(name, _args, _real_var, AliasKind::Opaque) => {
@ -2952,7 +2951,10 @@ fn unify_flex_able<M: MetaCollector>(
)
}
Structure(_) | Alias(_, _, _, AliasKind::Structural) | RangedNumber(..) => {
RecursionVar { .. }
| Structure(_)
| Alias(_, _, _, AliasKind::Structural)
| RangedNumber(..) => {
// Structural type wins.
merge_flex_able_with_concrete(
env,
@ -3035,10 +3037,22 @@ fn unify_recursion<M: MetaCollector>(
mismatch!("RecursionVar {:?} with rigid {:?}", ctx.first, &other)
}
FlexAbleVar(..) | RigidAbleVar(..) => {
RigidAbleVar(..) => {
mismatch!("RecursionVar {:?} with able var {:?}", ctx.first, &other)
}
FlexAbleVar(_, ability) => merge_flex_able_with_concrete(
env,
ctx,
ctx.second,
*ability,
RecursionVar {
structure,
opt_name: *opt_name,
},
Obligated::Adhoc(ctx.first),
),
FlexVar(_) => merge(
env,
ctx,