From a3380ea8d0e02da1eb68eb15906015faf4e8bc3c Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 16 Sep 2017 16:10:23 +0100 Subject: Force fallback to be external (experimental 0.5.0 change) --- test/libsolidity/SolidityNameAndTypeResolution.cpp | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/libsolidity') diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 8c271fe1..be3b56f3 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -6691,6 +6691,38 @@ BOOST_AUTO_TEST_CASE(tight_packing_literals) CHECK_WARNING(text, "The type of \"int_const 1\" was inferred as uint8."); } +BOOST_AUTO_TEST_CASE(non_external_fallback) +{ + char const* text = R"( + pragma experimental "v0.5.0"; + contract C { + function () external { } + } + )"; + CHECK_WARNING(text, "Experimental features are turned on."); + text = R"( + pragma experimental "v0.5.0"; + contract C { + function () internal { } + } + )"; + CHECK_ERROR(text, TypeError, "Fallback function must be defined as \"external\"."); + text = R"( + pragma experimental "v0.5.0"; + contract C { + function () private { } + } + )"; + CHECK_ERROR(text, TypeError, "Fallback function must be defined as \"external\"."); + text = R"( + pragma experimental "v0.5.0"; + contract C { + function () public { } + } + )"; + CHECK_ERROR(text, TypeError, "Fallback function must be defined as \"external\"."); +} + BOOST_AUTO_TEST_SUITE_END() } -- cgit