@@ -5060,18 +5060,35 @@ ConstraintSystem::applyPropertyWrapperToParameter(
5060
5060
anchor = apply->getFn ();
5061
5061
}
5062
5062
5063
- if (argLabel. hasDollarPrefix () && (!param || !param-> hasExternalPropertyWrapper ())) {
5063
+ auto recordPropertyWrapperFix = [&](ConstraintFix *fix) -> TypeMatchResult {
5064
5064
if (!shouldAttemptFixes ())
5065
5065
return getTypeMatchFailure (locator);
5066
5066
5067
5067
recordAnyTypeVarAsPotentialHole (paramType);
5068
5068
5069
- auto *loc = getConstraintLocator (locator);
5070
- auto *fix = RemoveProjectedValueArgument::create (*this , wrapperType, param, loc);
5071
5069
if (recordFix (fix))
5072
5070
return getTypeMatchFailure (locator);
5073
5071
5074
5072
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);
5075
5092
}
5076
5093
5077
5094
if (argLabel.hasDollarPrefix ()) {
0 commit comments