Skip to content

Commit 12e7caf

Browse files
authored
Merge pull request #13357 from rudkx/remove-param-from-coerce-iuo-to-value
NFC: Remove unused locator param from coerceImpicitlyUnwrappedOptiona…
2 parents 7da8ce5 + 7eafe07 commit 12e7caf

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

lib/Sema/CSApply.cpp

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,7 @@ namespace {
503503
/// \brief Coerce an expression of implicitly unwrapped optional type to its
504504
/// underlying value type, in the correct way for an implicit
505505
/// look-through.
506-
Expr *coerceImplicitlyUnwrappedOptionalToValue(Expr *expr, Type objTy,
507-
ConstraintLocatorBuilder locator);
506+
Expr *coerceImplicitlyUnwrappedOptionalToValue(Expr *expr, Type objTy);
508507

509508
/// \brief Build a collection upcast expression.
510509
///
@@ -893,7 +892,7 @@ namespace {
893892
// through ImplicitlyUnwrappedOptional<T>.
894893
if (!Implicit) {
895894
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)) {
896-
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy, locator);
895+
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
897896
baseTy = objTy;
898897
}
899898
}
@@ -1410,7 +1409,7 @@ namespace {
14101409
if (auto pathTy = cs.lookThroughImplicitlyUnwrappedOptionalType(keyPathExprTy)) {
14111410
keyPathExprTy = pathTy;
14121411
indexKP = coerceImplicitlyUnwrappedOptionalToValue(
1413-
indexKP, keyPathExprTy, locator);
1412+
indexKP, keyPathExprTy);
14141413
}
14151414

14161415
Type valueTy;
@@ -1495,7 +1494,7 @@ namespace {
14951494

14961495
// Handle accesses that implicitly look through ImplicitlyUnwrappedOptional<T>.
14971496
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)) {
1498-
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy, locator);
1497+
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
14991498
baseTy = cs.getType(base);
15001499
}
15011500

@@ -2654,8 +2653,7 @@ namespace {
26542653
// Look through an implicitly unwrapped optional.
26552654
auto baseTy = cs.getType(base);
26562655
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)){
2657-
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy,
2658-
cs.getConstraintLocator(base));
2656+
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
26592657
baseTy = objTy;
26602658
}
26612659

@@ -2703,8 +2701,7 @@ namespace {
27032701
case OverloadChoiceKind::TupleIndex: {
27042702
auto baseTy = cs.getType(base)->getRValueType();
27052703
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)){
2706-
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy,
2707-
cs.getConstraintLocator(base));
2704+
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
27082705
}
27092706

27102707
Type toType = simplifyType(cs.getType(expr));
@@ -2960,8 +2957,7 @@ namespace {
29602957
auto base = expr->getBase();
29612958
auto baseTy = cs.getType(base)->getRValueType();
29622959
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)) {
2963-
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy,
2964-
cs.getConstraintLocator(base));
2960+
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
29652961
expr->setBase(base);
29662962
}
29672963

@@ -5191,7 +5187,7 @@ Expr *ExprRewriter::coerceExistential(Expr *expr, Type toType,
51915187
// FIXME: Hack. We shouldn't try to coerce existential when there is no
51925188
// existential upcast to perform.
51935189
if (ty->isEqual(toType)) {
5194-
return coerceImplicitlyUnwrappedOptionalToValue(expr, ty, locator);
5190+
return coerceImplicitlyUnwrappedOptionalToValue(expr, ty);
51955191
}
51965192
}
51975193

@@ -5337,8 +5333,7 @@ Expr *ExprRewriter::coerceOptionalToOptional(Expr *expr, Type toType,
53375333
return expr;
53385334
}
53395335

5340-
Expr *ExprRewriter::coerceImplicitlyUnwrappedOptionalToValue(Expr *expr, Type objTy,
5341-
ConstraintLocatorBuilder locator) {
5336+
Expr *ExprRewriter::coerceImplicitlyUnwrappedOptionalToValue(Expr *expr, Type objTy) {
53425337
auto optTy = cs.getType(expr);
53435338
// Coerce to an r-value.
53445339
if (optTy->is<LValueType>())
@@ -6172,14 +6167,14 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
61726167
case ConversionRestrictionKind::ForceUnchecked: {
61736168
auto valueTy = fromType->getImplicitlyUnwrappedOptionalObjectType();
61746169
assert(valueTy);
6175-
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, valueTy, locator);
6170+
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, valueTy);
61766171
return coerceToType(expr, toType, locator);
61776172
}
61786173

61796174
case ConversionRestrictionKind::ArrayUpcast: {
61806175
// Look through implicitly unwrapped optionals.
61816176
if (auto objTy= cs.lookThroughImplicitlyUnwrappedOptionalType(fromType)) {
6182-
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
6177+
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy);
61836178
}
61846179

61856180
// Build the value conversion.
@@ -6191,7 +6186,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
61916186
// Look through implicitly unwrapped optionals.
61926187
if (auto objTy
61936188
= cs.lookThroughImplicitlyUnwrappedOptionalType(cs.getType(expr))) {
6194-
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
6189+
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy);
61956190
}
61966191

61976192
// We want to check conformance on the rvalue, as that's what has
@@ -6215,7 +6210,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
62156210
// Look through implicitly unwrapped optionals.
62166211
if (auto objTy
62176212
= cs.lookThroughImplicitlyUnwrappedOptionalType(cs.getType(expr))) {
6218-
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
6213+
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy);
62196214
}
62206215

62216216
// Build the value conversion.
@@ -6227,7 +6222,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
62276222
// Look through implicitly unwrapped optionals.
62286223
if (auto objTy
62296224
= cs.lookThroughImplicitlyUnwrappedOptionalType(cs.getType(expr))) {
6230-
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
6225+
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy);
62316226
}
62326227

62336228
// Build the value conversion.
@@ -6496,7 +6491,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
64966491

64976492
// Look through ImplicitlyUnwrappedOptional<T> before coercing expression.
64986493
if (auto ty = cs.lookThroughImplicitlyUnwrappedOptionalType(fromType)) {
6499-
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, ty, locator);
6494+
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, ty);
65006495
return coerceToType(expr, toType, locator);
65016496
}
65026497

@@ -7053,7 +7048,7 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
70537048

70547049
// Handle applications that look through ImplicitlyUnwrappedOptional<T>.
70557050
if (auto fnTy = cs.lookThroughImplicitlyUnwrappedOptionalType(cs.getType(fn)))
7056-
fn = coerceImplicitlyUnwrappedOptionalToValue(fn, fnTy, locator);
7051+
fn = coerceImplicitlyUnwrappedOptionalToValue(fn, fnTy);
70577052

70587053
// If we're applying a function that resulted from a covariant
70597054
// function conversion, strip off that conversion.

0 commit comments

Comments
 (0)