@@ -503,8 +503,7 @@ namespace {
503
503
// / \brief Coerce an expression of implicitly unwrapped optional type to its
504
504
// / underlying value type, in the correct way for an implicit
505
505
// / look-through.
506
- Expr *coerceImplicitlyUnwrappedOptionalToValue (Expr *expr, Type objTy,
507
- ConstraintLocatorBuilder locator);
506
+ Expr *coerceImplicitlyUnwrappedOptionalToValue (Expr *expr, Type objTy);
508
507
509
508
// / \brief Build a collection upcast expression.
510
509
// /
@@ -893,7 +892,7 @@ namespace {
893
892
// through ImplicitlyUnwrappedOptional<T>.
894
893
if (!Implicit) {
895
894
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)) {
896
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy, locator );
895
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
897
896
baseTy = objTy;
898
897
}
899
898
}
@@ -1410,7 +1409,7 @@ namespace {
1410
1409
if (auto pathTy = cs.lookThroughImplicitlyUnwrappedOptionalType (keyPathExprTy)) {
1411
1410
keyPathExprTy = pathTy;
1412
1411
indexKP = coerceImplicitlyUnwrappedOptionalToValue (
1413
- indexKP, keyPathExprTy, locator );
1412
+ indexKP, keyPathExprTy);
1414
1413
}
1415
1414
1416
1415
Type valueTy;
@@ -1495,7 +1494,7 @@ namespace {
1495
1494
1496
1495
// Handle accesses that implicitly look through ImplicitlyUnwrappedOptional<T>.
1497
1496
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)) {
1498
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy, locator );
1497
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
1499
1498
baseTy = cs.getType (base);
1500
1499
}
1501
1500
@@ -2654,8 +2653,7 @@ namespace {
2654
2653
// Look through an implicitly unwrapped optional.
2655
2654
auto baseTy = cs.getType (base);
2656
2655
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)){
2657
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy,
2658
- cs.getConstraintLocator (base));
2656
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
2659
2657
baseTy = objTy;
2660
2658
}
2661
2659
@@ -2703,8 +2701,7 @@ namespace {
2703
2701
case OverloadChoiceKind::TupleIndex: {
2704
2702
auto baseTy = cs.getType (base)->getRValueType ();
2705
2703
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)){
2706
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy,
2707
- cs.getConstraintLocator (base));
2704
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
2708
2705
}
2709
2706
2710
2707
Type toType = simplifyType (cs.getType (expr));
@@ -2960,8 +2957,7 @@ namespace {
2960
2957
auto base = expr->getBase ();
2961
2958
auto baseTy = cs.getType (base)->getRValueType ();
2962
2959
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)) {
2963
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy,
2964
- cs.getConstraintLocator (base));
2960
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
2965
2961
expr->setBase (base);
2966
2962
}
2967
2963
@@ -5191,7 +5187,7 @@ Expr *ExprRewriter::coerceExistential(Expr *expr, Type toType,
5191
5187
// FIXME: Hack. We shouldn't try to coerce existential when there is no
5192
5188
// existential upcast to perform.
5193
5189
if (ty->isEqual (toType)) {
5194
- return coerceImplicitlyUnwrappedOptionalToValue (expr, ty, locator );
5190
+ return coerceImplicitlyUnwrappedOptionalToValue (expr, ty);
5195
5191
}
5196
5192
}
5197
5193
@@ -5337,8 +5333,7 @@ Expr *ExprRewriter::coerceOptionalToOptional(Expr *expr, Type toType,
5337
5333
return expr;
5338
5334
}
5339
5335
5340
- Expr *ExprRewriter::coerceImplicitlyUnwrappedOptionalToValue (Expr *expr, Type objTy,
5341
- ConstraintLocatorBuilder locator) {
5336
+ Expr *ExprRewriter::coerceImplicitlyUnwrappedOptionalToValue (Expr *expr, Type objTy) {
5342
5337
auto optTy = cs.getType (expr);
5343
5338
// Coerce to an r-value.
5344
5339
if (optTy->is <LValueType>())
@@ -6172,14 +6167,14 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6172
6167
case ConversionRestrictionKind::ForceUnchecked: {
6173
6168
auto valueTy = fromType->getImplicitlyUnwrappedOptionalObjectType ();
6174
6169
assert (valueTy);
6175
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, valueTy, locator );
6170
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, valueTy);
6176
6171
return coerceToType (expr, toType, locator);
6177
6172
}
6178
6173
6179
6174
case ConversionRestrictionKind::ArrayUpcast: {
6180
6175
// Look through implicitly unwrapped optionals.
6181
6176
if (auto objTy= cs.lookThroughImplicitlyUnwrappedOptionalType (fromType)) {
6182
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy, locator );
6177
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy);
6183
6178
}
6184
6179
6185
6180
// Build the value conversion.
@@ -6191,7 +6186,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6191
6186
// Look through implicitly unwrapped optionals.
6192
6187
if (auto objTy
6193
6188
= cs.lookThroughImplicitlyUnwrappedOptionalType (cs.getType (expr))) {
6194
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy, locator );
6189
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy);
6195
6190
}
6196
6191
6197
6192
// We want to check conformance on the rvalue, as that's what has
@@ -6215,7 +6210,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6215
6210
// Look through implicitly unwrapped optionals.
6216
6211
if (auto objTy
6217
6212
= cs.lookThroughImplicitlyUnwrappedOptionalType (cs.getType (expr))) {
6218
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy, locator );
6213
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy);
6219
6214
}
6220
6215
6221
6216
// Build the value conversion.
@@ -6227,7 +6222,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6227
6222
// Look through implicitly unwrapped optionals.
6228
6223
if (auto objTy
6229
6224
= cs.lookThroughImplicitlyUnwrappedOptionalType (cs.getType (expr))) {
6230
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy, locator );
6225
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy);
6231
6226
}
6232
6227
6233
6228
// Build the value conversion.
@@ -6496,7 +6491,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6496
6491
6497
6492
// Look through ImplicitlyUnwrappedOptional<T> before coercing expression.
6498
6493
if (auto ty = cs.lookThroughImplicitlyUnwrappedOptionalType (fromType)) {
6499
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, ty, locator );
6494
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, ty);
6500
6495
return coerceToType (expr, toType, locator);
6501
6496
}
6502
6497
@@ -7053,7 +7048,7 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
7053
7048
7054
7049
// Handle applications that look through ImplicitlyUnwrappedOptional<T>.
7055
7050
if (auto fnTy = cs.lookThroughImplicitlyUnwrappedOptionalType (cs.getType (fn)))
7056
- fn = coerceImplicitlyUnwrappedOptionalToValue (fn, fnTy, locator );
7051
+ fn = coerceImplicitlyUnwrappedOptionalToValue (fn, fnTy);
7057
7052
7058
7053
// If we're applying a function that resulted from a covariant
7059
7054
// function conversion, strip off that conversion.
0 commit comments