aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-08-05 01:05:38 +0800
committerchriseth <chris@ethereum.org>2017-08-05 01:08:20 +0800
commiteacc67c43003c26e87f65dae41e448ddeb9fb317 (patch)
treed0828a5282a849ba6f899973d72375ad5b12da50 /test/libsolidity
parent060d229a22c14b7e597107c81283cde40f180f7f (diff)
downloaddexon-solidity-eacc67c43003c26e87f65dae41e448ddeb9fb317.tar.gz
dexon-solidity-eacc67c43003c26e87f65dae41e448ddeb9fb317.tar.zst
dexon-solidity-eacc67c43003c26e87f65dae41e448ddeb9fb317.zip
Three more tests for shadowing.
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index a7aa99df..4d367d3a 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -6134,6 +6134,25 @@ BOOST_AUTO_TEST_CASE(shadowing_builtins_with_variables)
CHECK_WARNING(text, "shadows a builtin symbol");
}
+BOOST_AUTO_TEST_CASE(shadowing_builtins_with_storage_variables)
+{
+ char const* text = R"(
+ contract C {
+ uint msg;
+ }
+ )";
+ CHECK_WARNING(text, "shadows a builtin symbol");
+}
+
+BOOST_AUTO_TEST_CASE(shadowing_builtin_at_global_scope)
+{
+ char const* text = R"(
+ contract msg {
+ }
+ )";
+ CHECK_WARNING(text, "shadows a builtin symbol");
+}
+
BOOST_AUTO_TEST_CASE(shadowing_builtins_with_parameters)
{
char const* text = R"(
@@ -6201,6 +6220,17 @@ BOOST_AUTO_TEST_CASE(function_overload_is_not_shadowing)
CHECK_SUCCESS_NO_WARNINGS(text);
}
+BOOST_AUTO_TEST_CASE(function_override_is_not_shadowing)
+{
+ char const* text = R"(
+ contract D { function f() {} }
+ contract C is D {
+ function f(uint) {}
+ }
+ )";
+ CHECK_SUCCESS_NO_WARNINGS(text);
+}
+
BOOST_AUTO_TEST_CASE(callable_crash)
{
char const* text = R"(