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