stage2: emit Value.repeated for ** where the array size is one

This takes advantage of the repeated value.
This commit is contained in:
Jacob G-W
2021-09-30 21:31:46 -04:00
parent b0e89ee499
commit 83dcd9f038
2 changed files with 20 additions and 9 deletions

View File

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