Merge branch 'main' into named_tuple

This commit is contained in:
Shunsuke Shibayama 2023-08-17 16:53:38 +09:00
commit 8323dd4094
2 changed files with 3 additions and 4 deletions

View file

@ -403,13 +403,10 @@ impl Context {
ast::ParamPattern::RefMut(_) => ref_mut(self_t, None), ast::ParamPattern::RefMut(_) => ref_mut(self_t, None),
_ => self_t, _ => self_t,
}; };
// spec_t == self_t (not spec_t <: self_t) // spec_t <: self_t
if let Err(es) = self.sub_unify(spec_t, &self_t, name, Some(name.inspect())) { if let Err(es) = self.sub_unify(spec_t, &self_t, name, Some(name.inspect())) {
errs.extend(es); errs.extend(es);
} }
if let Err(es) = self.sub_unify(&self_t, spec_t, name, Some(name.inspect())) {
errs.extend(es);
}
} else { } else {
log!(err "self_t is None"); log!(err "self_t is None");
} }

View file

@ -4,6 +4,7 @@ C::
aaa = 1 aaa = 1
C. C.
bbb = 1 bbb = 1
id self = self
f self = None f self = None
D = Inherit C D = Inherit C
@ -24,3 +25,4 @@ D.
d = D.new({.x = 1}) d = D.new({.x = 1})
print! d.bbb, d.ddd, d.g() print! d.bbb, d.ddd, d.g()
assert d.id().ddd == 1