mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
Make pattern presence constraints an enum variant
This commit is contained in:
parent
95ad906c59
commit
b4c9068676
3 changed files with 37 additions and 19 deletions
|
@ -350,7 +350,8 @@ fn solve(
|
|||
|
||||
state
|
||||
}
|
||||
Pattern(region, category, typ, expectation, presence) => {
|
||||
Pattern(region, category, typ, expectation)
|
||||
| Present(typ, PresenceConstraint::Pattern(region, category, expectation)) => {
|
||||
let actual = type_to_var(subs, rank, pools, cached_aliases, typ);
|
||||
let expected = type_to_var(
|
||||
subs,
|
||||
|
@ -360,7 +361,9 @@ fn solve(
|
|||
expectation.get_type_ref(),
|
||||
);
|
||||
|
||||
match unify(subs, actual, expected, *presence) {
|
||||
let presence_con = matches!(constraint, Present(_, _));
|
||||
|
||||
match unify(subs, actual, expected, presence_con) {
|
||||
Success(vars) => {
|
||||
introduce(subs, rank, pools, &vars);
|
||||
|
||||
|
@ -684,6 +687,9 @@ fn solve(
|
|||
}
|
||||
}
|
||||
}
|
||||
PresenceConstraint::Pattern(_, _, _) => {
|
||||
unreachable!("Handled in a previous branch")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue