mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
Simply constraint matching in solve
This commit is contained in:
parent
d5bd58c298
commit
409ced0ef2
1 changed files with 51 additions and 57 deletions
|
@ -629,10 +629,8 @@ fn solve(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Present(typ, constr) => {
|
Present(typ, PresenceConstraint::IsOpen) => {
|
||||||
let actual = type_to_var(subs, rank, pools, cached_aliases, typ);
|
let actual = type_to_var(subs, rank, pools, cached_aliases, typ);
|
||||||
match constr {
|
|
||||||
PresenceConstraint::IsOpen => {
|
|
||||||
let mut new_desc = subs.get(actual);
|
let mut new_desc = subs.get(actual);
|
||||||
match new_desc.content {
|
match new_desc.content {
|
||||||
Content::Structure(FlatType::TagUnion(tags, _)) => {
|
Content::Structure(FlatType::TagUnion(tags, _)) => {
|
||||||
|
@ -653,7 +651,8 @@ fn solve(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PresenceConstraint::IncludesTag(tag_name, tys) => {
|
Present(typ, PresenceConstraint::IncludesTag(tag_name, tys)) => {
|
||||||
|
let actual = type_to_var(subs, rank, pools, cached_aliases, typ);
|
||||||
let tag_ty = Type::TagUnion(
|
let tag_ty = Type::TagUnion(
|
||||||
vec![(tag_name.clone(), tys.clone())],
|
vec![(tag_name.clone(), tys.clone())],
|
||||||
Box::new(Type::EmptyTagUnion),
|
Box::new(Type::EmptyTagUnion),
|
||||||
|
@ -690,11 +689,6 @@ fn solve(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PresenceConstraint::Pattern(_, _, _) => {
|
|
||||||
unreachable!("Handled in a previous branch")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue