Skip to content

NFC: Remove unused locator param from coerceImpicitlyUnwrappedOptiona… #13357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions lib/Sema/CSApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ namespace {
/// \brief Coerce an expression of implicitly unwrapped optional type to its
/// underlying value type, in the correct way for an implicit
/// look-through.
Expr *coerceImplicitlyUnwrappedOptionalToValue(Expr *expr, Type objTy,
ConstraintLocatorBuilder locator);
Expr *coerceImplicitlyUnwrappedOptionalToValue(Expr *expr, Type objTy);

/// \brief Build a collection upcast expression.
///
Expand Down Expand Up @@ -814,7 +813,7 @@ namespace {
// through ImplicitlyUnwrappedOptional<T>.
if (!Implicit) {
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)) {
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy, locator);
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
baseTy = objTy;
}
}
Expand Down Expand Up @@ -1331,7 +1330,7 @@ namespace {
if (auto pathTy = cs.lookThroughImplicitlyUnwrappedOptionalType(keyPathExprTy)) {
keyPathExprTy = pathTy;
indexKP = coerceImplicitlyUnwrappedOptionalToValue(
indexKP, keyPathExprTy, locator);
indexKP, keyPathExprTy);
}

Type valueTy;
Expand Down Expand Up @@ -1416,7 +1415,7 @@ namespace {

// Handle accesses that implicitly look through ImplicitlyUnwrappedOptional<T>.
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)) {
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy, locator);
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
baseTy = cs.getType(base);
}

Expand Down Expand Up @@ -2568,8 +2567,7 @@ namespace {
// Look through an implicitly unwrapped optional.
auto baseTy = cs.getType(base);
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)){
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy,
cs.getConstraintLocator(base));
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
baseTy = objTy;
}

Expand Down Expand Up @@ -2617,8 +2615,7 @@ namespace {
case OverloadChoiceKind::TupleIndex: {
auto baseTy = cs.getType(base)->getRValueType();
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)){
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy,
cs.getConstraintLocator(base));
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
}

Type toType = simplifyType(cs.getType(expr));
Expand Down Expand Up @@ -2874,8 +2871,7 @@ namespace {
auto base = expr->getBase();
auto baseTy = cs.getType(base)->getRValueType();
if (auto objTy = cs.lookThroughImplicitlyUnwrappedOptionalType(baseTy)) {
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy,
cs.getConstraintLocator(base));
base = coerceImplicitlyUnwrappedOptionalToValue(base, objTy);
expr->setBase(base);
}

Expand Down Expand Up @@ -5105,7 +5101,7 @@ Expr *ExprRewriter::coerceExistential(Expr *expr, Type toType,
// FIXME: Hack. We shouldn't try to coerce existential when there is no
// existential upcast to perform.
if (ty->isEqual(toType)) {
return coerceImplicitlyUnwrappedOptionalToValue(expr, ty, locator);
return coerceImplicitlyUnwrappedOptionalToValue(expr, ty);
}
}

Expand Down Expand Up @@ -5251,8 +5247,7 @@ Expr *ExprRewriter::coerceOptionalToOptional(Expr *expr, Type toType,
return expr;
}

Expr *ExprRewriter::coerceImplicitlyUnwrappedOptionalToValue(Expr *expr, Type objTy,
ConstraintLocatorBuilder locator) {
Expr *ExprRewriter::coerceImplicitlyUnwrappedOptionalToValue(Expr *expr, Type objTy) {
auto optTy = cs.getType(expr);
// Coerce to an r-value.
if (optTy->is<LValueType>())
Expand Down Expand Up @@ -6086,14 +6081,14 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
case ConversionRestrictionKind::ForceUnchecked: {
auto valueTy = fromType->getImplicitlyUnwrappedOptionalObjectType();
assert(valueTy);
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, valueTy, locator);
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, valueTy);
return coerceToType(expr, toType, locator);
}

case ConversionRestrictionKind::ArrayUpcast: {
// Look through implicitly unwrapped optionals.
if (auto objTy= cs.lookThroughImplicitlyUnwrappedOptionalType(fromType)) {
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy);
}

// Build the value conversion.
Expand All @@ -6105,7 +6100,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
// Look through implicitly unwrapped optionals.
if (auto objTy
= cs.lookThroughImplicitlyUnwrappedOptionalType(cs.getType(expr))) {
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy);
}

// We want to check conformance on the rvalue, as that's what has
Expand All @@ -6129,7 +6124,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
// Look through implicitly unwrapped optionals.
if (auto objTy
= cs.lookThroughImplicitlyUnwrappedOptionalType(cs.getType(expr))) {
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy);
}

// Build the value conversion.
Expand All @@ -6141,7 +6136,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
// Look through implicitly unwrapped optionals.
if (auto objTy
= cs.lookThroughImplicitlyUnwrappedOptionalType(cs.getType(expr))) {
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy, locator);
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, objTy);
}

// Build the value conversion.
Expand Down Expand Up @@ -6410,7 +6405,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,

// Look through ImplicitlyUnwrappedOptional<T> before coercing expression.
if (auto ty = cs.lookThroughImplicitlyUnwrappedOptionalType(fromType)) {
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, ty, locator);
expr = coerceImplicitlyUnwrappedOptionalToValue(expr, ty);
return coerceToType(expr, toType, locator);
}

Expand Down Expand Up @@ -7028,7 +7023,7 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,

// Handle applications that look through ImplicitlyUnwrappedOptional<T>.
if (auto fnTy = cs.lookThroughImplicitlyUnwrappedOptionalType(cs.getType(fn)))
fn = coerceImplicitlyUnwrappedOptionalToValue(fn, fnTy, locator);
fn = coerceImplicitlyUnwrappedOptionalToValue(fn, fnTy);

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