Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f89861b

Browse files
committed
TEST: Add test for inner struct pass to func
1 parent 96433ad commit f89861b

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
@@ -615,6 +615,7 @@ RUN(NAME structs_30 LABELS cpython llvm c)
615615
RUN(NAME structs_31 LABELS cpython llvm c)
616616
RUN(NAME structs_32 LABELS cpython llvm c)
617617
RUN(NAME structs_33 LABELS cpython llvm c)
618+
RUN(NAME structs_34 LABELS cpython llvm c)
618619

619620
RUN(NAME symbolics_01 LABELS cpython_sym c_sym)
620621
RUN(NAME symbolics_02 LABELS cpython_sym c_sym)

integration_tests/structs_34.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, ccallable, i32, ccallback
2+
3+
@ccallable
4+
@packed
5+
@dataclass
6+
class struct_0:
7+
val_0 : i32 = 613
8+
9+
@ccallable
10+
@packed
11+
@dataclass
12+
class struct_1:
13+
val_1 : struct_0 = struct_0()
14+
15+
def print_val_0_in_struct_0(struct_0_instance : struct_0) -> i32:
16+
print(struct_0_instance.val_0)
17+
return 0
18+
19+
@ccallback
20+
def entry_point() -> i32:
21+
struct_1_instance : struct_1 = struct_1()
22+
return print_val_0_in_struct_0(struct_1_instance.val_1)
23+
24+
assert entry_point() == 0

0 commit comments

Comments
 (0)