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.
This commit is contained in:
Andrew Kelley
2021-10-07 16:01:13 -07:00
parent 76335bc7ba
commit 3df19b765d
3 changed files with 30 additions and 10 deletions

View File

@@ -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);
}