Commit 7666d5fc26

Andrew Kelley <andrew@ziglang.org>
2025-09-08 08:03:06
add compile error test case
1 parent dca4c30
Changed files (1)
test
test/cases/compile_errors/in_memory_coerce_vector_to_array.zig
@@ -0,0 +1,16 @@
+export fn entry() void {
+    _ = foo() catch {};
+}
+fn foo() anyerror![4]u32 {
+    return bar();
+}
+fn bar() anyerror!@Vector(4, u32) {
+    return .{ 1, 2, 3, 4 };
+}
+// error
+// backend=stage2
+// target=native
+//
+// :5:15: error: expected type 'anyerror![4]u32', found 'anyerror!@Vector(4, u32)'
+// :5:15: note: error union payload '@Vector(4, u32)' cannot cast into error union payload '[4]u32'
+// :4:18: note: function return type declared here