aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-22 21:22:49 +0800
committerchriseth <chris@ethereum.org>2017-06-28 17:41:03 +0800
commit73fbaa5a3e31d54a6456642223814fa4c044bad1 (patch)
tree84a09e89b19da3ae54726460b42a15b81ca76a63 /test
parent708d17d13fce9095178962c2ebc3fa17303b72f3 (diff)
downloaddexon-solidity-73fbaa5a3e31d54a6456642223814fa4c044bad1.tar
dexon-solidity-73fbaa5a3e31d54a6456642223814fa4c044bad1.tar.gz
dexon-solidity-73fbaa5a3e31d54a6456642223814fa4c044bad1.tar.bz2
dexon-solidity-73fbaa5a3e31d54a6456642223814fa4c044bad1.tar.lz
dexon-solidity-73fbaa5a3e31d54a6456642223814fa4c044bad1.tar.xz
dexon-solidity-73fbaa5a3e31d54a6456642223814fa4c044bad1.tar.zst
dexon-solidity-73fbaa5a3e31d54a6456642223814fa4c044bad1.zip
Test for var i = 0;
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index c8a04539..14bb0810 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -1781,6 +1781,28 @@ BOOST_AUTO_TEST_CASE(exp_warn_literal_base)
CHECK_SUCCESS(sourceCode);
}
+
+BOOST_AUTO_TEST_CASE(warn_var_from_zero)
+{
+ char const* sourceCode = R"(
+ contract test {
+ function f() returns (uint) {
+ var i = 1;
+ return i;
+ }
+ }
+ )";
+ CHECK_WARNING(sourceCode, "type uint8, which can only hold");
+ sourceCode = R"(
+ contract test {
+ function f() {
+ for (var i = 0; i < msg.data.length; i++) { }
+ }
+ }
+ )";
+ CHECK_WARNING(sourceCode, "type uint8, which can only hold");
+}
+
BOOST_AUTO_TEST_CASE(enum_member_access)
{
char const* text = R"(