Fixup diagnostics

This commit is contained in:
Frederick Kellison-Linn
2020-07-31 18:02:05 -04:00
parent 5b5e30b6d7
commit 1069fe280f
8 changed files with 56 additions and 70 deletions

View File

@@ -2129,15 +2129,19 @@ bool ContextualFailure::diagnoseAsError() {
return false;
}
case ConstraintLocator::Member:
case ConstraintLocator::FunctionResult:
case ConstraintLocator::UnresolvedMember: {
case ConstraintLocator::UnresolvedMemberChainResult: {
auto &solution = getSolution();
auto locator = getConstraintLocator(anchor,
isExpr<UnresolvedMemberExpr>(anchor)
? ConstraintLocator::UnresolvedMember
: ConstraintLocator::Member);
auto overload = getOverloadChoiceIfAvailable(locator);
auto member = anchor;
if (auto *CE = getAsExpr<CallExpr>(anchor))
member = CE->getFn();
auto kind = ConstraintLocator::Member;
if (isExpr<UnresolvedMemberExpr>(anchor))
kind = ConstraintLocator::UnresolvedMember;
else if (isExpr<SubscriptExpr>(anchor))
kind = ConstraintLocator::SubscriptMember;
auto overload = getOverloadChoiceIfAvailable(getConstraintLocator(member,
kind));
if (!(overload && overload->choice.isDecl()))
return false;