Skip to content

Commit 32cff68

Browse files
committed
semantically assignment is still a bit confusing for fields of return values, but syntactically it works now
1 parent aab5e68 commit 32cff68

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11

22
import lib/core/bedrock.lsts;
33

4-
let xs = safe-alloc(2, type((U8,U8)));
5-
xs[0] = (1,2);
6-
xs[1] = (2,3);
4+
type A = { x: U8, y: U8 };
75

8-
assert( xs[0].first == 1 );
9-
assert( xs[0].second == 2 );
6+
let xs = safe-alloc(2, type(A));
7+
xs[0] = A(1,2);
8+
xs[1] = A(2,3);
109

11-
assert( xs[1].first == 2 );
12-
assert( xs[1].second == 3 );
10+
assert( xs[0].x == 1 );
11+
assert( xs[0].y == 2 );
1312

14-
xs[0] = (3,4);
13+
assert( xs[1].x == 2 );
14+
assert( xs[1].y == 3 );
1515

16-
assert( xs[0].first == 3 );
17-
assert( xs[0].second == 4 );
16+
xs[0] = A(3,4);
1817

19-
assert( xs[1].first == 2 );
20-
assert( xs[1].second == 3 );
18+
assert( xs[0].x == 3 );
19+
assert( xs[0].y == 4 );
2120

22-
xs[0].first = 5;
21+
assert( xs[1].x == 2 );
22+
assert( xs[1].y == 3 );
2323

24-
assert( xs[0].first == 5 );
25-
assert( xs[0].second == 4 );
24+
xs[0].x = 5;
2625

27-
assert( xs[1].first == 2 );
28-
assert( xs[1].second == 3 );
26+
assert( xs[0].x == 5 );
27+
assert( xs[0].y == 4 );
28+
29+
assert( xs[1].x == 2 );
30+
assert( xs[1].y == 3 );
2931

tests/promises/syntax/lhs-nested-index.lsts.skip

Whitespace-only changes.

0 commit comments

Comments
 (0)