@@ -2008,6 +2008,16 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
2008
2008
}
2009
2009
}
2010
2010
2011
+ if (kind >= ConstraintKind::Conversion) {
2012
+ // An lvalue of type T1 can be converted to a value of type T2 so long as
2013
+ // T1 is convertible to T2 (by loading the value). Note that we cannot get
2014
+ // a value of inout type as an lvalue though.
2015
+ if (type1->is <LValueType>() && !type2->is <InOutType>()) {
2016
+ return matchTypes (type1->getRValueType (), type2,
2017
+ kind, subflags, locator);
2018
+ }
2019
+ }
2020
+
2011
2021
if (kind >= ConstraintKind::Subtype) {
2012
2022
// Subclass-to-superclass conversion.
2013
2023
if (type1->mayHaveSuperclass () &&
@@ -2165,13 +2175,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
2165
2175
}
2166
2176
2167
2177
if (kind >= ConstraintKind::Conversion) {
2168
- // An lvalue of type T1 can be converted to a value of type T2 so long as
2169
- // T1 is convertible to T2 (by loading the value). Note that we cannot get
2170
- // a value of inout type as an lvalue though.
2171
- if (type1->is <LValueType>() && !type2->is <InOutType>())
2172
- conversionsOrFixes.push_back (
2173
- ConversionRestrictionKind::LValueToRValue);
2174
-
2175
2178
// It is never legal to form an autoclosure that results in these
2176
2179
// implicit conversions to pointer types.
2177
2180
bool isAutoClosureArgument = false ;
@@ -4952,10 +4955,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
4952
4955
addContextualScore ();
4953
4956
return matchSuperclassTypes (type1, type2, subflags, locator);
4954
4957
4955
- case ConversionRestrictionKind::LValueToRValue:
4956
- return matchTypes (type1->getRValueType (), type2,
4957
- matchKind, subflags, locator);
4958
-
4959
4958
// for $< in { <, <c, <oc }:
4960
4959
// T $< U, U : P_i ===> T $< protocol<P_i...>
4961
4960
case ConversionRestrictionKind::Existential:
@@ -5275,7 +5274,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
5275
5274
static bool recordRestriction (ConversionRestrictionKind restriction) {
5276
5275
switch (restriction) {
5277
5276
case ConversionRestrictionKind::TupleToTuple:
5278
- case ConversionRestrictionKind::LValueToRValue:
5279
5277
return false ;
5280
5278
default :
5281
5279
return true ;
0 commit comments