@@ -396,8 +396,7 @@ namespace {
396
396
// / Coerce an expression of (possibly unchecked) optional
397
397
// / type to have a different (possibly unchecked) optional type.
398
398
Expr *coerceOptionalToOptional (Expr *expr, Type toType,
399
- ConstraintLocatorBuilder locator,
400
- Optional<Pattern*> typeFromPattern = None);
399
+ ConstraintLocatorBuilder locator);
401
400
402
401
// / Peephole an array upcast.
403
402
void peepholeArrayUpcast (ArrayExpr *expr, Type toType, bool bridged,
@@ -2035,13 +2034,10 @@ namespace {
2035
2034
// / \param expr The expression to coerce.
2036
2035
// / \param toType The type to coerce the expression to.
2037
2036
// / \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.
2040
2037
// /
2041
2038
// / \returns the coerced expression, which will have type \c ToType.
2042
2039
Expr *coerceToType (Expr *expr, Type toType,
2043
- ConstraintLocatorBuilder locator,
2044
- Optional<Pattern*> typeFromPattern = None);
2040
+ ConstraintLocatorBuilder locator);
2045
2041
2046
2042
// / Coerce the arguments in the provided argument list to their matching
2047
2043
// / parameter types.
@@ -5738,8 +5734,7 @@ static unsigned getOptionalEvaluationDepth(Expr *expr, Expr *target) {
5738
5734
}
5739
5735
5740
5736
Expr *ExprRewriter::coerceOptionalToOptional (Expr *expr, Type toType,
5741
- ConstraintLocatorBuilder locator,
5742
- Optional<Pattern*> typeFromPattern) {
5737
+ ConstraintLocatorBuilder locator) {
5743
5738
auto &ctx = cs.getASTContext ();
5744
5739
Type fromType = cs.getType (expr);
5745
5740
@@ -5781,7 +5776,7 @@ Expr *ExprRewriter::coerceOptionalToOptional(Expr *expr, Type toType,
5781
5776
5782
5777
expr = cs.cacheType (bindOptional);
5783
5778
expr->setImplicit (true );
5784
- expr = coerceToType (expr, toValueType, locator, typeFromPattern );
5779
+ expr = coerceToType (expr, toValueType, locator);
5785
5780
if (!expr) return nullptr ;
5786
5781
5787
5782
unsigned depth = getOptionalEvaluationDepth (expr, bindOptional);
@@ -6702,8 +6697,7 @@ Expr *ConstraintSystem::addImplicitLoadExpr(Expr *expr) {
6702
6697
}
6703
6698
6704
6699
Expr *ExprRewriter::coerceToType (Expr *expr, Type toType,
6705
- ConstraintLocatorBuilder locator,
6706
- Optional<Pattern*> typeFromPattern) {
6700
+ ConstraintLocatorBuilder locator) {
6707
6701
auto &ctx = cs.getASTContext ();
6708
6702
6709
6703
// Diagnose conversions to invalid function types that couldn't be performed
@@ -6818,7 +6812,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
6818
6812
}
6819
6813
6820
6814
case ConversionRestrictionKind::OptionalToOptional:
6821
- return coerceOptionalToOptional (expr, toType, locator, typeFromPattern );
6815
+ return coerceOptionalToOptional (expr, toType, locator);
6822
6816
6823
6817
case ConversionRestrictionKind::ArrayUpcast: {
6824
6818
// Build the value conversion.
@@ -7439,7 +7433,7 @@ Expr *ExprRewriter::coerceToType(Expr *expr, Type toType,
7439
7433
TypeChecker::requireOptionalIntrinsics (ctx, expr->getLoc ());
7440
7434
7441
7435
if (cs.getType (expr)->getOptionalObjectType ())
7442
- return coerceOptionalToOptional (expr, toType, locator, typeFromPattern );
7436
+ return coerceOptionalToOptional (expr, toType, locator);
7443
7437
7444
7438
Type valueType = toGenericType->getGenericArgs ()[0 ];
7445
7439
expr = coerceToType (expr, valueType, locator);
@@ -9563,12 +9557,11 @@ Optional<SolutionApplicationTarget> ConstraintSystem::applySolution(
9563
9557
return resultTarget;
9564
9558
}
9565
9559
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) {
9569
9562
auto &cs = getConstraintSystem ();
9570
9563
ExprRewriter rewriter (cs, *this , None, /* suppressDiagnostics=*/ false );
9571
- Expr *result = rewriter.coerceToType (expr, toType, locator, typeFromPattern );
9564
+ Expr *result = rewriter.coerceToType (expr, toType, locator);
9572
9565
if (!result)
9573
9566
return nullptr ;
9574
9567
0 commit comments