mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Reject the creation of interface with the new statement
This commit is contained in:
@@ -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()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user