mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-03 05:54:33 +00:00
fix: codegen bug in CPython 3.7~3.10
This commit is contained in:
parent
83c57edf0e
commit
b7647c7f80
2 changed files with 5 additions and 1 deletions
|
@ -2799,7 +2799,9 @@ impl PyCodeGenerator {
|
||||||
return self.emit_call_fake_method(obj, func_name, method_name, args);
|
return self.emit_call_fake_method(obj, func_name, method_name, args);
|
||||||
}
|
}
|
||||||
let is_type = method_name.ref_t().is_poly_meta_type();
|
let is_type = method_name.ref_t().is_poly_meta_type();
|
||||||
let kind = if self.py_version.minor >= Some(11) || method_name.vi.t.is_method() {
|
let kind = if self.py_version.minor >= Some(11)
|
||||||
|
|| (method_name.vi.t.is_method() && args.kw_args.is_empty())
|
||||||
|
{
|
||||||
BoundAttr
|
BoundAttr
|
||||||
} else {
|
} else {
|
||||||
UnboundAttr
|
UnboundAttr
|
||||||
|
|
|
@ -14,12 +14,14 @@ D.
|
||||||
new y = Self { .y; }
|
new y = Self { .y; }
|
||||||
@staticmethod
|
@staticmethod
|
||||||
foo x = x + 1
|
foo x = x + 1
|
||||||
|
bar self, x := 1 = self.y + x
|
||||||
one = Self.new 1
|
one = Self.new 1
|
||||||
D|<: Eq|.
|
D|<: Eq|.
|
||||||
`==` self, other = self.y == other.y
|
`==` self, other = self.y == other.y
|
||||||
|
|
||||||
d = D.new 1
|
d = D.new 1
|
||||||
assert d.foo(1) == 2
|
assert d.foo(1) == 2
|
||||||
|
assert d.bar(x:=2) == 3
|
||||||
|
|
||||||
c = C.new { .x = D.new(1) }
|
c = C.new { .x = D.new(1) }
|
||||||
assert c.x.y == 1
|
assert c.x.y == 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue