Correct the warning for homonymous, but not shadowing declarations

This commit is contained in:
a3d4
2020-09-15 02:39:21 +02:00
parent 4d470cd285
commit 4ca7655b74
4 changed files with 27 additions and 5 deletions
+14 -5
View File
@@ -503,11 +503,20 @@ bool DeclarationRegistrationHelper::registerDeclaration(
else
{
auto shadowedLocation = shadowedDeclaration->location();
_errorReporter.warning(
2519_error,
_declaration.location(),
"This declaration shadows an existing declaration.",
SecondarySourceLocation().append("The shadowed declaration is here:", shadowedLocation)
if (!shadowedDeclaration->isVisibleInContract())
_errorReporter.warning(
8760_error,
_declaration.location(),
"This declaration has the same name as another declaration.",
SecondarySourceLocation().append("The other declaration is here:", shadowedLocation)
);
else
_errorReporter.warning(
2519_error,
_declaration.location(),
"This declaration shadows an existing declaration.",
SecondarySourceLocation().append("The shadowed declaration is here:", shadowedLocation)
);
}
}