diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-02-05 20:13:56 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2025-02-05 20:13:56 +0000 |
| commit | cac814cf58ca65ffd8081dca6f2f5b26d822ef5d (patch) | |
| tree | a47d2a1e449630d66526acbb73e4714cffee52fc /test | |
| parent | 9ba9f457be13c0c32981e94cf75ba7ea6619d92f (diff) | |
| download | zig-cac814cf58ca65ffd8081dca6f2f5b26d822ef5d.tar.gz zig-cac814cf58ca65ffd8081dca6f2f5b26d822ef5d.zip | |
Sema: fix comparison between error set and comptime-known error union
Resolves: #20613
Diffstat (limited to 'test')
| -rw-r--r-- | test/behavior/error.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/error.zig b/test/behavior/error.zig index ee9e961884..c915da9a6e 100644 --- a/test/behavior/error.zig +++ b/test/behavior/error.zig @@ -1100,3 +1100,14 @@ test "return error union with i65" { fn add(x: i65, y: i65) anyerror!i65 { return x + y; } + +test "compare error union to error set" { + const S = struct { + fn doTheTest(val: error{Foo}!i32) !void { + if (error.Foo == val) return error.Unexpected; + if (val == error.Foo) return error.Unexpected; + } + }; + try S.doTheTest(0); + try comptime S.doTheTest(0); +} |
