From 83dcd9f0386a6bd70cf8d7dee3892f3b8d31d506 Mon Sep 17 00:00:00 2001 From: Jacob G-W Date: Thu, 30 Sep 2021 21:31:46 -0400 Subject: stage2: emit Value.repeated for `**` where the array size is one This takes advantage of the repeated value. --- test/behavior/array.zig | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/behavior/array.zig') diff --git a/test/behavior/array.zig b/test/behavior/array.zig index 8250cdea06..9c7282f0f2 100644 --- a/test/behavior/array.zig +++ b/test/behavior/array.zig @@ -32,4 +32,9 @@ 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")); + + // this should cause a Value.repeated to be emitted in AIR. + // TODO: find a way to test that this is actually getting emmited + var j: [4]u8 = [1]u8{'a'} ** 4; + try expect(std.mem.eql(u8, &j, "aaaa")); } -- cgit v1.2.3