|
11 | 11 | //===----------------------------------------------------------------------===// |
12 | 12 | // |
13 | 13 | // This file defines the SubstitutionMap class. A SubstitutionMap packages |
14 | | -// together a set of replacement types and protocol conformances for |
15 | | -// specializing generic types. |
| 14 | +// together a set of replacement types and protocol conformances, given by |
| 15 | +// the generic parameters and conformance requirements of the substitution map's |
| 16 | +// input generic signature. |
16 | 17 | // |
17 | | -// SubstitutionMaps either have type parameters or archetypes as keys, |
18 | | -// based on whether they were built from a GenericSignature or a |
19 | | -// GenericEnvironment. |
20 | | -// |
21 | | -// To specialize a type, call Type::subst() with the right SubstitutionMap. |
| 18 | +// To substitute a type, call Type::subst() with the right SubstitutionMap. |
22 | 19 | // |
23 | 20 | //===----------------------------------------------------------------------===// |
24 | 21 |
|
@@ -238,20 +235,9 @@ Type SubstitutionMap::lookupSubstitution(GenericTypeParamType *genericParam) con |
238 | 235 |
|
239 | 236 | ProtocolConformanceRef |
240 | 237 | SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const { |
241 | | - if (empty()) |
242 | | - return ProtocolConformanceRef::forInvalid(); |
243 | | - |
244 | | - // If we have an archetype, map out of the context so we can compute a |
245 | | - // conformance access path. |
246 | | - if (auto archetype = dyn_cast<ArchetypeType>(type)) { |
247 | | - if (!isa<OpaqueTypeArchetypeType>(archetype)) { |
248 | | - type = archetype->getInterfaceType()->getCanonicalType(); |
249 | | - } |
250 | | - } |
| 238 | + ASSERT(type->isTypeParameter()); |
251 | 239 |
|
252 | | - // Error path: if we don't have a type parameter, there is no conformance. |
253 | | - // FIXME: Query concrete conformances in the generic signature? |
254 | | - if (!type->isTypeParameter()) |
| 240 | + if (empty()) |
255 | 241 | return ProtocolConformanceRef::forInvalid(); |
256 | 242 |
|
257 | 243 | auto genericSig = getGenericSignature(); |
|
0 commit comments