aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/error.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-11-22 19:00:30 -0500
committerGitHub <noreply@github.com>2021-11-22 19:00:30 -0500
commit11330cbcc55f7d7dbd2de2f5acd7b097cd19788c (patch)
tree68f25f32b59d803986f67f80e660fb8b76fc3025 /test/behavior/error.zig
parent691090f3429b8625252dd5cfec101f2a9e171463 (diff)
parent2b589d71fbcacb2e8bc8746dd4b675e57b3a53df (diff)
downloadzig-11330cbcc55f7d7dbd2de2f5acd7b097cd19788c.tar.gz
zig-11330cbcc55f7d7dbd2de2f5acd7b097cd19788c.zip
Merge pull request #10201 from Snektron/stage2-more-coercion
stage2: more in-memory coercion
Diffstat (limited to 'test/behavior/error.zig')
-rw-r--r--test/behavior/error.zig16
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) {}