@@ -3740,6 +3740,10 @@ bool MissingArgumentsFailure::diagnoseSingleMissingArgument() const {
3740
3740
if (label.empty ()) {
3741
3741
emitDiagnostic (insertLoc, diag::missing_argument_positional, position + 1 )
3742
3742
.fixItInsert (insertLoc, insertText.str ());
3743
+ } else if (isPropertyWrapperInitialization ()) {
3744
+ auto *TE = cast<TypeExpr>(fnExpr);
3745
+ emitDiagnostic (TE->getLoc (), diag::property_wrapper_missing_arg_init, label,
3746
+ resolveType (TE->getInstanceType ())->getString ());
3743
3747
} else {
3744
3748
emitDiagnostic (insertLoc, diag::missing_argument_named, label)
3745
3749
.fixItInsert (insertLoc, insertText.str ());
@@ -3880,6 +3884,23 @@ bool MissingArgumentsFailure::diagnoseInvalidTupleDestructuring() const {
3880
3884
return true ;
3881
3885
}
3882
3886
3887
+ bool MissingArgumentsFailure::isPropertyWrapperInitialization () const {
3888
+ auto *call = dyn_cast<CallExpr>(getRawAnchor ());
3889
+ if (!(call && call->isImplicit ()))
3890
+ return false ;
3891
+
3892
+ auto TE = dyn_cast<TypeExpr>(call->getFn ());
3893
+ if (!TE)
3894
+ return false ;
3895
+
3896
+ auto instanceTy = TE->getInstanceType ();
3897
+ if (!instanceTy)
3898
+ return false ;
3899
+
3900
+ auto *NTD = resolveType (instanceTy)->getAnyNominal ();
3901
+ return NTD && NTD->getAttrs ().hasAttribute <PropertyWrapperAttr>();
3902
+ }
3903
+
3883
3904
bool ClosureParamDestructuringFailure::diagnoseAsError () {
3884
3905
auto *closure = cast<ClosureExpr>(getAnchor ());
3885
3906
auto params = closure->getParameters ();
0 commit comments