@@ -8369,32 +8369,41 @@ ConstraintSystem::simplifyPropertyWrapperConstraint(
8369
8369
return SolutionKind::Unsolved;
8370
8370
}
8371
8371
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
+
8373
8378
auto *wrappedVar = getAsDecl<VarDecl>(locator.getAnchor ());
8374
8379
assert (wrappedVar && wrappedVar->hasAttachedPropertyWrapper ());
8375
8380
8376
8381
// The wrapper type must be a property wrapper.
8377
8382
auto *nominal = wrapperType->getDesugaredType ()->getAnyNominal ();
8378
8383
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;
8381
8392
}
8382
8393
8383
8394
auto typeInfo = nominal->getPropertyWrapperTypeInfo ();
8384
8395
8385
8396
// 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;
8390
8404
}
8391
- }
8392
8405
8393
- if (fix) {
8394
- if (!shouldAttemptFixes () || recordFix (fix))
8395
- return SolutionKind::Error;
8396
-
8397
- return SolutionKind::Solved;
8406
+ return SolutionKind::Error;
8398
8407
}
8399
8408
8400
8409
auto resolvedType = wrapperType->getTypeOfMember (DC->getParentModule (), typeInfo.valueVar );
0 commit comments