add compile error test case

This commit is contained in:
Andrew Kelley 2025-09-07 23:03:06 -07:00
parent dca4c302dd
commit 7666d5fc26

View File

@ -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