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:
@@ -266,6 +266,34 @@ private:
|
||||
cast<PolymorphicFunctionType>(OrigFormalType)
|
||||
->substGenericArgs(SGM.SwiftModule, archetype)
|
||||
->getCanonicalType());
|
||||
|
||||
// If the requirement is generic, sever its connection to the substituted
|
||||
// outer parameter list.
|
||||
if (auto polyMethod = dyn_cast<PolymorphicFunctionType>(
|
||||
partialSubstFormalType.getResult())) {
|
||||
auto origParams = &polyMethod->getGenericParams();
|
||||
|
||||
auto emptyOuterParams
|
||||
= GenericParamList::create(polyMethod->getASTContext(),
|
||||
SourceLoc(),
|
||||
{}, SourceLoc());
|
||||
|
||||
auto params = GenericParamList::create(polyMethod->getASTContext(),
|
||||
SourceLoc(),
|
||||
origParams->getParams(),
|
||||
SourceLoc(),
|
||||
origParams->getRequirements(),
|
||||
SourceLoc());
|
||||
params->setAllArchetypes(origParams->getAllArchetypes());
|
||||
params->setOuterParameters(emptyOuterParams);
|
||||
|
||||
polyMethod = CanPolymorphicFunctionType::get(polyMethod.getInput(),
|
||||
polyMethod.getResult(),
|
||||
params,
|
||||
polyMethod->getExtInfo());
|
||||
partialSubstFormalType
|
||||
= CanFunctionType::get(partialSubstFormalType.getInput(), polyMethod);
|
||||
}
|
||||
|
||||
auto partialSubstUncurriedType =
|
||||
SGM.Types.getConstantFunctionType(constant, partialSubstFormalType,
|
||||
|
||||
Reference in New Issue
Block a user