diff options
author | chriseth <chris@ethereum.org> | 2018-04-17 17:40:02 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-04-18 20:24:35 +0800 |
commit | 29a97f16411701c893b2887359524022c0fc6bd6 (patch) | |
tree | 0302b9a9b1cbef3f629a66f8643f03d6b7081172 /test/libsolidity | |
parent | f510348ff1d9f0839a4257d6e05f59304247b4e7 (diff) | |
download | dexon-solidity-29a97f16411701c893b2887359524022c0fc6bd6.tar dexon-solidity-29a97f16411701c893b2887359524022c0fc6bd6.tar.gz dexon-solidity-29a97f16411701c893b2887359524022c0fc6bd6.tar.bz2 dexon-solidity-29a97f16411701c893b2887359524022c0fc6bd6.tar.lz dexon-solidity-29a97f16411701c893b2887359524022c0fc6bd6.tar.xz dexon-solidity-29a97f16411701c893b2887359524022c0fc6bd6.tar.zst dexon-solidity-29a97f16411701c893b2887359524022c0fc6bd6.zip |
Fix name clashes between constructor and fallback function.
Diffstat (limited to 'test/libsolidity')
4 files changed, 14 insertions, 2 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 301250f0..7c0e8643 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -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" })); } diff --git a/test/libsolidity/syntaxTests/constructor/two_constructors_mixed.sol b/test/libsolidity/syntaxTests/constructor/two_constructors_mixed.sol new file mode 100644 index 00000000..c757354e --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/two_constructors_mixed.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/constructor/two_constructors_new.sol b/test/libsolidity/syntaxTests/constructor/two_constructors_new.sol new file mode 100644 index 00000000..42c0de28 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/two_constructors_new.sol @@ -0,0 +1,6 @@ +contract test { + constructor(uint) public { } + constructor() public {} +} +// ---- +// DeclarationError: (47-70): More than one constructor defined. diff --git a/test/libsolidity/syntaxTests/constructor/two_constructors_old.sol b/test/libsolidity/syntaxTests/constructor/two_constructors_old.sol index 40341c4d..db632ced 100644 --- a/test/libsolidity/syntaxTests/constructor/two_constructors_old.sol +++ b/test/libsolidity/syntaxTests/constructor/two_constructors_old.sol @@ -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. |