@@ -7646,6 +7646,22 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
76467646 }
76477647 }
76487648
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+
76497665 if (kind >= ConstraintKind::Conversion) {
76507666 // An lvalue of type T1 can be converted to a value of type T2 so long as
76517667 // 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,
77777793 }
77787794
77797795 // Special implicit nominal conversions.
7780- if (!type1->is<LValueType>() && kind >= ConstraintKind::Subtype ) {
7796+ if (!type1->is<LValueType>()) {
77817797 // Array -> Array.
77827798 if (desugar1->isArray() && desugar2->isArray()) {
77837799 conversionsOrFixes.push_back(ConversionRestrictionKind::ArrayUpcast);
@@ -7793,11 +7809,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
77937809 }
77947810 }
77957811
7796- if (kind == ConstraintKind::BindToPointerType) {
7797- if (desugar2->isEqual(getASTContext().TheEmptyTupleType))
7798- return getTypeMatchSuccess();
7799- }
7800-
78017812 if (kind >= ConstraintKind::Conversion) {
78027813 // It is never legal to form an autoclosure that results in these
78037814 // implicit conversions to pointer types.
@@ -8054,17 +8065,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
80548065 }
80558066 }
80568067
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-
80688068 // Matching types where one side is a pack expansion and the other is not
80698069 // means a pack expansion was used where it isn't supported.
80708070 if (type1->is<PackExpansionType>() != type2->is<PackExpansionType>()) {
0 commit comments