sema: strip @splat operand result type before checking it

This commit is contained in:
David Rubin
2025-08-09 18:47:55 -07:00
committed by Matthew Lugg
parent 6e90ce2536
commit 8e02f9f70d
5 changed files with 33 additions and 14 deletions

View File

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