stage2: implement array_init instruction (#9843)

* stage2: array mul support more types of operands
* stage2: array cat support more types of operands
* print_zir: print array_init
* stage2: implement Sema for array_init
This commit is contained in:
g-w1
2021-09-30 18:31:27 -04:00
committed by GitHub
parent c82c3585c8
commit 5e7406bdd9
3 changed files with 114 additions and 50 deletions

View File

@@ -27,3 +27,9 @@ test "arrays" {
fn getArrayLen(a: []const u32) usize {
return a.len;
}
test "array init with mult" {
const a = 'a';
var i: [8]u8 = [2]u8{ a, 'b' } ** 4;
try expect(std.mem.eql(u8, &i, "abababab"));
}