diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-12 21:57:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-12 21:57:42 +0800 |
commit | f2412da80002ad2ca686b8a64210c933ee2f1942 (patch) | |
tree | 060d8658d8716037035a4b8cb8500a900ac1278b /libsolidity/analysis | |
parent | ac3742cd25ac59800aa98a5c5cc35820f511a5ae (diff) | |
parent | da1a53e02a897117e190ef91ec8b1f63f6629a9f (diff) | |
download | dexon-solidity-f2412da80002ad2ca686b8a64210c933ee2f1942.tar dexon-solidity-f2412da80002ad2ca686b8a64210c933ee2f1942.tar.gz dexon-solidity-f2412da80002ad2ca686b8a64210c933ee2f1942.tar.bz2 dexon-solidity-f2412da80002ad2ca686b8a64210c933ee2f1942.tar.lz dexon-solidity-f2412da80002ad2ca686b8a64210c933ee2f1942.tar.xz dexon-solidity-f2412da80002ad2ca686b8a64210c933ee2f1942.tar.zst dexon-solidity-f2412da80002ad2ca686b8a64210c933ee2f1942.zip |
Merge pull request #2888 from ethereum/same-declaration-error
Use secondary source location as a vector in same declaration errors
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 8e1d11a1..3564ff32 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -174,18 +174,20 @@ void TypeChecker::checkContractDuplicateFunctions(ContractDefinition const& _con { vector<FunctionDefinition const*> 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." + ); + } } } |