@@ -76,7 +76,9 @@ addSubstitution(CanSubstitutableType type, Type replacement) {
76
76
}
77
77
78
78
Optional<ProtocolConformanceRef>
79
- SubstitutionMap::lookupConformance (CanType type, ProtocolDecl *proto) const {
79
+ SubstitutionMap::lookupConformance (CanType origType, ProtocolDecl *proto) const {
80
+ CanType type = origType;
81
+
80
82
// If we have an archetype, map out of the context so we can compute a
81
83
// conformance access path.
82
84
GenericEnvironment *genericEnv = nullptr ;
@@ -146,7 +148,7 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
146
148
// FIXME: Rip this out once we can get a concrete conformance from
147
149
// an archetype.
148
150
auto *M = proto->getParentModule ();
149
- auto substType = type .subst (*this );
151
+ auto substType = origType .subst (*this );
150
152
if (substType &&
151
153
!substType->is <ArchetypeType>() &&
152
154
!substType->isTypeParameter () &&
@@ -396,8 +398,13 @@ void SubstitutionMap::verify() const {
396
398
}
397
399
398
400
void SubstitutionMap::dump (llvm::raw_ostream &out) const {
401
+ auto *genericSig = getGenericSignature ();
402
+ if (genericSig == nullptr ) {
403
+ out << " Empty substitution map\n " ;
404
+ return ;
405
+ }
399
406
out << " Generic signature: " ;
400
- getGenericSignature () ->print (out);
407
+ genericSig ->print (out);
401
408
out << " \n " ;
402
409
out << " Substitutions:\n " ;
403
410
for (const auto &sub : subMap) {
0 commit comments