diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-10-07 16:01:13 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-10-07 16:01:13 -0700 |
| commit | 3df19b765d3b33cfda43b875adb714487bfb8c6b (patch) | |
| tree | b8325170ca693b5c94a569a256449a4dde0e6064 /test/behavior/array.zig | |
| parent | 76335bc7badd41af0ebb7dd196e1550d7e99d8e7 (diff) | |
| download | zig-3df19b765d3b33cfda43b875adb714487bfb8c6b.tar.gz zig-3df19b765d3b33cfda43b875adb714487bfb8c6b.zip | |
AstGen: make array literals work like struct literals
Now, array literals will emit a coerce_result_ptr ZIR instruction just
like struct literals do. This makes for another passing behavior test case.
Diffstat (limited to 'test/behavior/array.zig')
| -rw-r--r-- | test/behavior/array.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/behavior/array.zig b/test/behavior/array.zig index a81ff2f155..5338421a27 100644 --- a/test/behavior/array.zig +++ b/test/behavior/array.zig @@ -43,3 +43,10 @@ test "array literal with explicit type" { try expect(hex_mult.len == 4); try expect(hex_mult[1] == 256); } + +test "array literal with inferred length" { + const hex_mult = [_]u16{ 4096, 256, 16, 1 }; + + try expect(hex_mult.len == 4); + try expect(hex_mult[1] == 256); +} |
