aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-16 17:58:59 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-06-16 18:30:03 +0800
commitc5339037e9c1d25c95093f905ebe443a38d419f0 (patch)
tree04331738aee0d22d7180a118d54cb446f48f0576 /test
parent0fd73e58321468da4826672e8a196955a04c591c (diff)
downloaddexon-solidity-c5339037e9c1d25c95093f905ebe443a38d419f0.tar
dexon-solidity-c5339037e9c1d25c95093f905ebe443a38d419f0.tar.gz
dexon-solidity-c5339037e9c1d25c95093f905ebe443a38d419f0.tar.bz2
dexon-solidity-c5339037e9c1d25c95093f905ebe443a38d419f0.tar.lz
dexon-solidity-c5339037e9c1d25c95093f905ebe443a38d419f0.tar.xz
dexon-solidity-c5339037e9c1d25c95093f905ebe443a38d419f0.tar.zst
dexon-solidity-c5339037e9c1d25c95093f905ebe443a38d419f0.zip
Test for variable redeclaration in for loops
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/InlineAssembly.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp
index 332f749d..7b760a1d 100644
--- a/test/libsolidity/InlineAssembly.cpp
+++ b/test/libsolidity/InlineAssembly.cpp
@@ -318,6 +318,11 @@ BOOST_AUTO_TEST_CASE(for_visibility)
CHECK_PARSE_ERROR("{ for { pop(i) } 1 { } { let i := 1 } }", DeclarationError, "Identifier not found");
CHECK_PARSE_ERROR("{ for {} i {} { let i := 1 } }", DeclarationError, "Identifier not found");
CHECK_PARSE_ERROR("{ for {} 1 { pop(i) } { let i := 1 } }", DeclarationError, "Identifier not found");
+ CHECK_PARSE_ERROR("{ for { let x := 1 } 1 { let x := 1 } {} }", DeclarationError, "Variable name x already taken in this scope");
+ CHECK_PARSE_ERROR("{ for { let x := 1 } 1 {} { let x := 1 } }", DeclarationError, "Variable name x already taken in this scope");
+ CHECK_PARSE_ERROR("{ let x := 1 for { let x := 1 } 1 {} {} }", DeclarationError, "Variable name x already taken in this scope");
+ CHECK_PARSE_ERROR("{ let x := 1 for {} 1 { let x := 1 } {} }", DeclarationError, "Variable name x already taken in this scope");
+ CHECK_PARSE_ERROR("{ let x := 1 for {} 1 {} { let x := 1 } }", DeclarationError, "Variable name x already taken in this scope");
// Check that body and post are not sub-scopes of each other.
BOOST_CHECK(successParse("{ for {} 1 { let x := 1 } { let x := 1 } }"));
}