-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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.705+af40bce08
Steps to Reproduce and Observed Behavior
const std = @import("std");
test {
const bar: error{}!i32 = @errorCast(foo());
std.testing.expect((try bar) == 1234);
}
fn foo() anyerror!i32 {
return 1234;
}$ stage4/bin/zig test test3.zig
test3.zig:4:30: error: error sets 'anyerror' and 'error{}' have no common errors
const bar: error{}!i32 = @errorCast(foo());
^~~~~~~~~~~~~~~~~
Expected Behavior
Test passed. All the logic for disjoint sets should be skipped when casting error unions.
However, there should be a safety check which would be triggered in the above example if foo is changed to return an error. In order to close this issue, an additional runtime safety test is needed to cover this.
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.