diff options
| author | Mitchell Hashimoto <mitchell.hashimoto@gmail.com> | 2022-03-08 20:44:58 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-10 14:20:16 -0700 |
| commit | 569870ca41e73c64d8dc9f1eccfef3529caf2266 (patch) | |
| tree | 8a4ec47628cacc1723efbff01ba36ebc147a86ad /src/value.zig | |
| parent | 0b82c02945c69e2e0465b5a4d9de471ea3c76d50 (diff) | |
| download | zig-569870ca41e73c64d8dc9f1eccfef3529caf2266.tar.gz zig-569870ca41e73c64d8dc9f1eccfef3529caf2266.zip | |
stage2: error_set_merged type equality
This implements type equality for error sets. This is done
through element-wise error set comparison.
Inferred error sets are always distinct types and other error sets are
always sorted. See #11022.
Diffstat (limited to 'src/value.zig')
| -rw-r--r-- | src/value.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/value.zig b/src/value.zig index 121e380bd9..502de64348 100644 --- a/src/value.zig +++ b/src/value.zig @@ -1870,6 +1870,16 @@ pub const Value = extern union { return eql(a_payload.container_ptr, b_payload.container_ptr, ty); }, + .@"error" => { + const a_name = a.castTag(.@"error").?.data.name; + const b_name = b.castTag(.@"error").?.data.name; + return std.mem.eql(u8, a_name, b_name); + }, + .eu_payload => { + const a_payload = a.castTag(.eu_payload).?.data; + const b_payload = b.castTag(.eu_payload).?.data; + return eql(a_payload, b_payload, ty.errorUnionPayload()); + }, .eu_payload_ptr => @panic("TODO: Implement more pointer eql cases"), .opt_payload_ptr => @panic("TODO: Implement more pointer eql cases"), .array => { |
