From 044058276ea27b3d43622b28416ad4dc41091a31 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 30 Jun 2017 16:37:08 +0200 Subject: Warn about callcode. --- test/libsolidity/SolidityNameAndTypeResolution.cpp | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'test/libsolidity') diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 169b33d1..d0aee3d0 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -4679,7 +4679,7 @@ BOOST_AUTO_TEST_CASE(unused_return_value_callcode) } } )"; - CHECK_WARNING(text, "Return value of low-level calls not used"); + CHECK_WARNING_ALLOW_MULTI(text, "Return value of low-level calls not used"); } BOOST_AUTO_TEST_CASE(unused_return_value_delegatecall) @@ -4694,6 +4694,31 @@ BOOST_AUTO_TEST_CASE(unused_return_value_delegatecall) CHECK_WARNING(text, "Return value of low-level calls not used"); } +BOOST_AUTO_TEST_CASE(warn_about_callcode) +{ + char const* text = R"( + contract test { + function f() { + var x = address(0x12).callcode; + x; + } + } + )"; + CHECK_WARNING(text, "\"callcode\" has been deprecated in favour"); +} + +BOOST_AUTO_TEST_CASE(no_warn_about_callcode_as_local) +{ + char const* text = R"( + contract test { + function callcode() { + var x = this.callcode; + } + } + )"; + CHECK_SUCCESS_NO_WARNINGS(text); +} + BOOST_AUTO_TEST_CASE(modifier_without_underscore) { char const* text = R"( -- cgit