mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2888 from ethereum/same-declaration-error
Use secondary source location as a vector in same declaration errors
This commit is contained in:
commit
f2412da800
@ -174,15 +174,17 @@ void TypeChecker::checkContractDuplicateFunctions(ContractDefinition const& _con
|
|||||||
{
|
{
|
||||||
vector<FunctionDefinition const*> const& overloads = it.second;
|
vector<FunctionDefinition const*> const& overloads = it.second;
|
||||||
for (size_t i = 0; i < overloads.size(); ++i)
|
for (size_t i = 0; i < overloads.size(); ++i)
|
||||||
|
{
|
||||||
|
SecondarySourceLocation ssl;
|
||||||
|
|
||||||
for (size_t j = i + 1; j < overloads.size(); ++j)
|
for (size_t j = i + 1; j < overloads.size(); ++j)
|
||||||
if (FunctionType(*overloads[i]).hasEqualArgumentTypes(FunctionType(*overloads[j])))
|
if (FunctionType(*overloads[i]).hasEqualArgumentTypes(FunctionType(*overloads[j])))
|
||||||
{
|
ssl.append("Other declaration is here:", overloads[j]->location());
|
||||||
|
|
||||||
|
if (ssl.infos.size() > 0)
|
||||||
m_errorReporter.declarationError(
|
m_errorReporter.declarationError(
|
||||||
overloads[j]->location(),
|
overloads[i]->location(),
|
||||||
SecondarySourceLocation().append(
|
ssl,
|
||||||
"Other declaration is here:",
|
|
||||||
overloads[i]->location()
|
|
||||||
),
|
|
||||||
"Function with same name and arguments defined twice."
|
"Function with same name and arguments defined twice."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user