diff options
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 |