@@ -248,7 +248,6 @@ class FailureDiagnosis :public ASTVisitor<FailureDiagnosis, /*exprresult*/bool>{
248
248
bool visitSubscriptExpr (SubscriptExpr *SE);
249
249
bool visitApplyExpr (ApplyExpr *AE);
250
250
bool visitCoerceExpr (CoerceExpr *CE);
251
- bool visitIfExpr (IfExpr *IE);
252
251
bool visitRebindSelfInConstructorExpr (RebindSelfInConstructorExpr *E);
253
252
};
254
253
} // end anonymous namespace
@@ -1890,37 +1889,6 @@ bool FailureDiagnosis::visitCoerceExpr(CoerceExpr *CE) {
1890
1889
return false ;
1891
1890
}
1892
1891
1893
- bool FailureDiagnosis::visitIfExpr (IfExpr *IE) {
1894
- auto typeCheckClauseExpr = [&](Expr *clause, Type contextType = Type (),
1895
- ContextualTypePurpose convertPurpose =
1896
- CTP_Unused) -> Expr * {
1897
- // Provide proper contextual type when type conversion is specified.
1898
- return typeCheckChildIndependently (clause, contextType, convertPurpose,
1899
- TCCOptions (), nullptr , false );
1900
- };
1901
- // Check all of the subexpressions independently.
1902
- auto condExpr = typeCheckClauseExpr (IE->getCondExpr ());
1903
- if (!condExpr) return true ;
1904
- auto trueExpr = typeCheckClauseExpr (IE->getThenExpr (), CS.getContextualType (),
1905
- CS.getContextualTypePurpose ());
1906
- if (!trueExpr) return true ;
1907
- auto falseExpr = typeCheckClauseExpr (
1908
- IE->getElseExpr (), CS.getContextualType (), CS.getContextualTypePurpose ());
1909
- if (!falseExpr) return true ;
1910
-
1911
- // If the true/false values already match, it must be a contextual problem.
1912
- if (CS.getType (trueExpr)->isEqual (CS.getType (falseExpr)))
1913
- return false ;
1914
-
1915
- // Otherwise, the true/false result types must not be matching.
1916
- diagnose (IE->getColonLoc (), diag::if_expr_cases_mismatch,
1917
- CS.getType (trueExpr), CS.getType (falseExpr))
1918
- .highlight (trueExpr->getSourceRange ())
1919
- .highlight (falseExpr->getSourceRange ());
1920
- return true ;
1921
- }
1922
-
1923
-
1924
1892
bool FailureDiagnosis::
1925
1893
visitRebindSelfInConstructorExpr (RebindSelfInConstructorExpr *E) {
1926
1894
// Don't walk the children for this node, it leads to multiple diagnostics
0 commit comments