diff options
author | chriseth <chris@ethereum.org> | 2018-07-11 20:45:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-11 20:45:05 +0800 |
commit | f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2 (patch) | |
tree | d0a9803762993ab1eae0f573a8774741d65a189d /libsolidity/analysis/TypeChecker.cpp | |
parent | 238dbe1b9904cee916089ab51b81a5368b80dda3 (diff) | |
parent | e7dc9d27fcd21479e897a499af415c906bf3f670 (diff) | |
download | dexon-solidity-f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2.tar dexon-solidity-f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2.tar.gz dexon-solidity-f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2.tar.bz2 dexon-solidity-f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2.tar.lz dexon-solidity-f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2.tar.xz dexon-solidity-f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2.tar.zst dexon-solidity-f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2.zip |
Merge pull request #4454 from ethereum/constructorArgCount
[BREAKING] Wrong argument count in constructor call
Diffstat (limited to 'libsolidity/analysis/TypeChecker.cpp')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 071ac9fe..da04ee96 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -548,33 +548,18 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance) if (arguments) { - bool v050 = m_scope->sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050); - if (parameterTypes.size() != arguments->size()) { - if (arguments->size() == 0 && !v050) - m_errorReporter.warning( - _inheritance.location(), - "Wrong argument count for constructor call: " + - toString(arguments->size()) + - " arguments given but expected " + - toString(parameterTypes.size()) + - "." - ); - else - { - m_errorReporter.typeError( - _inheritance.location(), - "Wrong argument count for constructor call: " + - toString(arguments->size()) + - " arguments given but expected " + - toString(parameterTypes.size()) + - "." - ); - return; - } + m_errorReporter.typeError( + _inheritance.location(), + "Wrong argument count for constructor call: " + + toString(arguments->size()) + + " arguments given but expected " + + toString(parameterTypes.size()) + + ". Remove parentheses if you do not want to provide arguments here." + ); } - for (size_t i = 0; i < arguments->size(); ++i) + for (size_t i = 0; i < std::min(arguments->size(), parameterTypes.size()); ++i) if (!type(*(*arguments)[i])->isImplicitlyConvertibleTo(*parameterTypes[i])) m_errorReporter.typeError( (*arguments)[i]->location(), |