Sema: check error union payload types in @errorCast
This commit is contained in:
@@ -13,6 +13,11 @@ export fn entry3() void {
|
||||
const a: anyerror = @errorCast(e);
|
||||
_ = a;
|
||||
}
|
||||
pub export fn entry4() void {
|
||||
const a: anyerror!u32 = 123;
|
||||
const b: anyerror!f32 = @errorCast(a);
|
||||
_ = b;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage2
|
||||
@@ -21,3 +26,6 @@ export fn entry3() void {
|
||||
// :4:25: error: expected error set or error union type, found 'ComptimeInt'
|
||||
// :8:20: error: expected error set or error union type, found 'Int'
|
||||
// :13:25: error: cannot cast an error union type to error set
|
||||
// :18:29: error: payload types of error unions must match
|
||||
// :18:29: note: destination payload is 'f32'
|
||||
// :18:29: note: operand payload is 'u32'
|
||||
|
||||
Reference in New Issue
Block a user