aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/array.zig
diff options
context:
space:
mode:
authorJacob G-W <jacoblevgw@gmail.com>2021-09-30 21:31:46 -0400
committerJacob G-W <jacoblevgw@gmail.com>2021-10-01 16:46:28 -0400
commit83dcd9f0386a6bd70cf8d7dee3892f3b8d31d506 (patch)
tree6e531bf3dd6d39647a7971cae1d021900ea31055 /test/behavior/array.zig
parentb0e89ee499b8110bca6964e996c5862337147e32 (diff)
downloadzig-83dcd9f0386a6bd70cf8d7dee3892f3b8d31d506.tar.gz
zig-83dcd9f0386a6bd70cf8d7dee3892f3b8d31d506.zip
stage2: emit Value.repeated for `**` where the array size is one
This takes advantage of the repeated value.
Diffstat (limited to 'test/behavior/array.zig')
-rw-r--r--test/behavior/array.zig5
1 files changed, 5 insertions, 0 deletions
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"));
}