Merge pull request #86020 from slavapestov/opaque-archetype-sugar-type-variable

AST: Canonicalize opaque archetype substitution maps in the solver arena
This commit is contained in:
Slava Pestov
2025-12-13 08:54:58 -05:00
committed by GitHub

View File

@@ -6086,6 +6086,11 @@ GenericEnvironment *GenericEnvironment::forPrimary(GenericSignature signature) {
/// outer substitutions.
GenericEnvironment *GenericEnvironment::forOpaqueType(
OpaqueTypeDecl *opaque, SubstitutionMap subs) {
// Don't preserve sugar if we have type variables, because this leads to
// excessive solver arena memory usage.
if (subs.getRecursiveProperties().hasTypeVariable())
subs = subs.getCanonical();
auto &ctx = opaque->getASTContext();
auto properties = ArchetypeType::archetypeProperties(