File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -685,6 +685,7 @@ RUN(NAME structs_31 LABELS cpython llvm c)
685
685
RUN(NAME structs_32 LABELS cpython llvm c)
686
686
RUN(NAME structs_33 LABELS cpython llvm c)
687
687
RUN(NAME structs_34 LABELS cpython llvm c)
688
+ RUN(NAME structs_35 LABELS cpython llvm c)
688
689
689
690
RUN(NAME symbolics_01 LABELS cpython_sym c_sym llvm_sym NOFAST)
690
691
RUN(NAME symbolics_02 LABELS cpython_sym c_sym llvm_sym NOFAST)
Original file line number Diff line number Diff line change
1
+ from lpython import dataclass , field , i32
2
+ from numpy import array
3
+
4
+ @dataclass
5
+ class X :
6
+ a : i32 = 123
7
+ b : bool = True
8
+ c : list [i32 ] = field (default_factory = lambda : [1 , 2 , 3 ])
9
+ d : i32 [3 ] = field (default_factory = lambda : array ([4 , 5 , 6 ]))
10
+ e : i32 = field (default = - 5 )
11
+
12
+ def main0 ():
13
+ x : X = X ()
14
+ print (x )
15
+ assert x .a == 123
16
+ assert x .b == True
17
+ assert x .c [0 ] == 1
18
+ assert x .d [1 ] == 5
19
+ assert x .e == - 5
20
+ x .c [0 ] = 3
21
+ x .d [0 ] = 3
22
+ print (x )
23
+ assert x .c [0 ] == 3
24
+ assert x .d [0 ] == 3
25
+
26
+ main0 ()
You can’t perform that action at this time.
0 commit comments