Zig Version
0.10.0-dev.2624+d506275a0
Steps to Reproduce
Note: This behavior applies to both stage1 and stage2.
Example:
const A = error{A};
const B = error{B};
fn failsToCompile0() A!B!void {
return B.B;
}
fn failsToCompile1() A!B!void {
return @as(B!void, B.B);
}
// NOTE: the following two compile.
fn succeedsCompilation0() A!B!void {
const inner: B!void = B.B;
return inner;
}
// NOTE: the following does not compile on stage2.
fn succeedsCompilation1() void {
_ = @as(A!B!void, @as(B!void, B.B)) catch {} catch {};
}
test {
failsToCompile0() catch {} catch {};
failsToCompile1() catch {} catch {};
succeedsCompilation0() catch {} catch {};
succeedsCompilation1();
}
Expected Behavior
Would expect the terminal to output:
Actual Behavior
stage1:
./test.zig:5:13: error: expected type 'A', found 'B'
return B.B;
^
./test.zig:2:17: note: 'error.B' not a member of destination error set
const B = error{B};
^
./test.zig:8:25: error: expected type 'A', found 'B'
return @as(B!void, B.B);
^
./test.zig:2:17: note: 'error.B' not a member of destination error set
const B = error{B};
stage2:
test.zig:5:13: error: expected type 'error{A}', found type 'error{B}'
return B.B;
^
test.zig:8:12: error: expected type 'error{A}', found type 'error{B}'
return @as(B!void, B.B);
^
test.zig:13:12: error: expected type 'error{A}', found type 'error{B}'
return inner;
^
test.zig:17:23: error: expected type 'error{A}', found type 'error{B}'
_ = @as(A!B!void, @as(B!void, B.B)) catch {} catch {};
Zig Version
0.10.0-dev.2624+d506275a0
Steps to Reproduce
Note: This behavior applies to both stage1 and stage2.
Example:
Expected Behavior
Would expect the terminal to output:
Actual Behavior
stage1:
stage2: