feat: type narrowing with filter

This commit is contained in:
Shunsuke Shibayama 2024-03-21 01:29:27 +09:00
parent 5345b07791
commit bd39393746
9 changed files with 209 additions and 36 deletions

View file

@ -1377,6 +1377,9 @@ impl<'c, 'l, 'u, L: Locational> Unifier<'c, 'l, 'u, L> {
(Structural(sub), Structural(sup)) => {
self.sub_unify(sub, sup)?;
}
(Guard(sub), Guard(sup)) => {
self.sub_unify(&sub.to, &sup.to)?;
}
(sub, Structural(sup)) => {
let sub_fields = self.ctx.fields(sub);
for (sup_field, sup_ty) in self.ctx.fields(sup) {