Skip to content

Commit 4dfbd8f

Browse files
committed
Sema: Remove some unreachable LValueType checks
1 parent 1026968 commit 4dfbd8f

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,11 +1894,8 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
18941894
case TypeKind::Class: {
18951895
auto nominal1 = cast<NominalType>(desugar1);
18961896
auto nominal2 = cast<NominalType>(desugar2);
1897-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
1898-
if (!type1->is<LValueType>() &&
1899-
nominal1->getDecl() == nominal2->getDecl()) {
1897+
if (nominal1->getDecl() == nominal2->getDecl())
19001898
conversionsOrFixes.push_back(ConversionRestrictionKind::DeepEquality);
1901-
}
19021899

19031900
// Check for CF <-> ObjectiveC bridging.
19041901
if (isa<ClassType>(desugar1) &&
@@ -1907,19 +1904,15 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
19071904
auto class2 = cast<ClassDecl>(nominal2->getDecl());
19081905

19091906
// CF -> Objective-C via toll-free bridging.
1910-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
1911-
if (!type1->is<LValueType>() &&
1912-
class1->getForeignClassKind() == ClassDecl::ForeignKind::CFType &&
1907+
if (class1->getForeignClassKind() == ClassDecl::ForeignKind::CFType &&
19131908
class2->getForeignClassKind() != ClassDecl::ForeignKind::CFType &&
19141909
class1->getAttrs().hasAttribute<ObjCBridgedAttr>()) {
19151910
conversionsOrFixes.push_back(
19161911
ConversionRestrictionKind::CFTollFreeBridgeToObjC);
19171912
}
19181913

19191914
// Objective-C -> CF via toll-free bridging.
1920-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
1921-
if (!type1->is<LValueType>() &&
1922-
class2->getForeignClassKind() == ClassDecl::ForeignKind::CFType &&
1915+
if (class2->getForeignClassKind() == ClassDecl::ForeignKind::CFType &&
19231916
class1->getForeignClassKind() != ClassDecl::ForeignKind::CFType &&
19241917
class2->getAttrs().hasAttribute<ObjCBridgedAttr>()) {
19251918
conversionsOrFixes.push_back(
@@ -2004,10 +1997,8 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
20041997
auto bound1 = cast<BoundGenericType>(desugar1);
20051998
auto bound2 = cast<BoundGenericType>(desugar2);
20061999

2007-
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");
2008-
if (!type1->is<LValueType>() && bound1->getDecl() == bound2->getDecl()) {
2000+
if (bound1->getDecl() == bound2->getDecl())
20092001
conversionsOrFixes.push_back(ConversionRestrictionKind::DeepEquality);
2010-
}
20112002
break;
20122003
}
20132004
}
@@ -2427,7 +2418,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
24272418
ForceDowncast::create(*this, type2, getConstraintLocator(locator)));
24282419
}
24292420

2430-
if (type2->getRValueType()->is<InOutType>()) {
2421+
if (type2->is<InOutType>()) {
24312422
if (type1->is<LValueType>()) {
24322423
// If we're converting an lvalue to an inout type, add the missing '&'.
24332424
conversionsOrFixes.push_back(

0 commit comments

Comments
 (0)