Fix subtyping bug

This commit is contained in:
Shunsuke Shibayama 2022-10-21 20:04:14 +09:00
parent 978866b31a
commit c39973f536
7 changed files with 110 additions and 19 deletions

View file

@ -784,6 +784,13 @@ impl Context {
(_, TyParam::FreeVar(fv), _) if fv.is_linked() => {
self.supertype_of_tp(lp, &fv.crack(), variance)
}
// _: Type :> T == true
(TyParam::Erased(t), TyParam::Type(_), _)
| (TyParam::Type(_), TyParam::Erased(t), _)
if t.as_ref() == &Type =>
{
true
}
(TyParam::Type(l), TyParam::Type(r), Variance::Contravariant) => self.subtype_of(l, r),
(TyParam::Type(l), TyParam::Type(r), Variance::Covariant) => {
// if matches!(r.as_ref(), &Type::Refinement(_)) { log!(info "{l}, {r}, {}", self.structural_supertype_of(l, r, bounds, Some(lhs_variance))); }