aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-11 20:45:05 +0800
committerGitHub <noreply@github.com>2018-07-11 20:45:05 +0800
commitf3abfa81ad3cdf3cfd0b9e1acf11329a617466a2 (patch)
treed0a9803762993ab1eae0f573a8774741d65a189d /libsolidity
parent238dbe1b9904cee916089ab51b81a5368b80dda3 (diff)
parente7dc9d27fcd21479e897a499af415c906bf3f670 (diff)
downloaddexon-solidity-f3abfa81ad3cdf3cfd0b9e1acf11329a617466a2.tar.gz
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')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp33
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(),