mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[AST] Remove ArgumentList::composeTupleOrParenType
Remove a redundant bit of diagnostic logic now that we better diagnose cases where an uncallable variable is in an overload set for a mismatched apply. Tweak another bit of diagnostic logic to only apply to a single arg/param case, as that seems to be what it's meant for.
This commit is contained in:
@@ -4403,19 +4403,17 @@ static bool diagnoseAmbiguity(
|
||||
type->lookThroughAllOptionalTypes()->getAs<AnyFunctionType>();
|
||||
assert(fn);
|
||||
|
||||
if (fn->getNumParams() == 1) {
|
||||
auto *argList =
|
||||
solution.getArgumentList(solution.Fixes.front()->getLocator());
|
||||
assert(argList);
|
||||
auto *argList =
|
||||
solution.getArgumentList(solution.Fixes.front()->getLocator());
|
||||
assert(argList);
|
||||
|
||||
if (fn->getNumParams() == 1 && argList->isUnary()) {
|
||||
const auto ¶m = fn->getParams()[0];
|
||||
auto argType = argList->composeTupleOrParenType(
|
||||
cs.getASTContext(),
|
||||
[&](Expr *E) { return solution.getResolvedType(E); });
|
||||
auto argTy = solution.getResolvedType(argList->getUnaryExpr());
|
||||
|
||||
DE.diagnose(noteLoc, diag::candidate_has_invalid_argument_at_position,
|
||||
solution.simplifyType(param.getPlainType()),
|
||||
/*position=*/1, param.isInOut(), argType);
|
||||
/*position=*/1, param.isInOut(), argTy);
|
||||
} else {
|
||||
DE.diagnose(noteLoc, diag::candidate_partial_match,
|
||||
fn->getParamListAsString(fn->getParams()));
|
||||
|
||||
Reference in New Issue
Block a user