Skip to content

[Diagnostics] Remove obsolete FailureDiagnosis::visitIdentityExpr from CSDiag #29413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions lib/Sema/CSDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ class FailureDiagnosis :public ASTVisitor<FailureDiagnosis, /*exprresult*/bool>{
validateContextualType(Type contextualType, ContextualTypePurpose CTP);

bool visitExpr(Expr *E);
bool visitIdentityExpr(IdentityExpr *E);
bool visitTryExpr(TryExpr *E);

bool visitApplyExpr(ApplyExpr *AE);
Expand Down Expand Up @@ -1582,21 +1581,6 @@ visitRebindSelfInConstructorExpr(RebindSelfInConstructorExpr *E) {
return false;
}

/// An IdentityExpr doesn't change its argument, but it *can* propagate its
/// contextual type information down.
bool FailureDiagnosis::visitIdentityExpr(IdentityExpr *E) {
auto contextualType = CS.getContextualType(E);

// If we have a paren expr and our contextual type is a ParenType, remove the
// paren expr sugar.
if (contextualType)
contextualType = contextualType->getWithoutParens();
if (!typeCheckChildIndependently(E->getSubExpr(), contextualType,
CS.getContextualTypePurpose(E)))
return true;
return false;
}

/// A TryExpr doesn't change it's argument, nor does it change the contextual
/// type.
bool FailureDiagnosis::visitTryExpr(TryExpr *E) {
Expand Down