Produce specialized conformances to AnyObject for bound generic types.

Fixes rdar://31910351 (SR-4750)
This commit is contained in:
Roman Levenstein
2017-05-01 17:53:57 -07:00
parent 98aae46ae6
commit 0aff7c0c78
2 changed files with 10 additions and 3 deletions

View File

@@ -159,7 +159,13 @@ ProtocolConformanceRef::subst(Type origType,
SmallVector<ProtocolConformance *, 1> lookupResults;
classDecl->lookupConformance(classDecl->getParentModule(), proto,
lookupResults);
return ProtocolConformanceRef(lookupResults.front());
auto *conf = lookupResults.front();
auto subMap = substType->getContextSubstitutionMap(
conf->getDeclContext()->getParentModule(), conf->getDeclContext());
if (!subMap.empty())
conf = substType->getASTContext().getSpecializedConformance(substType,
conf, subMap);
return ProtocolConformanceRef(conf);
}
llvm_unreachable("Invalid conformance substitution");