chore: add Predicate::{map_t, map_tp}

This commit is contained in:
Shunsuke Shibayama 2024-08-23 12:52:44 +09:00
parent 837414929c
commit 7a960f2cbb
8 changed files with 333 additions and 74 deletions

View file

@ -317,6 +317,22 @@ impl<'c, 'l, 'u, L: Locational> Unifier<'c, 'l, 'u, L> {
}
Ok(())
}
(ValueObj::Set(sub), ValueObj::Set(sup)) => {
if sub.len() == 1 && sup.len() == 1 {
let sub = sub.iter().next().unwrap();
let sup = sup.iter().next().unwrap();
self.sub_unify_value(sub, sup)?;
Ok(())
} else {
Err(TyCheckErrors::from(TyCheckError::feature_error(
self.ctx.cfg.input.clone(),
line!() as usize,
self.loc.loc(),
&format!("unifying {sub} and {sup}"),
self.ctx.caused_by(),
)))
}
}
(ValueObj::Record(sub), ValueObj::Record(sup)) => {
for (sub_k, sub_v) in sub.iter() {
if let Some(sup_v) = sup.get(sub_k) {