aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-08-05 01:49:25 +0800
committerGitHub <noreply@github.com>2017-08-05 01:49:25 +0800
commitf3af014afd1e6e70ab25ea30bff6f272cc73b0a9 (patch)
treed0828a5282a849ba6f899973d72375ad5b12da50 /test
parentdc0f85c4fb65fa385bb7145c73cc5edaba195483 (diff)
parenteacc67c43003c26e87f65dae41e448ddeb9fb317 (diff)
downloaddexon-solidity-f3af014afd1e6e70ab25ea30bff6f272cc73b0a9.tar
dexon-solidity-f3af014afd1e6e70ab25ea30bff6f272cc73b0a9.tar.gz
dexon-solidity-f3af014afd1e6e70ab25ea30bff6f272cc73b0a9.tar.bz2
dexon-solidity-f3af014afd1e6e70ab25ea30bff6f272cc73b0a9.tar.lz
dexon-solidity-f3af014afd1e6e70ab25ea30bff6f272cc73b0a9.tar.xz
dexon-solidity-f3af014afd1e6e70ab25ea30bff6f272cc73b0a9.tar.zst
dexon-solidity-f3af014afd1e6e70ab25ea30bff6f272cc73b0a9.zip
Merge pull request #2692 from ethereum/shadowing-overload
Do not mark overloaded functions as shadowing
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 4fe52243..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"(
@@ -6190,6 +6209,28 @@ BOOST_AUTO_TEST_CASE(shadowing_builtins_ignores_constructor)
CHECK_SUCCESS_NO_WARNINGS(text);
}
+BOOST_AUTO_TEST_CASE(function_overload_is_not_shadowing)
+{
+ char const* text = R"(
+ contract C {
+ function f() {}
+ function f(uint) {}
+ }
+ )";
+ 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"(