add test for class without __init__

This commit is contained in:
Sébastien Bourdeauducq 2024-06-19 18:16:54 +08:00
parent 1bc95a7ba6
commit f00e458f60

View File

@ -6,6 +6,10 @@ def output_int32(x: int32):
def output_int64(x: int64): def output_int64(x: int64):
... ...
@extern
def output_str(x: str):
...
class B: class B:
b: int32 b: int32
@ -27,6 +31,10 @@ class A:
# return self.b # return self.b
class Initless:
def foo(self):
output_str("hello")
def run() -> int32: def run() -> int32:
a = A(10) a = A(10)
output_int32(a.a) output_int32(a.a)
@ -35,4 +43,8 @@ def run() -> int32:
output_int32(a.a) output_int32(a.a)
output_int32(a.get_a()) output_int32(a.get_a())
# output_int32(a.get_b().b) FIXME: NAC3 prints garbage # output_int32(a.get_b().b) FIXME: NAC3 prints garbage
initless = Initless()
initless.foo()
return 0 return 0