aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-12 07:45:37 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-22 06:02:18 +0800
commitb25f0c52ac01857a82dda20ec2b646c7ae90cd7d (patch)
tree4148fa30c5386136ab7dc476ff61bba26a2bcc2c /test
parent2c2ae74217521aae93b9c7b058ce8687046c648c (diff)
downloaddexon-solidity-b25f0c52ac01857a82dda20ec2b646c7ae90cd7d.tar.gz
dexon-solidity-b25f0c52ac01857a82dda20ec2b646c7ae90cd7d.tar.zst
dexon-solidity-b25f0c52ac01857a82dda20ec2b646c7ae90cd7d.zip
Reject the creation of interface with the new statement
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index e349bf83..a4fc9c98 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -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()
}