aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorMitchell Hashimoto <mitchell.hashimoto@gmail.com>2022-03-08 20:44:58 -0800
committerAndrew Kelley <andrew@ziglang.org>2022-03-10 14:20:16 -0700
commit569870ca41e73c64d8dc9f1eccfef3529caf2266 (patch)
tree8a4ec47628cacc1723efbff01ba36ebc147a86ad /src/Sema.zig
parent0b82c02945c69e2e0465b5a4d9de471ea3c76d50 (diff)
downloadzig-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/Sema.zig')
-rw-r--r--src/Sema.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 195a0ef274..f74fa1e0bf 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -2212,6 +2212,10 @@ fn zirErrorSetDecl(
return sema.fail(block, src, "duplicate error set field {s}", .{name});
}
}
+
+ // names must be sorted.
+ Module.ErrorSet.sortNames(&names);
+
error_set.* = .{
.owner_decl = new_decl,
.node_offset = inst_data.src_node,