From da1a53e02a897117e190ef91ec8b1f63f6629a9f Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 12 Sep 2017 11:07:28 +0100 Subject: Use secondary source location as a vector in same declaration errors --- libsolidity/analysis/TypeChecker.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index d2151cda..0dfae070 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -174,18 +174,20 @@ void TypeChecker::checkContractDuplicateFunctions(ContractDefinition const& _con { vector const& overloads = it.second; for (size_t i = 0; i < overloads.size(); ++i) + { + SecondarySourceLocation ssl; + for (size_t j = i + 1; j < overloads.size(); ++j) if (FunctionType(*overloads[i]).hasEqualArgumentTypes(FunctionType(*overloads[j]))) - { - m_errorReporter.declarationError( - overloads[j]->location(), - SecondarySourceLocation().append( - "Other declaration is here:", - overloads[i]->location() - ), - "Function with same name and arguments defined twice." - ); - } + ssl.append("Other declaration is here:", overloads[j]->location()); + + if (ssl.infos.size() > 0) + m_errorReporter.declarationError( + overloads[i]->location(), + ssl, + "Function with same name and arguments defined twice." + ); + } } } -- cgit v1.2.3