mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 13:58:27 +00:00
This is all of the expected 0.14.0 progress on #21530, which can now be postponed once this commit is merged. This required rewriting the (un)wrap operations since the original implementations were extremely buggy. Also adds an easy way to retrigger Sema OPV bugs so that I don't have to keep updating #22419 all the time.
22 lines
504 B
Zig
22 lines
504 B
Zig
const std = @import("std");
|
|
|
|
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
|
|
_ = stack_trace;
|
|
if (std.mem.eql(u8, message, "invalid error code")) {
|
|
std.process.exit(0);
|
|
}
|
|
std.process.exit(1);
|
|
}
|
|
const Set1 = error{ A, B };
|
|
const Set2 = error{ A, C };
|
|
pub fn main() !void {
|
|
foo(Set1.B) catch {};
|
|
return error.TestFailed;
|
|
}
|
|
fn foo(set1: Set1) Set2 {
|
|
return @errorCast(set1);
|
|
}
|
|
// run
|
|
// backend=stage2,llvm
|
|
// target=native
|