Fix name clashes between constructor and fallback function.

This commit is contained in:
chriseth
2018-04-18 14:24:35 +02:00
parent f510348ff1
commit 29a97f1641
6 changed files with 61 additions and 50 deletions
@@ -1140,7 +1140,6 @@ BOOST_AUTO_TEST_CASE(fallback_function_twice)
}
)";
CHECK_ERROR_ALLOW_MULTI(text, DeclarationError, (vector<string>{
"Function with same name and arguments defined twice.",
"Only one fallback function is"
}));
}
@@ -0,0 +1,7 @@
contract test {
function test(uint) public { }
constructor() public {}
}
// ----
// Warning: (17-47): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
// DeclarationError: (49-72): More than one constructor defined.
@@ -0,0 +1,6 @@
contract test {
constructor(uint) public { }
constructor() public {}
}
// ----
// DeclarationError: (47-70): More than one constructor defined.
@@ -5,4 +5,4 @@ contract test {
// ----
// Warning: (17-49): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
// Warning: (51-76): Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
// DeclarationError: (17-49): More than one constructor defined.
// DeclarationError: (51-76): More than one constructor defined.