aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/error.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-03-12 11:36:05 +0200
committerVeikka Tuominen <git@vexu.eu>2022-03-12 11:36:05 +0200
commita3cfb15fb4be719fe11f231113020532ad0b1258 (patch)
treedc28befc2d69638d85ed51e54fa5016257471c66 /test/behavior/error.zig
parent07cc2fce2a2745a05c65fdd1a36c3198d0ec91b4 (diff)
downloadzig-a3cfb15fb4be719fe11f231113020532ad0b1258.tar.gz
zig-a3cfb15fb4be719fe11f231113020532ad0b1258.zip
Sema: always allow coercing error set to current inferred error set
Diffstat (limited to 'test/behavior/error.zig')
-rw-r--r--test/behavior/error.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/behavior/error.zig b/test/behavior/error.zig
index 93d76443ae..e6c69f4abf 100644
--- a/test/behavior/error.zig
+++ b/test/behavior/error.zig
@@ -634,3 +634,18 @@ test "peer type resolution of two different error unions" {
const err = if (cond) a else b;
try err;
}
+
+test "coerce error set to the current inferred error set" {
+ const S = struct {
+ fn foo() !void {
+ var a = false;
+ if (a) {
+ const b: error{A}!void = error.A;
+ return b;
+ }
+ const b = error.A;
+ return b;
+ }
+ };
+ S.foo() catch {};
+}