diff options
author | chriseth <chris@ethereum.org> | 2018-12-03 17:46:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-03 17:46:44 +0800 |
commit | 3f613a44eca674e6de60565657c40da3f8e6bbfc (patch) | |
tree | 38d9308bcbadcfa94441223ac2073951a34e4d65 /test | |
parent | 25c63dde28f4f3d2565646c4f8831d71e0f2fd7b (diff) | |
parent | 0668a9ecfb60ab0e00bfb2c4a4a97ce523860832 (diff) | |
download | dexon-solidity-3f613a44eca674e6de60565657c40da3f8e6bbfc.tar dexon-solidity-3f613a44eca674e6de60565657c40da3f8e6bbfc.tar.gz dexon-solidity-3f613a44eca674e6de60565657c40da3f8e6bbfc.tar.bz2 dexon-solidity-3f613a44eca674e6de60565657c40da3f8e6bbfc.tar.lz dexon-solidity-3f613a44eca674e6de60565657c40da3f8e6bbfc.tar.xz dexon-solidity-3f613a44eca674e6de60565657c40da3f8e6bbfc.tar.zst dexon-solidity-3f613a44eca674e6de60565657c40da3f8e6bbfc.zip |
Merge pull request #5557 from ethereum/fixInterfaceImplementedByPublicStateVariable
Public state variables are implementing external functions.
Diffstat (limited to 'test')
5 files changed, 33 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_interface_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_interface_by_public_variable.sol new file mode 100644 index 00000000..49f7c33b --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_interface_by_public_variable.sol @@ -0,0 +1,7 @@ +interface X { function test() external returns (uint256); } +contract Y is X { + uint256 public test = 42; +} +contract T { + constructor() public { new Y(); } +} diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol new file mode 100644 index 00000000..32fac25c --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_internal_function_by_public_variable.sol @@ -0,0 +1,9 @@ +contract X { function test() internal returns (uint256); } +contract Y is X { + uint256 public test = 42; +} +contract T { + constructor() public { new Y(); } +} +// ---- +// DeclarationError: (81-105): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol new file mode 100644 index 00000000..c58e24b6 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_private_function_by_public_variable.sol @@ -0,0 +1,7 @@ +contract X { function test() private returns (uint256); } +contract Y is X { + uint256 public test = 42; +} +contract T { + constructor() public { new Y(); } +} diff --git a/test/libsolidity/syntaxTests/inheritance/override/implement_public_function_by_public_variable.sol b/test/libsolidity/syntaxTests/inheritance/override/implement_public_function_by_public_variable.sol new file mode 100644 index 00000000..7a59c137 --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/override/implement_public_function_by_public_variable.sol @@ -0,0 +1,9 @@ +contract X { function test() public returns (uint256); } +contract Y is X { + uint256 public test = 42; +} +contract T { + constructor() public { new Y(); } +} +// ---- +// DeclarationError: (79-103): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol b/test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol index 0f05cc8e..fb7f3fbd 100644 --- a/test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol +++ b/test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol @@ -6,3 +6,4 @@ contract C is A { } // ---- // DeclarationError: (50-85): Identifier already declared. +// TypeError: (50-85): Redeclaring an already implemented function as abstract |