aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-11-07 00:43:18 +0000
committerMatthew Lugg <mlugg@mlugg.co.uk>2023-11-07 06:11:01 +0000
commit9b394a200a55c8347e32607dcff568e8482ada48 (patch)
tree5dcce4e6c5620e1dcabff2d2daa20e7ea7e42751 /test/behavior
parentbf0387b6bb9c65c30f14e699a2f2cfbfea27184e (diff)
downloadzig-9b394a200a55c8347e32607dcff568e8482ada48.tar.gz
zig-9b394a200a55c8347e32607dcff568e8482ada48.zip
Sema: allow destructuring vectors
This was intended to work when destructuring was first implemented, and was just unintentionally missed out.
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/destructure.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/destructure.zig b/test/behavior/destructure.zig
index 174f9ffc24..4d7c336daa 100644
--- a/test/behavior/destructure.zig
+++ b/test/behavior/destructure.zig
@@ -138,3 +138,14 @@ test "destructure of tuple with comptime fields results in some comptime-known v
try expect(b == 42);
try expect(d == 42);
}
+
+test "destructure vector" {
+ const vec: @Vector(2, i32) = .{ 1, 2 };
+ const x, const y = vec;
+
+ comptime assert(@TypeOf(x) == i32);
+ comptime assert(@TypeOf(y) == i32);
+
+ try expect(x == 1);
+ try expect(y == 2);
+}