mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Merge pull request #4209 from roc-lang/impl-tag-discriminant
Derive `Hash` implementations for tag unions
This commit is contained in:
commit
83b64c4fb3
13 changed files with 844 additions and 106 deletions
|
@ -2948,7 +2948,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) => {
|
||||
|
@ -2963,7 +2962,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,
|
||||
|
@ -3046,10 +3048,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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue