-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.stage1The process of building from source via WebAssembly and the C backend.The process of building from source via WebAssembly and the C backend.
Description
test "else => unreachable hitting error" {
foo() catch |e| switch (e) {
error.NotThisOne => {},
else => unreachable,
};
}
const E = error{
NotThisOne,
OtherOne,
};
fn foo() E!void {
return error.OtherOne;
}output:
1/1 test "else => unreachable hitting error"...reached unreachable code
/home/andy/Downloads/zig/build/test.zig:4:17: 0x2055b6 in test "else => unreachable hitting error" (test)
else => unreachable,
^
/home/andy/Downloads/zig/lib/std/special/test_runner.zig:13:25: 0x228471 in std.special.main (test)
if (test_fn.func()) |_| {
^
/home/andy/Downloads/zig/lib/std/special/start.zig:204:37: 0x2272e5 in std.special.posixCallMainAndExit (test)
const result = root.main() catch |err| {
^
/home/andy/Downloads/zig/lib/std/special/start.zig:102:5: 0x22715f in std.special._start (test)
@noInlineCall(posixCallMainAndExit);
^
Tests failed. Use the following command to reproduce the failure:
/home/andy/Downloads/zig/build/zig-cache/o/4P7VSNxF-q2bqL786SGteb7Jk6o2zFfGEcF1BiRIoO8a0yEuWJi1uW37KiUFAk2X/test
Expected output: something like this:
1/1 test "else => unreachable hitting error"...attempt to unwrap error: OtherOne
/home/andy/Downloads/zig/build/test.zig:11:5: 0x2056f8 in foo (test)
return error.OtherOne;
^
???:?:?: 0x20579c in ??? (???)
/home/andy/Downloads/zig/build/test.zig:4:13: 0x2055b2 in test "else => unreachable hitting error" (test)
else => unreachable;
^
/home/andy/Downloads/zig/lib/std/special/test_runner.zig:13:25: 0x228501 in std.special.main (test)
if (test_fn.func()) |_| {
^
/home/andy/Downloads/zig/lib/std/special/start.zig:204:37: 0x227375 in std.special.posixCallMainAndExit (test)
const result = root.main() catch |err| {
^
/home/andy/Downloads/zig/lib/std/special/start.zig:102:5: 0x2271ef in std.special._start (test)
@noInlineCall(posixCallMainAndExit);
^
Tests failed. Use the following command to reproduce the failure:
/home/andy/Downloads/zig/build/zig-cache/o/ESeTr9sZaQtjsYqR6CNXHF8ySsYnUhoGitQryIvDP54IW8FOmCiGHivusuRweVdD/test
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.stage1The process of building from source via WebAssembly and the C backend.The process of building from source via WebAssembly and the C backend.