Simply constraint matching in solve

This commit is contained in:
ayazhafiz 2021-12-23 20:22:42 -06:00
parent d5bd58c298
commit 409ced0ef2

View file

@ -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")
}
}
}
} }
} }