Merge pull request #9703 from a3d4/fix-4558-shadowed-declaration-warning

Corrected warning for homonymous, but not shadowing declarations
This commit is contained in:
chriseth
2020-09-15 13:48:55 +02:00
committed by GitHub
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)
);
}
}