-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
@errSetCast refuses to accept an error union operand #17343
Copy link
Copy link
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.
Milestone
Description
Zig Version
0.12.0-dev.695+303181901
Steps to Reproduce and Observed Behavior
const std = @import("std");
test {
const bar: error{Bad}!i32 = @errSetCast(foo());
std.testing.expect((try bar) == 1234);
}
fn foo() anyerror!i32 {
return 1234;
}$ stage4/bin/zig test test.zig
test.zig:4:33: error: expected error set type, found 'i32'
const bar: error{Bad}!i32 = @errSetCast(foo());
^~~~~~~~~~~~~~~~~~
Expected Behavior
Test passed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.