Canonicalize imported witness blocks on FacetValue (#6458)

The test has a more complete explanation of this; witnesses on the
FacetValue must have a canonical ordering.
This commit is contained in:
Jon Ross-Perkins
2025-12-04 00:05:24 +00:00
committed by GitHub
parent f000194d8b
commit 103c49a763
5 changed files with 296 additions and 4 deletions
+7 -2
View File
@@ -3101,12 +3101,17 @@ static auto TryResolveTypedInst(ImportRefResolver& resolver,
return ResolveResult::Retry();
}
auto witnesses_block_id = SemIR::InstBlockId::None;
if (inst.witnesses_block_id.has_value()) {
witnesses_block_id =
AddCanonicalWitnessesBlock(resolver.local_ir(), witnesses);
}
return ResolveResult::Deduplicated<SemIR::FacetValue>(
resolver,
{.type_id = resolver.local_types().GetTypeIdForTypeConstantId(type_id),
.type_inst_id = type_inst_id,
.witnesses_block_id = GetLocalCanonicalInstBlockId(
resolver, inst.witnesses_block_id, witnesses)});
.witnesses_block_id = witnesses_block_id});
}
static auto TryResolveTypedInst(ImportRefResolver& resolver,