mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use the most derived contract as main location in case of diamond inheritance.
This commit is contained in:
parent
b918a105a4
commit
549ba801fb
@ -343,18 +343,33 @@ void TypeChecker::annotateBaseConstructorArguments(
|
|||||||
{
|
{
|
||||||
ASTNode const* previousNode = insertionResult.first->second;
|
ASTNode const* previousNode = insertionResult.first->second;
|
||||||
|
|
||||||
|
SourceLocation const* mainLocation = nullptr;
|
||||||
SecondarySourceLocation ssl;
|
SecondarySourceLocation ssl;
|
||||||
|
|
||||||
|
if (
|
||||||
|
_currentContract.location().contains(previousNode->location()) ||
|
||||||
|
_currentContract.location().contains(_argumentNode->location())
|
||||||
|
)
|
||||||
|
{
|
||||||
|
mainLocation = &previousNode->location();
|
||||||
ssl.append("Second constructor call is here:", _argumentNode->location());
|
ssl.append("Second constructor call is here:", _argumentNode->location());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainLocation = &_currentContract.location();
|
||||||
|
ssl.append("First constructor call is here: ", _argumentNode->location());
|
||||||
|
ssl.append("Second constructor call is here: ", previousNode->location());
|
||||||
|
}
|
||||||
|
|
||||||
if (v050)
|
if (v050)
|
||||||
m_errorReporter.declarationError(
|
m_errorReporter.declarationError(
|
||||||
previousNode->location(),
|
*mainLocation,
|
||||||
ssl,
|
ssl,
|
||||||
"Base constructor arguments given twice."
|
"Base constructor arguments given twice."
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
m_errorReporter.warning(
|
m_errorReporter.warning(
|
||||||
previousNode->location(),
|
*mainLocation,
|
||||||
"Base constructor arguments given twice.",
|
"Base constructor arguments given twice.",
|
||||||
ssl
|
ssl
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user