From 1682767c6e484bb18b1be58aadcdd81ce6480aef Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 11 Jul 2017 14:51:58 +0100 Subject: Add failing implicit conversion test --- test/libsolidity/SolidityNameAndTypeResolution.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 3c49051e..637ff5cc 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -6182,6 +6182,18 @@ BOOST_AUTO_TEST_CASE(warn_unspecified_storage) CHECK_WARNING(text, "is declared as a storage pointer. Use an explicit \"storage\" keyword to silence this warning"); } +BOOST_AUTO_TEST_CASE(implicit_conversion_disallowed) +{ + char const* text = R"( + contract C { + function f() returns (bytes4) { + uint32 tmp = 1; + return tmp; + } + } + )"; + CHECK_ERROR(text, TypeError, "Return argument type uint32 is not implicitly convertible to expected type (type of first return variable) bytes4."); +} BOOST_AUTO_TEST_SUITE_END() -- cgit