diff options
Diffstat (limited to 'test/behavior/error.zig')
| -rw-r--r-- | test/behavior/error.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/behavior/error.zig b/test/behavior/error.zig index edbe866b95..b7d4511fe9 100644 --- a/test/behavior/error.zig +++ b/test/behavior/error.zig @@ -115,3 +115,19 @@ test "implicit cast to optional to error union to return result loc" { try S.entry(); //comptime S.entry(); TODO } + +test "error: fn returning empty error set can be passed as fn returning any error" { + entry(); + comptime entry(); +} + +fn entry() void { + foo2(bar2); +} + +fn foo2(f: fn () anyerror!void) void { + const x = f(); + x catch {}; +} + +fn bar2() (error{}!void) {} |
