@@ -424,8 +424,7 @@ namespace {
424
424
// / \brief Coerce an expression of implicitly unwrapped optional type to its
425
425
// / underlying value type, in the correct way for an implicit
426
426
// / look-through.
427
- Expr *coerceImplicitlyUnwrappedOptionalToValue (Expr *expr, Type objTy,
428
- ConstraintLocatorBuilder locator);
427
+ Expr *coerceImplicitlyUnwrappedOptionalToValue (Expr *expr, Type objTy);
429
428
430
429
// / \brief Build a collection upcast expression.
431
430
// /
@@ -814,7 +813,7 @@ namespace {
814
813
// through ImplicitlyUnwrappedOptional<T>.
815
814
if (!Implicit) {
816
815
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)) {
817
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy, locator );
816
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
818
817
baseTy = objTy;
819
818
}
820
819
}
@@ -1331,7 +1330,7 @@ namespace {
1331
1330
if (auto pathTy = cs.lookThroughImplicitlyUnwrappedOptionalType (keyPathExprTy)) {
1332
1331
keyPathExprTy = pathTy;
1333
1332
indexKP = coerceImplicitlyUnwrappedOptionalToValue (
1334
- indexKP, keyPathExprTy, locator );
1333
+ indexKP, keyPathExprTy);
1335
1334
}
1336
1335
1337
1336
Type valueTy;
@@ -1416,7 +1415,7 @@ namespace {
1416
1415
1417
1416
// Handle accesses that implicitly look through ImplicitlyUnwrappedOptional<T>.
1418
1417
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)) {
1419
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy, locator );
1418
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
1420
1419
baseTy = cs.getType (base);
1421
1420
}
1422
1421
@@ -2568,8 +2567,7 @@ namespace {
2568
2567
// Look through an implicitly unwrapped optional.
2569
2568
auto baseTy = cs.getType (base);
2570
2569
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)){
2571
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy,
2572
- cs.getConstraintLocator (base));
2570
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
2573
2571
baseTy = objTy;
2574
2572
}
2575
2573
@@ -2617,8 +2615,7 @@ namespace {
2617
2615
case OverloadChoiceKind::TupleIndex: {
2618
2616
auto baseTy = cs.getType (base)->getRValueType ();
2619
2617
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)){
2620
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy,
2621
- cs.getConstraintLocator (base));
2618
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
2622
2619
}
2623
2620
2624
2621
Type toType = simplifyType (cs.getType (expr));
@@ -2874,8 +2871,7 @@ namespace {
2874
2871
auto base = expr->getBase ();
2875
2872
auto baseTy = cs.getType (base)->getRValueType ();
2876
2873
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType (baseTy)) {
2877
- base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy,
2878
- cs.getConstraintLocator (base));
2874
+ base = coerceImplicitlyUnwrappedOptionalToValue (base, objTy);
2879
2875
expr->setBase (base);
2880
2876
}
2881
2877
@@ -5105,7 +5101,7 @@ Expr *ExprRewriter::coerceExistential(Expr *expr, Type toType,
5105
5101
// FIXME: Hack. We shouldn't try to coerce existential when there is no
5106
5102
// existential upcast to perform.
5107
5103
if (ty->isEqual (toType)) {
5108
- return coerceImplicitlyUnwrappedOptionalToValue (expr, ty, locator );
5104
+ return coerceImplicitlyUnwrappedOptionalToValue (expr, ty);
5109
5105
}
5110
5106
}
5111
5107
@@ -5251,8 +5247,7 @@ Expr *ExprRewriter::coerceOptionalToOptional(Expr *expr, Type toType,
5251
5247
return expr;
5252
5248
}
5253
5249
5254
- Expr *ExprRewriter::coerceImplicitlyUnwrappedOptionalToValue (Expr *expr, Type objTy,
5255
- ConstraintLocatorBuilder locator) {
5250
+ Expr *ExprRewriter::coerceImplicitlyUnwrappedOptionalToValue (Expr *expr, Type objTy) {
5256
5251
auto optTy = cs.getType (expr);
5257
5252
// Coerce to an r-value.
5258
5253
if (optTy->is <LValueType>())
@@ -6086,14 +6081,14 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6086
6081
case ConversionRestrictionKind::ForceUnchecked: {
6087
6082
auto valueTy = fromType->getImplicitlyUnwrappedOptionalObjectType ();
6088
6083
assert (valueTy);
6089
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, valueTy, locator );
6084
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, valueTy);
6090
6085
return coerceToType (expr, toType, locator);
6091
6086
}
6092
6087
6093
6088
case ConversionRestrictionKind::ArrayUpcast: {
6094
6089
// Look through implicitly unwrapped optionals.
6095
6090
if (auto objTy= cs.lookThroughImplicitlyUnwrappedOptionalType (fromType)) {
6096
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy, locator );
6091
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy);
6097
6092
}
6098
6093
6099
6094
// Build the value conversion.
@@ -6105,7 +6100,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6105
6100
// Look through implicitly unwrapped optionals.
6106
6101
if (auto objTy
6107
6102
= cs.lookThroughImplicitlyUnwrappedOptionalType (cs.getType (expr))) {
6108
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy, locator );
6103
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy);
6109
6104
}
6110
6105
6111
6106
// We want to check conformance on the rvalue, as that's what has
@@ -6129,7 +6124,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6129
6124
// Look through implicitly unwrapped optionals.
6130
6125
if (auto objTy
6131
6126
= cs.lookThroughImplicitlyUnwrappedOptionalType (cs.getType (expr))) {
6132
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy, locator );
6127
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy);
6133
6128
}
6134
6129
6135
6130
// Build the value conversion.
@@ -6141,7 +6136,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6141
6136
// Look through implicitly unwrapped optionals.
6142
6137
if (auto objTy
6143
6138
= cs.lookThroughImplicitlyUnwrappedOptionalType (cs.getType (expr))) {
6144
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy, locator );
6139
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, objTy);
6145
6140
}
6146
6141
6147
6142
// Build the value conversion.
@@ -6410,7 +6405,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6410
6405
6411
6406
// Look through ImplicitlyUnwrappedOptional<T> before coercing expression.
6412
6407
if (auto ty = cs.lookThroughImplicitlyUnwrappedOptionalType (fromType)) {
6413
- expr = coerceImplicitlyUnwrappedOptionalToValue (expr, ty, locator );
6408
+ expr = coerceImplicitlyUnwrappedOptionalToValue (expr, ty);
6414
6409
return coerceToType (expr, toType, locator);
6415
6410
}
6416
6411
@@ -7028,7 +7023,7 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
7028
7023
7029
7024
// Handle applications that look through ImplicitlyUnwrappedOptional<T>.
7030
7025
if (auto fnTy = cs.lookThroughImplicitlyUnwrappedOptionalType (cs.getType (fn)))
7031
- fn = coerceImplicitlyUnwrappedOptionalToValue (fn, fnTy, locator );
7026
+ fn = coerceImplicitlyUnwrappedOptionalToValue (fn, fnTy);
7032
7027
7033
7028
// If we're applying a function that resulted from a covariant
7034
7029
// function conversion, strip off that conversion.
0 commit comments