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.
Zig Version
0.12.0-dev.705+af40bce08
Steps to Reproduce and Observed Behavior
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
foois changed to return an error. In order to close this issue, an additional runtime safety test is needed to cover this.