aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityNameAndTypeResolution.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-04-17 22:24:23 +0800
committerchriseth <c@ethdev.com>2015-04-17 22:24:23 +0800
commit6b08b99b5ef319837f9293cca6fd74803fe4688d (patch)
treefe3e39ec2f14e1c52137c9734da36766ba57ba53 /SolidityNameAndTypeResolution.cpp
parent6753e0a8e6796e99ee826c28c7bcbde55348b07d (diff)
parent7571971ca05fd12e3603531044e094ffc0000fb2 (diff)
downloaddexon-solidity-6b08b99b5ef319837f9293cca6fd74803fe4688d.tar
dexon-solidity-6b08b99b5ef319837f9293cca6fd74803fe4688d.tar.gz
dexon-solidity-6b08b99b5ef319837f9293cca6fd74803fe4688d.tar.bz2
dexon-solidity-6b08b99b5ef319837f9293cca6fd74803fe4688d.tar.lz
dexon-solidity-6b08b99b5ef319837f9293cca6fd74803fe4688d.tar.xz
dexon-solidity-6b08b99b5ef319837f9293cca6fd74803fe4688d.tar.zst
dexon-solidity-6b08b99b5ef319837f9293cca6fd74803fe4688d.zip
Merge remote-tracking branch 'ethereum/develop' into sol_overloadingFunctions
Diffstat (limited to 'SolidityNameAndTypeResolution.cpp')
-rw-r--r--SolidityNameAndTypeResolution.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp
index fd439fc8..fdbe46d0 100644
--- a/SolidityNameAndTypeResolution.cpp
+++ b/SolidityNameAndTypeResolution.cpp
@@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(smoke_test)
{
char const* text = "contract test {\n"
" uint256 stateVariable1;\n"
- " function fun(uint256 arg1) { var x; uint256 y; }"
+ " function fun(uint256 arg1) { uint256 y; }"
"}\n";
ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(text), "Parsing and Name Resolving Failed");
}
@@ -1720,6 +1720,16 @@ BOOST_AUTO_TEST_CASE(equal_overload)
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), DeclarationError);
}
+BOOST_AUTO_TEST_CASE(uninitialized_var)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function f() returns (uint) { var x; return 2; }
+ }
+ )";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}