diff options
Diffstat (limited to 'libsolidity/analysis/DeclarationContainer.cpp')
-rw-r--r-- | libsolidity/analysis/DeclarationContainer.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/libsolidity/analysis/DeclarationContainer.cpp b/libsolidity/analysis/DeclarationContainer.cpp index f8c12c5b..b33c8568 100644 --- a/libsolidity/analysis/DeclarationContainer.cpp +++ b/libsolidity/analysis/DeclarationContainer.cpp @@ -42,20 +42,32 @@ Declaration const* DeclarationContainer::conflictingDeclaration( if (m_invisibleDeclarations.count(*_name)) declarations += m_invisibleDeclarations.at(*_name); - if (dynamic_cast<FunctionDefinition const*>(&_declaration)) + if ( + dynamic_cast<FunctionDefinition const*>(&_declaration) || + dynamic_cast<EventDefinition const*>(&_declaration) + ) { - // check that all other declarations with the same name are functions or a public state variable + // check that all other declarations with the same name are functions or a public state variable or events. + // And then check that the signatures are different. for (Declaration const* declaration: declarations) { - if (dynamic_cast<FunctionDefinition const*>(declaration)) - continue; if (auto variableDeclaration = dynamic_cast<VariableDeclaration const*>(declaration)) { if (variableDeclaration->isStateVariable() && !variableDeclaration->isConstant() && variableDeclaration->isPublic()) continue; return declaration; } - return declaration; + if ( + dynamic_cast<FunctionDefinition const*>(&_declaration) && + !dynamic_cast<FunctionDefinition const*>(declaration) + ) + return declaration; + if ( + dynamic_cast<EventDefinition const*>(&_declaration) && + !dynamic_cast<EventDefinition const*>(declaration) + ) + return declaration; + // Or, continue. } } else if (declarations.size() == 1 && declarations.front() == &_declaration) |