@@ -7646,6 +7646,22 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
7646
7646
}
7647
7647
}
7648
7648
7649
+ if (kind == ConstraintKind::BindToPointerType) {
7650
+ if (desugar2->isEqual(getASTContext().TheEmptyTupleType))
7651
+ return getTypeMatchSuccess();
7652
+ }
7653
+
7654
+ if (kind == ConstraintKind::BindParam) {
7655
+ if (auto *iot = dyn_cast<InOutType>(desugar1)) {
7656
+ if (auto *lvt = dyn_cast<LValueType>(desugar2)) {
7657
+ return matchTypes(iot->getObjectType(), lvt->getObjectType(),
7658
+ ConstraintKind::Bind, subflags,
7659
+ locator.withPathElement(
7660
+ ConstraintLocator::LValueConversion));
7661
+ }
7662
+ }
7663
+ }
7664
+
7649
7665
if (kind >= ConstraintKind::Conversion) {
7650
7666
// An lvalue of type T1 can be converted to a value of type T2 so long as
7651
7667
// T1 is convertible to T2 (by loading the value). Note that we cannot get
@@ -7777,7 +7793,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
7777
7793
}
7778
7794
7779
7795
// Special implicit nominal conversions.
7780
- if (!type1->is<LValueType>() && kind >= ConstraintKind::Subtype ) {
7796
+ if (!type1->is<LValueType>()) {
7781
7797
// Array -> Array.
7782
7798
if (desugar1->isArray() && desugar2->isArray()) {
7783
7799
conversionsOrFixes.push_back(ConversionRestrictionKind::ArrayUpcast);
@@ -7793,11 +7809,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
7793
7809
}
7794
7810
}
7795
7811
7796
- if (kind == ConstraintKind::BindToPointerType) {
7797
- if (desugar2->isEqual(getASTContext().TheEmptyTupleType))
7798
- return getTypeMatchSuccess();
7799
- }
7800
-
7801
7812
if (kind >= ConstraintKind::Conversion) {
7802
7813
// It is never legal to form an autoclosure that results in these
7803
7814
// implicit conversions to pointer types.
@@ -8054,17 +8065,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
8054
8065
}
8055
8066
}
8056
8067
8057
- if (kind == ConstraintKind::BindParam) {
8058
- if (auto *iot = dyn_cast<InOutType>(desugar1)) {
8059
- if (auto *lvt = dyn_cast<LValueType>(desugar2)) {
8060
- return matchTypes(iot->getObjectType(), lvt->getObjectType(),
8061
- ConstraintKind::Bind, subflags,
8062
- locator.withPathElement(
8063
- ConstraintLocator::LValueConversion));
8064
- }
8065
- }
8066
- }
8067
-
8068
8068
// Matching types where one side is a pack expansion and the other is not
8069
8069
// means a pack expansion was used where it isn't supported.
8070
8070
if (type1->is<PackExpansionType>() != type2->is<PackExpansionType>()) {
0 commit comments