mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Use only interface types in the verifier.
Treat the interface types of SILFunctionTypes as the canonical representation in the verifier. Do a bunch of supporting and annoyingly irreducible work to enable this: - Stop trying to uncurry generic parameter lists during type lowering and preserve the structure of AST GenericParamLists. This makes mapping dependent types into contexts easier. - Properly walk generic parameter lists at all depths when grooming substitution vectors for use with substGenericArgs interfaces. - Reseat the generic parameter lists created for protocol_method results so that we don't expect the outer Self archetype to be unbound; it's provided by the extra data of the result. - Hack SILFunctionType serialization never to use a decl reference when serializing its generic param list. When this happens, we get incorrect archetypes. This is a gross hack, but when we're able to jump all the way to interface types, it can go away. Putting these ducks in a row nicely un-XFAILs TextFormatting.swift. Swift SVN r11989
This commit is contained in:
@@ -118,8 +118,7 @@ namespace {
|
||||
ArrayRef<Substitution> SILGenFunction::getForwardingSubstitutions() {
|
||||
auto outerFTy = F.getLoweredFunctionType();
|
||||
if (outerFTy->isPolymorphic()) {
|
||||
return buildForwardingSubstitutions(
|
||||
outerFTy->getGenericParams()->getAllArchetypes());
|
||||
return buildForwardingSubstitutions(outerFTy->getGenericParams());
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -2053,7 +2052,15 @@ SILGenModule::emitProtocolWitness(ProtocolConformance *conformance,
|
||||
SourceLoc(),
|
||||
reqtParams.getRequirements(),
|
||||
SourceLoc());
|
||||
methodParams->setOuterParameters(conformanceParams);
|
||||
|
||||
// Preserve the depth of generic arguments by adding an empty outer generic
|
||||
// param list if the conformance is concrete.
|
||||
GenericParamList *outerParams = conformanceParams;
|
||||
if (!outerParams)
|
||||
outerParams = GenericParamList::create(getASTContext(),
|
||||
SourceLoc(), {}, SourceLoc());
|
||||
|
||||
methodParams->setOuterParameters(outerParams);
|
||||
methodParams->setAllArchetypes(reqtParams.getAllArchetypes());
|
||||
methodTy = CanPolymorphicFunctionType::get(pft.getInput(), pft.getResult(),
|
||||
methodParams,
|
||||
|
||||
Reference in New Issue
Block a user