AST: Use PackElementType to model references to pack elements of outer expansions

This commit is contained in:
Slava Pestov
2023-05-31 13:51:50 -04:00
parent 82a4826dcd
commit be218f5e16
12 changed files with 216 additions and 64 deletions

View File

@@ -119,7 +119,9 @@ ProtocolConformanceRef::subst(Type origType, InFlightSubstitution &IFS) const {
}
// Check the conformance map.
return IFS.lookupConformance(origType->getCanonicalType(), substType, proto);
// FIXME: Pack element level?
return IFS.lookupConformance(origType->getCanonicalType(), substType, proto,
/*level=*/0);
}
ProtocolConformanceRef ProtocolConformanceRef::mapConformanceOutOfContext() const {
@@ -130,7 +132,8 @@ ProtocolConformanceRef ProtocolConformanceRef::mapConformanceOutOfContext() cons
return archetypeType->getInterfaceType();
return type;
},
MakeAbstractConformanceForGenericType());
MakeAbstractConformanceForGenericType(),
SubstFlags::PreservePackExpansionLevel);
return ProtocolConformanceRef(concrete);
} else if (isPack()) {
return getPack()->subst(
@@ -139,7 +142,8 @@ ProtocolConformanceRef ProtocolConformanceRef::mapConformanceOutOfContext() cons
return archetypeType->getInterfaceType();
return type;
},
MakeAbstractConformanceForGenericType());
MakeAbstractConformanceForGenericType(),
SubstFlags::PreservePackExpansionLevel);
}
return *this;