Reject the creation of interface with the new statement

This commit is contained in:
Alex Beregszaszi
2017-08-21 23:02:18 +01:00
parent 2c2ae74217
commit b25f0c52ac
4 changed files with 36 additions and 0 deletions
@@ -6709,6 +6709,32 @@ BOOST_AUTO_TEST_CASE(experimental_pragma)
// CHECK_ERROR_ALLOW_MULTI(text, SyntaxError, "Duplicate experimental feature name.");
}
BOOST_AUTO_TEST_CASE(reject_interface_creation)
{
char const* text = R"(
interface I {}
contract C {
function f() {
new I();
}
}
)";
CHECK_ERROR(text, TypeError, "Cannot instantiate an interface.");
}
BOOST_AUTO_TEST_CASE(accept_library_creation)
{
char const* text = R"(
library L {}
contract C {
function f() {
new L();
}
}
)";
CHECK_SUCCESS(text);
}
BOOST_AUTO_TEST_SUITE_END()
}