aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/array.zig
diff options
context:
space:
mode:
authorDavid Rubin <daviru007@icloud.com>2025-08-09 18:47:55 -0700
committerMatthew Lugg <mlugg@mlugg.co.uk>2025-08-13 13:55:57 +0100
commit8e02f9f70df97891aabfce615a1ef43434bc5c1f (patch)
tree4fae570ff474dbeb7cdafa3fd1840d3e71de3df7 /test/behavior/array.zig
parent6e90ce25364b02555a3ca46013f85b2e80e98705 (diff)
downloadzig-8e02f9f70df97891aabfce615a1ef43434bc5c1f.tar.gz
zig-8e02f9f70df97891aabfce615a1ef43434bc5c1f.zip
sema: strip `@splat` operand result type before checking it
Diffstat (limited to 'test/behavior/array.zig')
-rw-r--r--test/behavior/array.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/array.zig b/test/behavior/array.zig
index 2e776d4653..741e9505b0 100644
--- a/test/behavior/array.zig
+++ b/test/behavior/array.zig
@@ -1112,3 +1112,16 @@ test "sentinel of runtime-known array initialization is populated" {
try expect(elems[0] == 42);
try expect(elems[1] == 123);
}
+
+test "splat with an error union or optional result type" {
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
+
+ const S = struct {
+ fn doTest(T: type) !?T {
+ return @splat(1);
+ }
+ };
+
+ _ = try S.doTest(@Vector(4, u32));
+ _ = try S.doTest([4]u32);
+}