Treat the empty inst block as being canonical. (#4199)

TryEvalInst was assuming this to be the case when forming canonical
constants, but it previously wasn't.

This fixes an issue where we can end up with two identical-looking
constants for an empty struct value: one with an `Empty` block and
another with the canonical empty block.
This commit is contained in:
Richard Smith
2024-08-07 21:58:28 +00:00
committed by GitHub
parent 3d13b8f71c
commit 3c4c234d01
16 changed files with 107 additions and 131 deletions
+1 -2
View File
@@ -94,8 +94,7 @@ TEST(SemIRTest, YAML) {
Pair("import_refs", Yaml::Mapping(IsEmpty())),
Pair("global_init", Yaml::Mapping(IsEmpty())),
Pair("block4", Yaml::Mapping(Each(Pair(_, inst_id)))),
Pair("block5", Yaml::Mapping(Each(Pair(_, inst_id)))),
Pair("block6", Yaml::Mapping(Each(Pair(_, inst_id)))))))));
Pair("block5", Yaml::Mapping(Each(Pair(_, inst_id)))))))));
auto root = Yaml::Sequence(ElementsAre(Yaml::Mapping(
ElementsAre(Pair("filename", "test.carbon"), Pair("sem_ir", file)))));