mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user