diff options
author | Leonardo Alt <leo@ethereum.org> | 2018-07-06 17:04:30 +0800 |
---|---|---|
committer | Leonardo Alt <leo@ethereum.org> | 2018-07-11 00:54:46 +0800 |
commit | c286cdaa6275442ed67dabd41b478cec5cf5b8ca (patch) | |
tree | a1ef45b30a0d3c116272967745dead4b29caac1a /test/libsolidity/syntaxTests/scoping | |
parent | 0e9415bc31fa379b2c6cc8c8dba6b6ba1305391b (diff) | |
download | dexon-solidity-c286cdaa6275442ed67dabd41b478cec5cf5b8ca.tar dexon-solidity-c286cdaa6275442ed67dabd41b478cec5cf5b8ca.tar.gz dexon-solidity-c286cdaa6275442ed67dabd41b478cec5cf5b8ca.tar.bz2 dexon-solidity-c286cdaa6275442ed67dabd41b478cec5cf5b8ca.tar.lz dexon-solidity-c286cdaa6275442ed67dabd41b478cec5cf5b8ca.tar.xz dexon-solidity-c286cdaa6275442ed67dabd41b478cec5cf5b8ca.tar.zst dexon-solidity-c286cdaa6275442ed67dabd41b478cec5cf5b8ca.zip |
Fix crash for double variable declaration in the same scope.
Diffstat (limited to 'test/libsolidity/syntaxTests/scoping')
3 files changed, 34 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_and_disjoint_scope.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_and_disjoint_scope.sol new file mode 100644 index 00000000..45c5ff2d --- /dev/null +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_and_disjoint_scope.sol @@ -0,0 +1,10 @@ +contract test { + function f() pure public { + uint x; + { uint x; } + uint x; + } +} +// ---- +// Warning: (73-79): This declaration shadows an existing declaration. +// DeclarationError: (91-97): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol new file mode 100644 index 00000000..72c31f73 --- /dev/null +++ b/test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol @@ -0,0 +1,8 @@ +contract test { + function f() pure public { + uint x; + uint x; + } +} +// ---- +// DeclarationError: (71-77): Identifier already declared. diff --git a/test/libsolidity/syntaxTests/scoping/poly_variable_declaration_same_scope.sol b/test/libsolidity/syntaxTests/scoping/poly_variable_declaration_same_scope.sol new file mode 100644 index 00000000..e414f611 --- /dev/null +++ b/test/libsolidity/syntaxTests/scoping/poly_variable_declaration_same_scope.sol @@ -0,0 +1,16 @@ +contract test { + function f() pure public { + uint x; + uint x; + uint x; + uint x; + uint x; + uint x; + } +} +// ---- +// DeclarationError: (71-77): Identifier already declared. +// DeclarationError: (87-93): Identifier already declared. +// DeclarationError: (103-109): Identifier already declared. +// DeclarationError: (119-125): Identifier already declared. +// DeclarationError: (135-141): Identifier already declared. |