@@ -2035,9 +2035,6 @@ Expr *ExprTypeCheckListener::appliedSolution(Solution &solution, Expr *expr) {
2035
2035
return expr;
2036
2036
}
2037
2037
2038
- void ExprTypeCheckListener::applySolutionFailed (Solution &solution,
2039
- Expr *expr) {}
2040
-
2041
2038
void ParentConditionalConformance::diagnoseConformanceStack (
2042
2039
DiagnosticEngine &diags, SourceLoc loc,
2043
2040
ArrayRef<ParentConditionalConformance> conformances) {
@@ -2095,45 +2092,6 @@ class FallbackDiagnosticListener : public ExprTypeCheckListener {
2095
2092
Expr *appliedSolution (Solution &solution, Expr *expr) override {
2096
2093
return BaseListener ? BaseListener->appliedSolution (solution, expr) : expr;
2097
2094
}
2098
-
2099
- void applySolutionFailed (Solution &solution, Expr *expr) override {
2100
- if (BaseListener)
2101
- BaseListener->applySolutionFailed (solution, expr);
2102
-
2103
- if (hadAnyErrors ())
2104
- return ;
2105
-
2106
- // If solution involves invalid or incomplete conformances that's
2107
- // a probable cause of failure to apply it without producing an error,
2108
- // which is going to be diagnosed later, so let's not produce
2109
- // fallback diagnostic in this case.
2110
- if (llvm::any_of (
2111
- solution.Conformances ,
2112
- [](const std::pair<ConstraintLocator *, ProtocolConformanceRef>
2113
- &conformance) -> bool {
2114
- auto &ref = conformance.second ;
2115
- return ref.isConcrete () && ref.getConcrete ()->isInvalid ();
2116
- }))
2117
- return ;
2118
-
2119
- maybeProduceFallbackDiagnostic (expr);
2120
- }
2121
-
2122
- private:
2123
- bool hadAnyErrors () const { return Context.Diags .hadAnyError (); }
2124
-
2125
- void maybeProduceFallbackDiagnostic (Expr *expr) const {
2126
- if (Options.contains (TypeCheckExprFlags::SubExpressionDiagnostics) ||
2127
- DiagnosticSuppression::isEnabled (Context.Diags ))
2128
- return ;
2129
-
2130
- // Before producing fatal error here, let's check if there are any "error"
2131
- // diagnostics already emitted or waiting to be emitted. Because they are
2132
- // a better indication of the problem.
2133
- if (!(hadAnyErrors () || Context.hasDelayedConformanceErrors ()))
2134
- Context.Diags .diagnose (expr->getLoc (),
2135
- diag::failed_to_produce_diagnostic);
2136
- }
2137
2095
};
2138
2096
2139
2097
#pragma mark High-level entry points
@@ -2259,8 +2217,6 @@ Type TypeChecker::typeCheckExpressionImpl(Expr *&expr, DeclContext *dc,
2259
2217
options.contains (TypeCheckExprFlags::SubExpressionDiagnostics);
2260
2218
auto resultTarget = cs.applySolution (solution, target, performingDiagnostics);
2261
2219
if (!resultTarget) {
2262
- listener.applySolutionFailed (solution, expr);
2263
-
2264
2220
// Failure already diagnosed, above, as part of applying the solution.
2265
2221
return Type ();
2266
2222
}
0 commit comments