@@ -9069,86 +9069,6 @@ ValueDecl *ConstraintSystem::findResolvedMemberRef(ConstraintLocator *locator) {
9069
9069
return nullptr ;
9070
9070
}
9071
9071
9072
-
9073
- bool ConstraintSystem::salvage (SmallVectorImpl<Solution> &viable, Expr *expr) {
9074
- if (TC.getLangOpts ().DebugConstraintSolver ) {
9075
- auto &log = TC.Context .TypeCheckerDebug ->getStream ();
9076
- log << " ---Attempting to salvage and emit diagnostics---\n " ;
9077
- }
9078
-
9079
- // Attempt to solve again, capturing all states that come from our attempts to
9080
- // select overloads or bind type variables.
9081
- //
9082
- // FIXME: can this be removed? We need to arrange for recordFixes to be
9083
- // eliminated.
9084
- viable.clear ();
9085
-
9086
- {
9087
- // Set up solver state.
9088
- SolverState state (expr, *this );
9089
- state.recordFixes = true ;
9090
-
9091
- // Solve the system.
9092
- solveRec (viable, FreeTypeVariableBinding::Disallow);
9093
-
9094
- // Check whether we have a best solution; this can happen if we found
9095
- // a series of fixes that worked.
9096
- if (auto best = findBestSolution (viable, state.ExprWeights ,
9097
- /* minimize=*/ true )) {
9098
- if (*best != 0 )
9099
- viable[0 ] = std::move (viable[*best]);
9100
- viable.erase (viable.begin () + 1 , viable.end ());
9101
- return false ;
9102
- }
9103
-
9104
- // FIXME: If we were able to actually fix things along the way,
9105
- // we may have to hunt for the best solution. For now, we don't care.
9106
-
9107
- // Before removing any "fixed" solutions, let's check
9108
- // if ambiguity is caused by fixes and diagnose if possible.
9109
- if (diagnoseAmbiguityWithFixes (expr, viable))
9110
- return true ;
9111
-
9112
- // Remove solutions that require fixes; the fixes in those systems should
9113
- // be diagnosed rather than any ambiguity.
9114
- auto hasFixes = [](const Solution &sol) { return !sol.Fixes .empty (); };
9115
- auto newEnd = std::remove_if (viable.begin (), viable.end (), hasFixes);
9116
- viable.erase (newEnd, viable.end ());
9117
-
9118
- // If there are multiple solutions, try to diagnose an ambiguity.
9119
- if (viable.size () > 1 ) {
9120
- if (getASTContext ().LangOpts .DebugConstraintSolver ) {
9121
- auto &log = getASTContext ().TypeCheckerDebug ->getStream ();
9122
- log << " ---Ambiguity error: "
9123
- << viable.size () << " solutions found---\n " ;
9124
- int i = 0 ;
9125
- for (auto &solution : viable) {
9126
- log << " ---Ambiguous solution #" << i++ << " ---\n " ;
9127
- solution.dump (log);
9128
- log << " \n " ;
9129
- }
9130
- }
9131
-
9132
- if (diagnoseAmbiguity (expr, viable)) {
9133
- return true ;
9134
- }
9135
- }
9136
-
9137
- // Fall through to produce diagnostics.
9138
- }
9139
-
9140
- if (getExpressionTooComplex (viable)) {
9141
- TC.diagnose (expr->getLoc (), diag::expression_too_complex).
9142
- highlight (expr->getSourceRange ());
9143
- return true ;
9144
- }
9145
-
9146
- // If all else fails, diagnose the failure by looking through the system's
9147
- // constraints.
9148
- diagnoseFailureForExpr (expr);
9149
- return true ;
9150
- }
9151
-
9152
9072
bool swift::diagnoseBaseUnwrapForMemberAccess (Expr *baseExpr, Type baseType,
9153
9073
DeclName memberName,
9154
9074
bool resultOptional,
0 commit comments