[mangler][specializer] When mangling ExistentialMetatypes or Metatypes, mangle in the representation of the metatype.

rdar://16937175

Swift SVN r18219
This commit is contained in:
Michael Gottesman
2014-05-16 22:28:30 +00:00
parent 46c81c8075
commit 39841c3889
3 changed files with 96 additions and 6 deletions

View File

@@ -799,6 +799,17 @@ GenericSpecializer::specializeApplyInstGroup(SILFunction *F, AIList &List) {
if (auto PrevF = M->lookUpFunction(ClonedName)) {
NewF = PrevF;
createdFunction = false;
#ifndef NDEBUG
// Make sure that NewF's subst type matches the expected type.
auto Subs = Bucket[0]->getSubstitutions();
auto FTy =
F->getLoweredFunctionType()->substInterfaceGenericArgs(*M,
M->getSwiftModule(),
Subs);
assert(FTy == NewF->getLoweredFunctionType() &&
"Previously specialized function does not match expected type.");
#endif
} else {
// Create a new function.
NewF = TypeSubCloner::cloneFunction(F, InterfaceSubs, ContextSubs,