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:
Joe Groff
2014-01-07 06:50:20 +00:00
parent 81d5c227dc
commit 44fb729830
12 changed files with 195 additions and 222 deletions

View File

@@ -1487,6 +1487,10 @@ SILFunctionType::SILFunctionType(GenericParamList *genericParams, ExtInfo ext,
auto getArchetypesAsDependentTypes = [&](Type t) -> Type {
if (!t) return t;
if (auto arch = t->getAs<ArchetypeType>()) {
// As a kludge, we allow Self archetypes of protocol_methods to be
// unapplied.
if (arch->getSelfProtocol() && !archetypeMap.count(arch))
return arch;
return arch->getAsDependentType(archetypeMap);
}
return t;