@@ -5060,18 +5060,35 @@ ConstraintSystem::applyPropertyWrapperToParameter(
50605060 anchor = apply->getFn ();
50615061 }
50625062
5063- if (argLabel. hasDollarPrefix () && (!param || !param-> hasExternalPropertyWrapper ())) {
5063+ auto recordPropertyWrapperFix = [&](ConstraintFix *fix) -> TypeMatchResult {
50645064 if (!shouldAttemptFixes ())
50655065 return getTypeMatchFailure (locator);
50665066
50675067 recordAnyTypeVarAsPotentialHole (paramType);
50685068
5069- auto *loc = getConstraintLocator (locator);
5070- auto *fix = RemoveProjectedValueArgument::create (*this , wrapperType, param, loc);
50715069 if (recordFix (fix))
50725070 return getTypeMatchFailure (locator);
50735071
50745072 return getTypeMatchSuccess ();
5073+ };
5074+
5075+ // Incorrect use of projected value argument
5076+ if (argLabel.hasDollarPrefix () &&
5077+ (!param || !param->hasExternalPropertyWrapper ())) {
5078+ auto *loc = getConstraintLocator (locator);
5079+ auto *fix =
5080+ RemoveProjectedValueArgument::create (*this , wrapperType, param, loc);
5081+ return recordPropertyWrapperFix (fix);
5082+ }
5083+
5084+ // Missing wrapped value initializer
5085+ auto wrapperInfo = param->getAttachedPropertyWrapperTypeInfo (0 );
5086+ if (!argLabel.hasDollarPrefix () && !wrapperInfo.wrappedValueInit &&
5087+ param->hasExternalPropertyWrapper ()) {
5088+ auto *loc = getConstraintLocator (locator);
5089+ auto *fix = UsePropertyWrapper::create (
5090+ *this , param, /* usingProjection=*/ true , paramType, wrapperType, loc);
5091+ return recordPropertyWrapperFix (fix);
50755092 }
50765093
50775094 if (argLabel.hasDollarPrefix ()) {
0 commit comments