Skip to content

Commit 5e4afc2

Browse files
committed
Sema: Remove some dead code from matchTypes()
1 parent fd2dd9f commit 5e4afc2

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2513,9 +2513,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
25132513
auto opaque1 = cast<OpaqueTypeArchetypeType>(desugar1);
25142514
auto opaque2 = cast<OpaqueTypeArchetypeType>(desugar2);
25152515

2516-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
2517-
if (!type1->is<LValueType>()
2518-
&& opaque1->getDecl() == opaque2->getDecl()) {
2516+
if (opaque1->getDecl() == opaque2->getDecl()) {
25192517
conversionsOrFixes.push_back(ConversionRestrictionKind::DeepEquality);
25202518
}
25212519
break;
@@ -2529,15 +2527,13 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
25292527
auto rootOpaque1 = dyn_cast<OpaqueTypeArchetypeType>(nested1->getRoot());
25302528
auto rootOpaque2 = dyn_cast<OpaqueTypeArchetypeType>(nested2->getRoot());
25312529
if (rootOpaque1 && rootOpaque2) {
2532-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
25332530
auto interfaceTy1 = nested1->getInterfaceType()
25342531
->getCanonicalType(rootOpaque1->getGenericEnvironment()
25352532
->getGenericSignature());
25362533
auto interfaceTy2 = nested2->getInterfaceType()
25372534
->getCanonicalType(rootOpaque2->getGenericEnvironment()
25382535
->getGenericSignature());
2539-
if (!type1->is<LValueType>()
2540-
&& interfaceTy1 == interfaceTy2
2536+
if (interfaceTy1 == interfaceTy2
25412537
&& rootOpaque1->getDecl() == rootOpaque2->getDecl()) {
25422538
conversionsOrFixes.push_back(ConversionRestrictionKind::DeepEquality);
25432539
break;
@@ -2556,7 +2552,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
25562552
// T1 is convertible to T2 (by loading the value). Note that we cannot get
25572553
// a value of inout type as an lvalue though.
25582554
if (type1->is<LValueType>() && !type2->is<InOutType>()) {
2559-
return matchTypes(type1->getRValueType(), type2,
2555+
return matchTypes(type1->getWithoutSpecifierType(), type2,
25602556
kind, subflags, locator);
25612557
}
25622558
}
@@ -2613,7 +2609,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
26132609
// We can remove this special case when we implement operator hiding.
26142610
if (!type1->is<LValueType>() &&
26152611
kind != ConstraintKind::OperatorArgumentConversion) {
2616-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
26172612
conversionsOrFixes.push_back(
26182613
ConversionRestrictionKind::HashableToAnyHashable);
26192614
}
@@ -2676,16 +2671,13 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
26762671
if (!type1->is<LValueType>() && kind >= ConstraintKind::Subtype) {
26772672
// Array -> Array.
26782673
if (isArrayType(desugar1) && isArrayType(desugar2)) {
2679-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
26802674
conversionsOrFixes.push_back(ConversionRestrictionKind::ArrayUpcast);
26812675
// Dictionary -> Dictionary.
26822676
} else if (isDictionaryType(desugar1) && isDictionaryType(desugar2)) {
2683-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
26842677
conversionsOrFixes.push_back(
26852678
ConversionRestrictionKind::DictionaryUpcast);
26862679
// Set -> Set.
26872680
} else if (isSetType(desugar1) && isSetType(desugar2)) {
2688-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
26892681
conversionsOrFixes.push_back(
26902682
ConversionRestrictionKind::SetUpcast);
26912683
}

0 commit comments

Comments
 (0)