Skip to content

Commit 20677d0

Browse files
committed
Add a test
1 parent b5eb0f6 commit 20677d0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

integration_tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ RUN(NAME structs_29 LABELS cpython llvm)
605605
RUN(NAME structs_30 LABELS cpython llvm c)
606606
RUN(NAME structs_31 LABELS cpython llvm c)
607607
RUN(NAME structs_32 LABELS cpython llvm c)
608+
RUN(NAME structs_33 LABELS cpython llvm c)
608609

609610
RUN(NAME symbolics_01 LABELS cpython_sym c_sym)
610611
RUN(NAME symbolics_02 LABELS cpython_sym c_sym)

integration_tests/structs_33.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from lpython import packed, dataclass, i32, ccallback, CPtr, ccall
2+
3+
# test issue 2125
4+
5+
@packed
6+
@dataclass
7+
class inner_struct:
8+
inner_field: i32 = 0
9+
10+
11+
@packed
12+
@dataclass
13+
class outer_struct:
14+
inner_s : inner_struct = inner_struct()
15+
16+
17+
def check() -> None:
18+
outer_struct_instance : outer_struct = outer_struct(inner_struct(5))
19+
outer_struct_instance2 : outer_struct = outer_struct_instance
20+
inner_struct_instance : inner_struct = outer_struct_instance2.inner_s
21+
assert inner_struct_instance.inner_field == 5
22+
23+
24+
check()

0 commit comments

Comments
 (0)