@@ -910,19 +910,25 @@ static void makeArgument(Type ty, ParamDecl *decl,
910
910
SmallVectorImpl<SILValue> &args, SILGenFunction &SGF) {
911
911
assert (ty && " no type?!" );
912
912
913
+ if (ty->is <PackExpansionType>()) {
914
+ ty = PackType::get (SGF.getASTContext (), {ty});
915
+ }
916
+
913
917
// Destructure tuple value arguments.
914
- if (TupleType *tupleTy = decl->isInOut () ? nullptr : ty->getAs <TupleType>()) {
915
- for (auto fieldType : tupleTy->getElementTypes ())
916
- makeArgument (fieldType, decl, args, SGF);
917
- } else {
918
- auto loweredTy = SGF.getLoweredTypeForFunctionArgument (ty);
919
- if (decl->isInOut ())
920
- loweredTy = SILType::getPrimitiveAddressType (loweredTy.getASTType ());
921
- auto arg = SGF.F .begin ()->createFunctionArgument (loweredTy, decl);
922
- args.push_back (arg);
918
+ if (!decl->isInOut ()) {
919
+ if (TupleType *tupleTy = ty->getAs <TupleType>()) {
920
+ for (auto fieldType : tupleTy->getElementTypes ())
921
+ makeArgument (fieldType, decl, args, SGF);
922
+ return ;
923
+ }
923
924
}
924
- }
925
925
926
+ auto loweredTy = SGF.getLoweredTypeForFunctionArgument (ty);
927
+ if (decl->isInOut ())
928
+ loweredTy = SILType::getPrimitiveAddressType (loweredTy.getASTType ());
929
+ auto arg = SGF.F .begin ()->createFunctionArgument (loweredTy, decl);
930
+ args.push_back (arg);
931
+ }
926
932
927
933
void SILGenFunction::bindParameterForForwarding (ParamDecl *param,
928
934
SmallVectorImpl<SILValue> ¶meters) {
0 commit comments