SIL: Lower captures to boxes with an appropriate generic context.

Officially kick SILBoxType over to be "nominal" in its layout, with generic layouts structurally parameterized only by formal types. Change SIL to lower a capture to a nongeneric box when possible, or a box capturing the enclosing generic context when necessary.
This commit is contained in:
Joe Groff
2016-12-13 17:48:30 -08:00
parent 464a47430d
commit 4444d83756
72 changed files with 668 additions and 554 deletions

View File

@@ -553,7 +553,12 @@ PromotedParamCloner::initCloned(SILFunction *Orig, IsFragile_t Fragile,
auto boxTy = param.getType()->castTo<SILBoxType>();
assert(boxTy->getLayout()->getFields().size() == 1
&& "promoting compound box not implemented");
auto paramTy = boxTy->getFieldType(Orig->getModule(), 0);
SILType paramTy;
{
Lowering::GenericContextScope scope(Orig->getModule().Types,
OrigFTI->getGenericSignature());
paramTy = boxTy->getFieldType(Orig->getModule(), 0);
}
auto promotedParam = SILParameterInfo(paramTy.getSwiftRValueType(),
ParameterConvention::Indirect_InoutAliasable);
ClonedInterfaceArgTys.push_back(promotedParam);