Skip to content

[CSDiag] NFC: Remove obsolete CalleeListener callback #28980

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
Jan 2, 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
41 changes: 0 additions & 41 deletions lib/Sema/CSDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,47 +1615,6 @@ bool FailureDiagnosis::visitSubscriptExpr(SubscriptExpr *SE) {
return diagnoseSubscriptErrors(SE, /* inAssignmentDestination = */ false);
}

namespace {
/// Type checking listener for pattern binding initializers.
class CalleeListener : public ExprTypeCheckListener {
Type contextualType;
public:
explicit CalleeListener(Type contextualType)
: contextualType(contextualType) { }

bool builtConstraints(ConstraintSystem &cs, Expr *expr) override {
// If we have no contextual type, there is nothing to do.
if (!contextualType)
return false;

// If the expression is obviously something that produces a metatype,
// then don't put a constraint on it.
auto semExpr = expr->getValueProvidingExpr();
if (isa<TypeExpr>(semExpr))
return false;

auto resultLocator =
cs.getConstraintLocator(expr, ConstraintLocator::FunctionResult);
auto resultType = cs.createTypeVariable(resultLocator,
TVO_CanBindToLValue |
TVO_CanBindToNoEscape);

auto locator = cs.getConstraintLocator(expr);
cs.addConstraint(ConstraintKind::FunctionResult,
cs.getType(expr),
resultType,
locator);

cs.addConstraint(ConstraintKind::Conversion,
resultType,
contextualType,
locator);

return false;
}
};
} // end anonymous namespace

// Check if there is a structural problem in the function expression
// by performing type checking with the option to allow unresolved
// type variables. If that is going to produce a function type with
Expand Down