@@ -3241,8 +3241,13 @@ class ArgumentMatcher : public MatchCallArgumentListener {
3241
3241
SmallString<32 > insertBuf;
3242
3242
llvm::raw_svector_ostream insertText (insertBuf);
3243
3243
3244
- if (argIdx != 0 )
3245
- insertText << " , " ;
3244
+ if (argIdx != 0 ) {
3245
+ if (isPropertyWrapperImplicitInit ()) {
3246
+ insertText << " (" ;
3247
+ } else {
3248
+ insertText << " , " ;
3249
+ }
3250
+ }
3246
3251
if (!name.empty ())
3247
3252
insertText << name.str () << " : " ;
3248
3253
Type Ty = param.getOldType ();
@@ -3257,6 +3262,9 @@ class ArgumentMatcher : public MatchCallArgumentListener {
3257
3262
insertText << " <#" << Ty << " #>" ;
3258
3263
if (argIdx == 0 && insertableEndIdx != 0 )
3259
3264
insertText << " , " ;
3265
+ if (isPropertyWrapperImplicitInit ()) {
3266
+ insertText << " )" ;
3267
+ }
3260
3268
3261
3269
SourceLoc insertLoc;
3262
3270
if (argIdx > insertableEndIdx) {
@@ -3267,6 +3275,9 @@ class ArgumentMatcher : public MatchCallArgumentListener {
3267
3275
// fn(x: 1) { return 1 }
3268
3276
// is diagnosed as "missing argument for 'y'" (missingParamIdx 1).
3269
3277
// It should be "missing argument for 'z'" (missingParamIdx 2).
3278
+ } else if (isPropertyWrapperImplicitInit ()) {
3279
+ insertLoc =
3280
+ Lexer::getLocForEndOfToken (TC.Context .SourceMgr , FnExpr->getLoc ());
3270
3281
} else if (auto *TE = dyn_cast<TupleExpr>(ArgExpr)) {
3271
3282
// fn():
3272
3283
// fn([argMissing])
@@ -3345,6 +3356,21 @@ class ArgumentMatcher : public MatchCallArgumentListener {
3345
3356
Diagnosed = true ;
3346
3357
}
3347
3358
3359
+ bool isPropertyWrapperImplicitInit () {
3360
+ if (auto TE = dyn_cast<TypeExpr>(FnExpr)) {
3361
+ if (auto info = TE->getInstanceType ()
3362
+ ->getAnyNominal ()
3363
+ ->getPropertyWrapperTypeInfo ()) {
3364
+ if (auto parent = CandidateInfo.CS .getParentExpr (FnExpr)) {
3365
+ if (auto CE = dyn_cast<CallExpr>(parent)) {
3366
+ return CE->isImplicit ();
3367
+ }
3368
+ }
3369
+ }
3370
+ }
3371
+ return false ;
3372
+ }
3373
+
3348
3374
bool missingLabel (unsigned paramIdx) override {
3349
3375
return false ;
3350
3376
}
0 commit comments