@@ -8369,32 +8369,41 @@ ConstraintSystem::simplifyPropertyWrapperConstraint(
83698369 return SolutionKind::Unsolved;
83708370 }
83718371
8372- ConstraintFix *fix = nullptr ;
8372+ // If the wrapper type is a hole or a dependent member with no type variables,
8373+ // don't record a fix, because this indicates that there was an error
8374+ // elsewhere in the constraint system.
8375+ if (wrapperType->isPlaceholder () || wrapperType->is <DependentMemberType>())
8376+ return SolutionKind::Solved;
8377+
83738378 auto *wrappedVar = getAsDecl<VarDecl>(locator.getAnchor ());
83748379 assert (wrappedVar && wrappedVar->hasAttachedPropertyWrapper ());
83758380
83768381 // The wrapper type must be a property wrapper.
83778382 auto *nominal = wrapperType->getDesugaredType ()->getAnyNominal ();
83788383 if (!(nominal && nominal->getAttrs ().hasAttribute <PropertyWrapperAttr>())) {
8379- fix = AllowInvalidPropertyWrapperType::create (*this , wrapperType,
8380- getConstraintLocator (locator));
8384+ if (shouldAttemptFixes ()) {
8385+ auto *fix = AllowInvalidPropertyWrapperType::create (
8386+ *this , wrapperType, getConstraintLocator (locator));
8387+ if (!recordFix (fix))
8388+ return SolutionKind::Solved;
8389+ }
8390+
8391+ return SolutionKind::Error;
83818392 }
83828393
83838394 auto typeInfo = nominal->getPropertyWrapperTypeInfo ();
83848395
83858396 // Implicit property wrappers must support projected-value initialization.
8386- if (!fix && wrappedVar->hasImplicitPropertyWrapper ()) {
8387- if (!(typeInfo.projectedValueVar && typeInfo.hasProjectedValueInit )) {
8388- fix = RemoveProjectedValueArgument::create (*this , wrapperType, cast<ParamDecl>(wrappedVar),
8389- getConstraintLocator (locator));
8397+ if (wrappedVar->hasImplicitPropertyWrapper () &&
8398+ !(typeInfo.projectedValueVar && typeInfo.hasProjectedValueInit )) {
8399+ if (shouldAttemptFixes ()) {
8400+ auto *fix = RemoveProjectedValueArgument::create (
8401+ *this , wrapperType, cast<ParamDecl>(wrappedVar), getConstraintLocator (locator));
8402+ if (!recordFix (fix))
8403+ return SolutionKind::Solved;
83908404 }
8391- }
83928405
8393- if (fix) {
8394- if (!shouldAttemptFixes () || recordFix (fix))
8395- return SolutionKind::Error;
8396-
8397- return SolutionKind::Solved;
8406+ return SolutionKind::Error;
83988407 }
83998408
84008409 auto resolvedType = wrapperType->getTypeOfMember (DC->getParentModule (), typeInfo.valueVar );
0 commit comments