Skip to content

Commit cbea535

Browse files
committed
[CS] Cleanup an unused parameter in CSApply
1 parent ef839df commit cbea535

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,13 +1572,8 @@ class Solution {
15721572
/// \param toType The type to coerce the expression to.
15731573
/// \param locator Locator used to describe the location of this expression.
15741574
///
1575-
/// \param typeFromPattern Optionally, the caller can specify the pattern
1576-
/// from where the toType is derived, so that we can deliver better fixit.
1577-
///
15781575
/// \returns the coerced expression, which will have type \c ToType.
1579-
Expr *coerceToType(Expr *expr, Type toType,
1580-
ConstraintLocator *locator,
1581-
Optional<Pattern*> typeFromPattern = None);
1576+
Expr *coerceToType(Expr *expr, Type toType, ConstraintLocator *locator);
15821577

15831578
/// Compute the set of substitutions for a generic signature opened at the
15841579
/// given locator.

lib/Sema/CSApply.cpp

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,7 @@ namespace {
396396
/// Coerce an expression of (possibly unchecked) optional
397397
/// type to have a different (possibly unchecked) optional type.
398398
Expr *coerceOptionalToOptional(Expr *expr, Type toType,
399-
ConstraintLocatorBuilder locator,
400-
Optional<Pattern*> typeFromPattern = None);
399+
ConstraintLocatorBuilder locator);
401400

402401
/// Peephole an array upcast.
403402
void peepholeArrayUpcast(ArrayExpr *expr, Type toType, bool bridged,
@@ -2035,13 +2034,10 @@ namespace {
20352034
/// \param expr The expression to coerce.
20362035
/// \param toType The type to coerce the expression to.
20372036
/// \param locator Locator used to describe where in this expression we are.
2038-
/// \param typeFromPattern Optionally, the caller can specify the pattern
2039-
/// from where the toType is derived, so that we can deliver better fixit.
20402037
///
20412038
/// \returns the coerced expression, which will have type \c ToType.
20422039
Expr *coerceToType(Expr *expr, Type toType,
2043-
ConstraintLocatorBuilder locator,
2044-
Optional<Pattern*> typeFromPattern = None);
2040+
ConstraintLocatorBuilder locator);
20452041

20462042
/// Coerce the arguments in the provided argument list to their matching
20472043
/// parameter types.
@@ -5738,8 +5734,7 @@ static unsigned getOptionalEvaluationDepth(Expr *expr, Expr *target) {
57385734
}
57395735

57405736
Expr *ExprRewriter::coerceOptionalToOptional(Expr *expr, Type toType,
5741-
ConstraintLocatorBuilder locator,
5742-
Optional<Pattern*> typeFromPattern) {
5737+
ConstraintLocatorBuilder locator) {
57435738
auto &ctx = cs.getASTContext();
57445739
Type fromType = cs.getType(expr);
57455740

@@ -5781,7 +5776,7 @@ Expr *ExprRewriter::coerceOptionalToOptional(Expr *expr, Type toType,
57815776

57825777
expr = cs.cacheType(bindOptional);
57835778
expr->setImplicit(true);
5784-
expr = coerceToType(expr, toValueType, locator, typeFromPattern);
5779+
expr = coerceToType(expr, toValueType, locator);
57855780
if (!expr) return nullptr;
57865781

57875782
unsigned depth = getOptionalEvaluationDepth(expr, bindOptional);
@@ -6702,8 +6697,7 @@ Expr *ConstraintSystem::addImplicitLoadExpr(Expr *expr) {
67026697
}
67036698

67046699
Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6705-
ConstraintLocatorBuilder locator,
6706-
Optional<Pattern*> typeFromPattern) {
6700+
ConstraintLocatorBuilder locator) {
67076701
auto &ctx = cs.getASTContext();
67086702

67096703
// Diagnose conversions to invalid function types that couldn't be performed
@@ -6818,7 +6812,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
68186812
}
68196813

68206814
case ConversionRestrictionKind::OptionalToOptional:
6821-
return coerceOptionalToOptional(expr, toType, locator, typeFromPattern);
6815+
return coerceOptionalToOptional(expr, toType, locator);
68226816

68236817
case ConversionRestrictionKind::ArrayUpcast: {
68246818
// Build the value conversion.
@@ -7439,7 +7433,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
74397433
TypeChecker::requireOptionalIntrinsics(ctx, expr->getLoc());
74407434

74417435
if (cs.getType(expr)->getOptionalObjectType())
7442-
return coerceOptionalToOptional(expr, toType, locator, typeFromPattern);
7436+
return coerceOptionalToOptional(expr, toType, locator);
74437437

74447438
Type valueType = toGenericType->getGenericArgs()[0];
74457439
expr = coerceToType(expr, valueType, locator);
@@ -9563,12 +9557,11 @@ Optional<SolutionApplicationTarget> ConstraintSystem::applySolution(
95639557
return resultTarget;
95649558
}
95659559

9566-
Expr *Solution::coerceToType(Expr *expr, Type toType,
9567-
ConstraintLocator *locator,
9568-
Optional<Pattern*> typeFromPattern) {
9560+
Expr *
9561+
Solution::coerceToType(Expr *expr, Type toType, ConstraintLocator *locator) {
95699562
auto &cs = getConstraintSystem();
95709563
ExprRewriter rewriter(cs, *this, None, /*suppressDiagnostics=*/false);
9571-
Expr *result = rewriter.coerceToType(expr, toType, locator, typeFromPattern);
9564+
Expr *result = rewriter.coerceToType(expr, toType, locator);
95729565
if (!result)
95739566
return nullptr;
95749567

0 commit comments

Comments
 (0)