mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Only suggest removing parentheses from a construction call if they're empty
This commit is contained in:
parent
73183d3df9
commit
1a981af548
@ -365,7 +365,7 @@ void TypeChecker::endVisit(InheritanceSpecifier const& _inheritance)
|
|||||||
toString(arguments->size()) +
|
toString(arguments->size()) +
|
||||||
" arguments given but expected " +
|
" arguments given but expected " +
|
||||||
toString(parameterTypes.size()) +
|
toString(parameterTypes.size()) +
|
||||||
". Remove parentheses if you do not want to provide arguments here."
|
(arguments->size() == 0 ? ". Remove parentheses if you do not want to provide arguments here." : "")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < std::min(arguments->size(), parameterTypes.size()); ++i)
|
for (size_t i = 0; i < std::min(arguments->size(), parameterTypes.size()); ++i)
|
||||||
|
@ -7,7 +7,7 @@ contract E is C(1) { constructor() C(1) {} }
|
|||||||
// ----
|
// ----
|
||||||
// DeclarationError 3364: (93-108): Base constructor arguments given twice.
|
// DeclarationError 3364: (93-108): Base constructor arguments given twice.
|
||||||
// DeclarationError 3364: (149-153): Base constructor arguments given twice.
|
// DeclarationError 3364: (149-153): Base constructor arguments given twice.
|
||||||
// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2
|
||||||
// TypeError 2973: (93-108): Wrong argument count for modifier invocation: 3 arguments given but expected 2.
|
// TypeError 2973: (93-108): Wrong argument count for modifier invocation: 3 arguments given but expected 2.
|
||||||
// TypeError 7927: (128-132): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (128-132): Wrong argument count for constructor call: 1 arguments given but expected 2
|
||||||
// TypeError 2973: (149-153): Wrong argument count for modifier invocation: 1 arguments given but expected 2.
|
// TypeError 2973: (149-153): Wrong argument count for modifier invocation: 1 arguments given but expected 2.
|
||||||
|
@ -5,5 +5,5 @@ contract C {
|
|||||||
contract D is C(1, true, "a") {}
|
contract D is C(1, true, "a") {}
|
||||||
contract E is C(1) {}
|
contract E is C(1) {}
|
||||||
// ----
|
// ----
|
||||||
// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2
|
||||||
// TypeError 7927: (94-98): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (94-98): Wrong argument count for constructor call: 1 arguments given but expected 2
|
||||||
|
@ -5,5 +5,5 @@ abstract contract C {
|
|||||||
abstract contract D is C(1, true, "a") {}
|
abstract contract D is C(1, true, "a") {}
|
||||||
abstract contract E is C(1) {}
|
abstract contract E is C(1) {}
|
||||||
// ----
|
// ----
|
||||||
// TypeError 7927: (79-94): Wrong argument count for constructor call: 3 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (79-94): Wrong argument count for constructor call: 3 arguments given but expected 2
|
||||||
// TypeError 7927: (121-125): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (121-125): Wrong argument count for constructor call: 1 arguments given but expected 2
|
||||||
|
@ -5,5 +5,5 @@ contract C {
|
|||||||
contract D is C(1, true, "a") { constructor() {} }
|
contract D is C(1, true, "a") { constructor() {} }
|
||||||
contract E is C(1) { constructor() {} }
|
contract E is C(1) { constructor() {} }
|
||||||
// ----
|
// ----
|
||||||
// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2
|
||||||
// TypeError 7927: (112-116): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (112-116): Wrong argument count for constructor call: 1 arguments given but expected 2
|
||||||
|
@ -6,5 +6,5 @@ contract Derived2 is Base {
|
|||||||
constructor() Base(2) { }
|
constructor() Base(2) { }
|
||||||
}
|
}
|
||||||
// ----
|
// ----
|
||||||
// TypeError 7927: (67-74): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (67-74): Wrong argument count for constructor call: 1 arguments given but expected 2
|
||||||
// TypeError 2973: (123-130): Wrong argument count for modifier invocation: 1 arguments given but expected 2.
|
// TypeError 2973: (123-130): Wrong argument count for modifier invocation: 1 arguments given but expected 2.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
interface I {}
|
interface I {}
|
||||||
contract C is I(2) {}
|
contract C is I(2) {}
|
||||||
// ----
|
// ----
|
||||||
// TypeError 7927: (29-33): Wrong argument count for constructor call: 1 arguments given but expected 0. Remove parentheses if you do not want to provide arguments here.
|
// TypeError 7927: (29-33): Wrong argument count for constructor call: 1 arguments given but expected 0
|
||||||
|
Loading…
Reference in New Issue
Block a user