erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.7k stars 55 forks source link

Inherited class constructor with 2 params #516

Open mtshiba opened 4 months ago

mtshiba commented 4 months ago

Describe the bug?

@Inheritable
C = Class { .x = Int; .y = Int }
C.
    new x: Int, y: Int = C { .x; .y }

D = Inherit C

d = D.new(1, 2)
assert d.y == 2

Reproducible code

No response

Expected result

OK

Actual result

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "test.er", line -1, in <module>
TypeError: new() takes 1 positional argument but 2 were given

Additional context

No response

Erg version

0.6.40

Python version

Python3.11

OS

None