Skip to content

Commit 5d1a1ff

Browse files
committed
[Typechecker] Use an equal constraint between a property wrapper's value type and the pattern init
1 parent 5c01a11 commit 5d1a1ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,7 +2633,7 @@ bool TypeChecker::typeCheckBinding(Pattern *&pattern, Expr *&initializer,
26332633
emptyLocator);
26342634
return propertyType;
26352635
}
2636-
2636+
26372637
// Otherwise, compute the wrapped value type directly.
26382638
return computeWrappedValueType(wrappedVar, initType);
26392639
}
@@ -2654,10 +2654,10 @@ bool TypeChecker::typeCheckBinding(Pattern *&pattern, Expr *&initializer,
26542654
// is the initialization of the property wrapper instance.
26552655
initType = cs.getType(expr);
26562656

2657-
// Add a conversion constraint between the pattern type and the
2657+
// Add an equal constraint between the pattern type and the
26582658
// property wrapper's "value" type.
2659-
cs.addConstraint(ConstraintKind::Conversion, patternType,
2660-
getPatternInitType(&cs), Locator, /*isFavored*/true);
2659+
cs.addConstraint(ConstraintKind::Equal, patternType,
2660+
getPatternInitType(&cs), Locator, /*isFavored*/ true);
26612661
} else {
26622662
// The initializer type is the type of the pattern.
26632663
initType = patternType;

0 commit comments

Comments
 (0)