fix: sub-unification bugs

This commit is contained in:
Shunsuke Shibayama 2023-03-22 15:38:47 +09:00
parent b318395a32
commit 0079aed860
10 changed files with 190 additions and 153 deletions

View file

@ -72,7 +72,7 @@ impl Context {
expected: &Type,
found: &Type,
) -> Option<String> {
let expected = if let Type::FreeVar(fv) = expected {
let expected = if let Some(fv) = expected.as_free() {
if fv.is_linked() {
fv.crack().clone()
} else {
@ -191,7 +191,7 @@ impl Context {
pub(crate) fn get_no_candidate_hint(&self, proj: &Type) -> Option<String> {
match proj {
Type::Proj { lhs, rhs: _ } => {
if let Type::FreeVar(fv) = lhs.as_ref() {
if let Some(fv) = lhs.as_free() {
let (sub, sup) = fv.get_subsup()?;
let (verb, preposition, sequence) = Self::get_verb_and_preposition(&sup)?;
let sup = *option_enum_unwrap!(sup.typarams().get(0)?.clone(), TyParam::Type)?;