Skip to content

Commit 28343c9

Browse files
committed
Sema: Remove ConversionRestrictionKind::LValueToRValue
1 parent dab4616 commit 28343c9

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

lib/Sema/CSApply.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6369,7 +6369,6 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
63696369
switch (knownRestriction->second) {
63706370

63716371
case ConversionRestrictionKind::TupleToTuple:
6372-
case ConversionRestrictionKind::LValueToRValue:
63736372
// Restrictions that don't need to be recorded.
63746373
// Should match recordRestriction() in CSSimplify
63756374
break;

lib/Sema/CSSimplify.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,16 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
20082008
}
20092009
}
20102010

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+
20112021
if (kind >= ConstraintKind::Subtype) {
20122022
// Subclass-to-superclass conversion.
20132023
if (type1->mayHaveSuperclass() &&
@@ -2165,13 +2175,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
21652175
}
21662176

21672177
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-
21752178
// It is never legal to form an autoclosure that results in these
21762179
// implicit conversions to pointer types.
21772180
bool isAutoClosureArgument = false;
@@ -4952,10 +4955,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
49524955
addContextualScore();
49534956
return matchSuperclassTypes(type1, type2, subflags, locator);
49544957

4955-
case ConversionRestrictionKind::LValueToRValue:
4956-
return matchTypes(type1->getRValueType(), type2,
4957-
matchKind, subflags, locator);
4958-
49594958
// for $< in { <, <c, <oc }:
49604959
// T $< U, U : P_i ===> T $< protocol<P_i...>
49614960
case ConversionRestrictionKind::Existential:
@@ -5275,7 +5274,6 @@ ConstraintSystem::simplifyRestrictedConstraintImpl(
52755274
static bool recordRestriction(ConversionRestrictionKind restriction) {
52765275
switch(restriction) {
52775276
case ConversionRestrictionKind::TupleToTuple:
5278-
case ConversionRestrictionKind::LValueToRValue:
52795277
return false;
52805278
default:
52815279
return true;

lib/Sema/Constraint.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,6 @@ StringRef swift::constraints::getName(ConversionRestrictionKind kind) {
434434
return "[deep equality]";
435435
case ConversionRestrictionKind::Superclass:
436436
return "[superclass]";
437-
case ConversionRestrictionKind::LValueToRValue:
438-
return "[lvalue-to-rvalue]";
439437
case ConversionRestrictionKind::Existential:
440438
return "[existential]";
441439
case ConversionRestrictionKind::MetatypeToExistentialMetatype:

lib/Sema/Constraint.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ enum class ConversionRestrictionKind {
194194
StringToPointer,
195195
/// Pointer-to-pointer conversion.
196196
PointerToPointer,
197-
/// Lvalue-to-rvalue conversion.
198-
LValueToRValue,
199197
/// Value to existential value conversion, or existential erasure.
200198
Existential,
201199
/// Metatype to existential metatype conversion.

0 commit comments

Comments
 (0)