mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-03 14:04:33 +00:00
Merge branch 'main' into named_tuple
This commit is contained in:
commit
8323dd4094
2 changed files with 3 additions and 4 deletions
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue