diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-03-12 11:36:05 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-03-12 11:36:05 +0200 |
| commit | a3cfb15fb4be719fe11f231113020532ad0b1258 (patch) | |
| tree | dc28befc2d69638d85ed51e54fa5016257471c66 /test/behavior/error.zig | |
| parent | 07cc2fce2a2745a05c65fdd1a36c3198d0ec91b4 (diff) | |
| download | zig-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.zig | 15 |
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 {}; +} |
