diff --git a/lib/Sema/CSSyntacticElement.cpp b/lib/Sema/CSSyntacticElement.cpp index bc2b064ca07ee..e90859f7805ba 100644 --- a/lib/Sema/CSSyntacticElement.cpp +++ b/lib/Sema/CSSyntacticElement.cpp @@ -801,6 +801,11 @@ class SyntacticElementConstraintGenerator auto wrapperTy = cs.simplifyType(cs.getType(wrapperTypeExpr)); if (auto *projectedVal = wrappedVar->getPropertyWrapperProjectionVar()) { auto projectedTy = computeProjectedValueType(wrappedVar, wrapperTy); + // The projected type may have an error, make sure we turn it into a hole + // if necessary. + ASSERT(!projectedTy->hasUnboundGenericType() && + !projectedTy->hasPlaceholder()); + projectedTy = cs.replaceInferableTypesWithTypeVars(projectedTy, locator); cs.setType(projectedVal, projectedTy); } if (auto *backing = wrappedVar->getPropertyWrapperBackingProperty()) diff --git a/validation-test/IDE/crashers_fixed/ConstraintSystem-applySolution-bbfc02.swift b/validation-test/IDE/crashers_fixed/ConstraintSystem-applySolution-bbfc02.swift new file mode 100644 index 0000000000000..5bec87c9dee3c --- /dev/null +++ b/validation-test/IDE/crashers_fixed/ConstraintSystem-applySolution-bbfc02.swift @@ -0,0 +1,11 @@ +// {"kind":"complete","original":"3da7ab26","signature":"swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::constraints::SyntacticElementTarget)","signatureAssert":"Assertion failed: (isValidType(solution.simplifyType(type)) && \"node type has invalid type\"), function applySolution"} +// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +@propertyWrapper struct a { + init(wrappedValue: b) +projectedValue: + var wrappedValue: b +} +{ + @a var c = false +}