Merge pull request #280 from erg-lang/fix-#278

Fix #278
This commit is contained in:
Shunsuke Shibayama 2022-12-08 22:50:29 +09:00 committed by GitHub
commit 7b95d3fc4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -1169,6 +1169,7 @@ impl Context {
if !st.is_generalized() {
self.substitute_typarams(&qt, &st);
}
self.sub_unify(&st, &qt, Location::Unknown, None).unwrap();
}
_ => {}
}

View file

@ -1391,7 +1391,8 @@ impl Context {
Ok(())
}
(Type::FreeVar(lfv), _) if lfv.is_unbound() => {
match &mut *lfv.borrow_mut() {
let lfv_ref = unsafe { lfv.as_ptr().as_mut().unwrap() };
match lfv_ref {
FreeKind::NamedUnbound { constraint, .. }
| FreeKind::Unbound { constraint, .. } => match constraint {
// sub !<: r => Error