[Diagnostics] Add a workaround for inability to diagnose name shadowing

Let's cover at least the most common cases - min/max. Fixing the
problem requires refactoring of `resolveDeclRefExpr`.
This commit is contained in:
Pavel Yaskevich
2019-10-16 10:14:55 -07:00
parent d69a1a5eee
commit 2a0080c6e0
4 changed files with 40 additions and 5 deletions

View File

@@ -998,6 +998,9 @@ ConstraintSystem::TypeMatchResult constraints::matchCallArguments(
auto extraArguments = listener.getExtraneousArguments();
if (!extraArguments.empty()) {
if (RemoveExtraneousArguments::isMinMaxNameShadowing(cs, locator))
return cs.getTypeMatchFailure(locator);
// First let's see whether this is a situation where a single
// parameter is a tuple, but N distinct arguments were passed in.
if (AllowTupleSplatForSingleParameter::attempt(