@@ -26,6 +26,185 @@ fun typesAsIdentifiers(builder: builder) {
2626 return int;
2727}
2828
29+ global callOrder: tuple;
30+
31+ fun getTensor_12() {
32+ callOrder.tuplePush(100);
33+ return (1, 2);
34+ }
35+ fun getTensor_1X(x: int) {
36+ callOrder.tuplePush(101);
37+ return (1, x);
38+ }
39+ fun getTuple_12() {
40+ callOrder.tuplePush(110);
41+ return [1, 2];
42+ }
43+ fun getTuple_1X(x: int) {
44+ callOrder.tuplePush(111);
45+ return [1, x];
46+ }
47+ fun getUntypedTuple_12() {
48+ callOrder.tuplePush(120);
49+ var t = createEmptyTuple(); t.tuplePush(1); t.tuplePush(2);
50+ return t;
51+ }
52+ fun getUntypedTuple_1X(x: int) {
53+ callOrder.tuplePush(121);
54+ var t = createEmptyTuple(); t.tuplePush(1); t.tuplePush(x);
55+ return t;
56+ }
57+ fun getIntValue5() {
58+ callOrder.tuplePush(10);
59+ return 5;
60+ }
61+ fun getIntValueX(x: int) {
62+ callOrder.tuplePush(11);
63+ return x;
64+ }
65+
66+ @method_id(102)
67+ fun test102() {
68+ callOrder = createEmptyTuple();
69+ var x = 0;
70+ getTensor_12().0 = getIntValue5();
71+ getTensor_1X(5).1 = getIntValue5();
72+ getTensor_1X(x = 10).0 = getIntValueX(x);
73+ return (callOrder, x);
74+ }
75+
76+ @method_id(103)
77+ fun test103() {
78+ callOrder = createEmptyTuple();
79+ var x = 0;
80+ getTuple_12().0 = getIntValue5();
81+ getTuple_1X(5).1 = getIntValue5();
82+ getTuple_1X(x = 10).0 = getIntValueX(x);
83+ return (callOrder, x);
84+ }
85+
86+ @method_id(104)
87+ fun test104() {
88+ callOrder = createEmptyTuple();
89+ var x = 0;
90+ getUntypedTuple_12().0 = getIntValue5();
91+ getUntypedTuple_1X(5).1 = getIntValue5();
92+ getUntypedTuple_1X(x = 10).0 = getIntValueX(x);
93+ return (callOrder, x);
94+ }
95+
96+ @method_id(105)
97+ fun test105() {
98+ callOrder = createEmptyTuple();
99+ getTensor_12().0 = getTensor_1X(getIntValue5()).1 = getIntValueX(getTensor_12().1);
100+ return callOrder;
101+ }
102+
103+ @method_id(106)
104+ fun test106() {
105+ callOrder = createEmptyTuple();
106+ getTuple_12().0 = getTuple_1X(getIntValue5()).1 = getIntValueX(getTuple_12().1);
107+ return callOrder;
108+ }
109+
110+ global t107: (int, int);
111+
112+ @method_id(107)
113+ fun test107() {
114+ ((t107 = (1, 2)).0, (t107 = (3, 4)).1) = (5, 6);
115+ return t107;
116+ }
117+
118+ global g108: int;
119+ fun assertEq(a: int, b: int) {
120+ assert(a == b, 10);
121+ return b;
122+ }
123+
124+ @method_id(108)
125+ fun test108() {
126+ callOrder = createEmptyTuple();
127+ g108 = 0;
128+ getTensor_1X(g108 = 8).1 = assertEq(g108, 8);
129+ return (callOrder, g108);
130+ }
131+
132+ @method_id(109)
133+ fun test109() {
134+ callOrder = createEmptyTuple();
135+ var x = 0;
136+ [getTuple_12().0, getTuple_1X(x = getIntValue5()).1, getTuple_1X(x += 10).0] = [getIntValue5(), getIntValue5(), getIntValueX(x)];
137+ return (callOrder, x);
138+ }
139+
140+ global g110: int;
141+ global t110: (int, int);
142+
143+ @method_id(110)
144+ fun test110() {
145+ callOrder = createEmptyTuple();
146+ var xy = [0, 0];
147+ [xy.0, getTuple_1X(g110 = 8).0] = [g110 += 5, getIntValueX(g110 += 10)];
148+ [xy.1, getTuple_1X((t110 = (8, 9)).0).1] = [t110.0 += 5, getIntValueX(t110.1 += 10)];
149+ return (xy, callOrder, g110, t110);
150+ }
151+
152+ @method_id(111)
153+ fun test111() {
154+ callOrder = createEmptyTuple();
155+ var z = -1;
156+ var xy = [0, z = 0];
157+ var rhs = [getIntValueX(xy.1 += 10), xy.1, xy.0, z += 50];
158+ [xy.0, getTuple_1X(g110 = 8 + getIntValueX(xy.1)).0, xy.1, z] = rhs;
159+ return (xy, g110, callOrder, z);
160+ }
161+
162+ @method_id(112)
163+ fun test112() {
164+ var xy = [1, 2];
165+ ((((xy))).0, ((xy.1))) = ((xy).1, ((xy.0)));
166+ return xy;
167+ }
168+
169+ @method_id(113)
170+ fun test113() {
171+ var (a, t, z) = (1, [2,3], (-1,-1));
172+ (a, t, a, z, t.1, z.1) = (10, [a,12], 13, (a, t.1), 14, t.1);
173+ return (a, t, z);
174+ }
175+
176+ global g114: int;
177+ global t114: [int, int];
178+ global z114: (int, int);
179+
180+ @method_id(114)
181+ fun test114() {
182+ g114 = 1;
183+ t114 = [2, 3];
184+ (g114, t114, g114, z114, t114.1, z114.1) = (10, [g114,12], 13, (g114, t114.1), 14, t114.1);
185+ return (g114, t114, z114);
186+ }
187+
188+ @method_id(115)
189+ fun test115() {
190+ callOrder = createEmptyTuple();
191+ var x = 0;
192+ var y = 0;
193+ [getTensor_1X(x = 5).0, y] = getTuple_1X(x = 9);
194+ return (callOrder, x, y);
195+ }
196+
197+ @method_id(116)
198+ fun test116() {
199+ var (a,b,c,d) = (0,0,0,0);
200+ var rhs = [1, 2, 3, 4];
201+ var rhs2 = ([a,b,c,d] = rhs);
202+ __expect_type(rhs2, "[int, int, int, int]");
203+ return (a, b, c, d, rhs2);
204+ }
205+
206+
207+
29208fun main(value: int) {
30209 var (x: int, y) = (autoInferIntNull(value), autoInferIntNull(value * 2));
31210 if (x == null && y == null) { return null; }
@@ -37,4 +216,35 @@ fun main(value: int) {
37216@testcase | 0 | 6 | -1
38217@testcase | 0 | 11 | (null)
39218@testcase | 101 | 78 | 88
219+ @testcase | 102 | | [ 100 10 101 10 101 11 ] 10
220+ @testcase | 103 | | [ 110 10 111 10 111 11 ] 10
221+ @testcase | 104 | | [ 120 10 121 10 121 11 ] 10
222+ @testcase | 105 | | [ 100 10 101 100 11 ]
223+ @testcase | 106 | | [ 110 10 111 110 11 ]
224+ @testcase | 107 | | 3 4
225+ @testcase | 108 | | [ 101 ] 8
226+ @testcase | 109 | | [ 110 10 111 111 10 10 11 ] 15
227+ @testcase | 110 | | [ 13 13 ] [ 111 11 111 11 ] 23 13 19
228+ @testcase | 111 | | [ 10 0 ] 18 [ 11 11 111 ] 50
229+ @testcase | 112 | | [ 2 1 ]
230+ @testcase | 113 | | 13 [ 1 14 ] 1 3
231+ @testcase | 114 | | 13 [ 1 14 ] 1 3
232+ @testcase | 115 | | [ 101 111 ] 9 9
233+ @testcase | 116 | | 1 2 3 4 [ 1 2 3 4 ]
234+
235+
236+ @fif_codegen
237+ """
238+ test116 PROC:<{
239+ //
240+ 1 PUSHINT // '10=1
241+ 2 PUSHINT // '10=1 '11=2
242+ 3 PUSHINT // '10=1 '11=2 '12=3
243+ 4 PUSHINT // '10=1 '11=2 '12=3 '13=4
244+ 4 TUPLE // rhs
245+ DUP // rhs rhs
246+ 4 UNTUPLE // rhs2 a b c d
247+ 4 ROLL // a b c d rhs2
248+ }>
249+ """
40250*/
0 commit comments