aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-12 06:05:32 +0800
committerGitHub <noreply@github.com>2018-07-12 06:05:32 +0800
commit99bee7e233f86ce0820176ce97a7ecd3d629ab17 (patch)
tree2c9c371d5741703be05dd7e4f505bd82d3d98e4f /test
parent2b8091526fa3e3f50fff2271fecabc44edbb5375 (diff)
parentcee4775a589bc0047bc505b82fc174ddf07b703d (diff)
downloaddexon-solidity-99bee7e233f86ce0820176ce97a7ecd3d629ab17.tar.gz
dexon-solidity-99bee7e233f86ce0820176ce97a7ecd3d629ab17.tar.zst
dexon-solidity-99bee7e233f86ce0820176ce97a7ecd3d629ab17.zip
Merge pull request #4443 from ethereum/double_var_decl_fix
Fix crash when declaring the same var twice in the same scope
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_and_disjoint_scope.sol10
-rw-r--r--test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol8
-rw-r--r--test/libsolidity/syntaxTests/scoping/poly_variable_declaration_same_scope.sol16
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.