mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #37380 from hborla/property-wrapper-inference-crash
[ConstraintSystem] Fix a constraint system crash with property wrapper inference using the $ syntax.
This commit is contained in:
@@ -8682,8 +8682,18 @@ bool ConstraintSystem::resolveClosure(TypeVariableType *typeVar,
|
||||
Type wrappedValueType;
|
||||
|
||||
if (paramDecl->hasImplicitPropertyWrapper()) {
|
||||
backingType = getContextualParamAt(i)->getPlainType();
|
||||
wrappedValueType = createTypeVariable(getConstraintLocator(locator),
|
||||
if (auto contextualType = getContextualParamAt(i)) {
|
||||
backingType = contextualType->getPlainType();
|
||||
} else {
|
||||
// There may not be a contextual parameter type if the contextual
|
||||
// type is not a function type or if closure body declares too many
|
||||
// parameters.
|
||||
auto *paramLoc =
|
||||
getConstraintLocator(closure, LocatorPathElt::TupleElement(i));
|
||||
backingType = createTypeVariable(paramLoc, TVO_CanBindToHole);
|
||||
}
|
||||
|
||||
wrappedValueType = createTypeVariable(getConstraintLocator(paramDecl),
|
||||
TVO_CanBindToHole | TVO_CanBindToLValue);
|
||||
} else {
|
||||
auto *wrapperAttr = paramDecl->getAttachedPropertyWrappers().front();
|
||||
|
||||
Reference in New Issue
Block a user