diff options
author | chriseth <chris@ethereum.org> | 2018-02-15 18:30:32 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-27 19:17:25 +0800 |
commit | 88a5c66f4a7efae6d78ce2e04144219656bb9da0 (patch) | |
tree | a2aaf6ea3dd359077ad3024b5938a061c665f439 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 6b9dda06f3d85344a70efb2f868760a0dde9dc45 (diff) | |
download | dexon-solidity-88a5c66f4a7efae6d78ce2e04144219656bb9da0.tar.gz dexon-solidity-88a5c66f4a7efae6d78ce2e04144219656bb9da0.tar.zst dexon-solidity-88a5c66f4a7efae6d78ce2e04144219656bb9da0.zip |
Only active variables at the point of their declaration.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 3882e4ea..7bae3cd6 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -284,6 +284,26 @@ BOOST_AUTO_TEST_CASE(conditional_expression_functions) ABI_CHECK(callContractFunction("f(bool)", false), encodeArgs(u256(2))); } +BOOST_AUTO_TEST_CASE(C99_scoping_activation) +{ + char const* sourceCode = R"( + pragma experimental "v0.5.0"; + contract test { + function f() pure public returns (uint) { + uint x = 7; + { + x = 3; // This should still assign to the outer variable + uint x; + x = 4; // This should assign to the new one + } + return x; + } + } + )"; + compileAndRun(sourceCode); + ABI_CHECK(callContractFunction("f()"), encodeArgs(3)); +} + BOOST_AUTO_TEST_CASE(recursive_calls) { char const* sourceCode = R"( |