Skip to content

Commit 99ccfb1

Browse files
authored
Merge pull request #15545 from davezarzycki/nfc_check_InOutExpr_not_InOutType
[Sema] NFC - Bypass more Pattern type variables
2 parents f031a76 + b97ec69 commit 99ccfb1

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/Sema/CSGen.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,12 +1991,9 @@ namespace {
19911991
// tuples, nested arrays, and dictionary literals.
19921992
//
19931993
// Otherwise, create a new type variable.
1994-
auto boundExpr = locator.trySimplifyToExpr();
1995-
1996-
if (boundExpr) {
1997-
auto boundExprTy = CS.getType(boundExpr);
1998-
if (!boundExprTy->is<InOutType>())
1999-
return boundExprTy->getRValueType();
1994+
if (auto boundExpr = locator.trySimplifyToExpr()) {
1995+
if (!boundExpr->isSemanticallyInOutExpr())
1996+
return CS.getType(boundExpr)->getRValueType();
20001997
}
20011998

20021999
return CS.createTypeVariable(CS.getConstraintLocator(locator),
@@ -2022,9 +2019,8 @@ namespace {
20222019
case ReferenceOwnership::Unmanaged:
20232020
if (!var->hasNonPatternBindingInit()) {
20242021
if (auto boundExpr = locator.trySimplifyToExpr()) {
2025-
auto boundExprTy = CS.getType(boundExpr);
2026-
if (!boundExprTy->is<InOutType>())
2027-
return boundExprTy->getRValueType();
2022+
if (!boundExpr->isSemanticallyInOutExpr())
2023+
return CS.getType(boundExpr)->getRValueType();
20282024
}
20292025
}
20302026
break;

0 commit comments

Comments
 (0)