mirror of
https://github.com/ziglang/zig.git
synced 2026-11-22 04:37:39 -05:00
Merge remote-tracking branch 'origin/master' into llvm15
This commit is contained in:
commit
011663eea5
9 files changed
+261
-148
No files matched your search
@@ -127,3 +127,20 @@ test "errdefer with payload" {
|
||||
try S.doTheTest();
|
||||
comptime try S.doTheTest();
|
||||
}
|
||||
|
||||
test "simple else prong doesn't emit an error for unreachable else prong" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
|
||||
const S = struct {
|
||||
fn foo() error{Foo}!void {
|
||||
return error.Foo;
|
||||
}
|
||||
};
|
||||
var a: u32 = 0;
|
||||
defer a += 1;
|
||||
S.foo() catch |err| switch (err) {
|
||||
error.Foo => a += 1,
|
||||
else => |e| return e,
|
||||
};
|
||||
try expect(a == 1);
|
||||
}
|
||||
Reference in new issue
Block a user