@@ -5451,11 +5451,9 @@ bool FailureDiagnosis::diagnoseCallContextualConversionErrors(
5451
5451
auto *DC = CS.DC ;
5452
5452
5453
5453
auto typeCheckExpr = [](TypeChecker &TC, Expr *expr, DeclContext *DC,
5454
- SmallPtrSetImpl<TypeBase *> &types,
5455
- Type contextualType = Type ()) {
5456
- CalleeListener listener (contextualType);
5454
+ SmallPtrSetImpl<TypeBase *> &types) {
5457
5455
TC.getPossibleTypesOfExpressionWithoutApplying (
5458
- expr, DC, types, FreeTypeVariableBinding::Disallow, &listener );
5456
+ expr, DC, types, FreeTypeVariableBinding::Disallow);
5459
5457
};
5460
5458
5461
5459
// First let's type-check expression without contextual type, and
@@ -5470,22 +5468,9 @@ bool FailureDiagnosis::diagnoseCallContextualConversionErrors(
5470
5468
if (withoutContextual.empty ())
5471
5469
return false ;
5472
5470
5473
- SmallPtrSet<TypeBase *, 4 > withContextual;
5474
- typeCheckExpr (TC, callExpr, DC, withContextual, contextualType);
5475
- // If type-checking with contextual type didn't produce any results
5476
- // it means that we have a contextual mismatch.
5477
- if (withContextual.empty ()) {
5478
- // If there is just a single choice, we can hit contextual diagnostics
5479
- // about it in case re-typecheck fails.
5480
- Type exprType = withoutContextual.size () == 1 ? *withoutContextual.begin () : Type ();
5481
- return diagnoseContextualConversionError (callExpr, contextualType, CTP,
5482
- exprType);
5483
- }
5484
-
5485
- // If call produces a single type when type-checked with contextual
5486
- // expression, it means that the problem is elsewhere, any other
5487
- // outcome is ambiguous.
5488
- return false ;
5471
+ Type exprType = withoutContextual.size () == 1 ? *withoutContextual.begin () : Type ();
5472
+ return diagnoseContextualConversionError (callExpr, contextualType, CTP,
5473
+ exprType);
5489
5474
}
5490
5475
5491
5476
bool FailureDiagnosis::diagnoseSubscriptMisuse (ApplyExpr *callExpr) {
0 commit comments