aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-04-09 22:01:29 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-04-09 22:23:18 +0800
commit549ba801fb2a175cfb24e3c83b63030f47984e95 (patch)
treec0683acb8c616c2324b5b378e756db391d6dc337 /libsolidity
parentb918a105a40aa90fe9b89eecbcdfc7ac2937c141 (diff)
downloaddexon-solidity-549ba801fb2a175cfb24e3c83b63030f47984e95.tar.gz
dexon-solidity-549ba801fb2a175cfb24e3c83b63030f47984e95.tar.zst
dexon-solidity-549ba801fb2a175cfb24e3c83b63030f47984e95.zip
Use the most derived contract as main location in case of diamond inheritance.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index c6868a0a..1d8fd82d 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -343,18 +343,33 @@ void TypeChecker::annotateBaseConstructorArguments(
{
ASTNode const* previousNode = insertionResult.first->second;
+ SourceLocation const* mainLocation = nullptr;
SecondarySourceLocation ssl;
- ssl.append("Second constructor call is here:", _argumentNode->location());
+
+ if (
+ _currentContract.location().contains(previousNode->location()) ||
+ _currentContract.location().contains(_argumentNode->location())
+ )
+ {
+ mainLocation = &previousNode->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)
m_errorReporter.declarationError(
- previousNode->location(),
+ *mainLocation,
ssl,
"Base constructor arguments given twice."
);
else
m_errorReporter.warning(
- previousNode->location(),
+ *mainLocation,
"Base constructor arguments given twice.",
ssl
);