From 30d9961efb7c0056a2b189b642489bee92048442 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 13 Jul 2018 13:20:39 +0200 Subject: Do not exclude public state variables when looking for conflicting declarations. --- .../412_early_exit_on_fatal_errors.sol | 1 + .../scoping/function_state_variable_conflict.sol | 6 ++++++ .../scoping/state_variable_function_conflict.sol | 6 ++++++ .../state_variable_function_conflict_former_crash.sol | 14 ++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol create mode 100644 test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol create mode 100644 test/libsolidity/syntaxTests/scoping/state_variable_function_conflict_former_crash.sol (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol index 56fc4051..d052dab5 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/412_early_exit_on_fatal_errors.sol @@ -8,4 +8,5 @@ contract C { } } // ---- +// DeclarationError: (150-179): Identifier already declared. // DeclarationError: (114-120): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol b/test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol new file mode 100644 index 00000000..d717981b --- /dev/null +++ b/test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol @@ -0,0 +1,6 @@ +contract C { + function f(uint) public pure {} + uint public f = 0; +} +// ---- +// DeclarationError: (53-70): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol b/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol new file mode 100644 index 00000000..0c732f7f --- /dev/null +++ b/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol @@ -0,0 +1,6 @@ +contract C { + uint public f = 0; + function f(uint) public pure {} +} +// ---- +// DeclarationError: (40-71): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict_former_crash.sol b/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict_former_crash.sol new file mode 100644 index 00000000..fb9180c6 --- /dev/null +++ b/test/libsolidity/syntaxTests/scoping/state_variable_function_conflict_former_crash.sol @@ -0,0 +1,14 @@ +// This used to crash with some compiler versions. +contract SomeContract { + + uint public balance = 0; + + function balance(uint number) public {} + + function doSomething() public { + balance(3); + } +} +// ---- +// DeclarationError: (106-145): Identifier already declared. +// TypeError: (185-195): Type is not callable -- cgit