File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,7 @@ RUN(NAME structs_07 LABELS llvm c
312
312
RUN (NAME structs_08 LABELS cpython llvm c )
313
313
RUN (NAME structs_09 LABELS cpython llvm c )
314
314
RUN (NAME structs_10 LABELS cpython llvm c )
315
+ RUN (NAME structs_12 LABELS cpython llvm c )
315
316
RUN (NAME sizeof_01 LABELS llvm c
316
317
EXTRAFILES sizeof_01b.c )
317
318
RUN (NAME enum_01 LABELS cpython llvm c )
Original file line number Diff line number Diff line change
1
+ from ltypes import i32 , i16 , dataclass
2
+
3
+ @dataclass
4
+ class A :
5
+ x : i32
6
+ y : i16
7
+
8
+ def add_A_members (Ax : i32 , Ay : i16 ) -> i32 :
9
+ return Ax + i32 (Ay )
10
+
11
+ def test_A_member_passing ():
12
+ a : A = A (0 , i16 (1 ))
13
+ sum_A_members : i32 = add_A_members (a .x , a .y )
14
+ print (sum_A_members )
15
+ assert sum_A_members == 1
16
+
17
+ test_A_member_passing ()
Original file line number Diff line number Diff line change @@ -5968,7 +5968,8 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
5968
5968
builder0.SetInsertPoint (&entry_block, entry_block.getFirstInsertionPt ());
5969
5969
llvm::AllocaInst *target = builder0.CreateAlloca (
5970
5970
target_type, nullptr , " call_arg_value" );
5971
- if ( ASR::is_a<ASR::ArrayItem_t>(*x.m_args [i].m_value ) ) {
5971
+ if ( ASR::is_a<ASR::ArrayItem_t>(*x.m_args [i].m_value ) ||
5972
+ ASR::is_a<ASR::StructInstanceMember_t>(*x.m_args [i].m_value ) ) {
5972
5973
value = CreateLoad (value);
5973
5974
}
5974
5975
if ( ASR::is_a<ASR::Tuple_t>(*arg_type) ||
You can’t perform that action at this time.
0 commit comments