Skip to content

[TypeChecker] Remove obsolete check for load expr on typeCheckExpr #30742

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 1 commit into from
Apr 1, 2020
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
7 changes: 1 addition & 6 deletions lib/Sema/TypeCheckConstraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2058,13 +2058,8 @@ TypeChecker::typeCheckExpression(

// Tell the constraint system what the contextual type is. This informs
// diagnostics and is a hint for various performance optimizations.
// FIXME: Look through LoadExpr. This is an egregious hack due to the
// way typeCheckExprIndependently works.
Expr *contextualTypeExpr = expr;
if (auto loadExpr = dyn_cast_or_null<LoadExpr>(contextualTypeExpr))
contextualTypeExpr = loadExpr->getSubExpr();
cs.setContextualType(
contextualTypeExpr,
expr,
target.getExprContextualTypeLoc(),
target.getExprContextualTypePurpose());

Expand Down