aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-03-06 21:11:55 +0800
committerchriseth <c@ethdev.com>2017-03-06 21:12:42 +0800
commit0479f7f16c3c85a52b0ae895006f655da5ac76f3 (patch)
tree6fb59cbcf2e64f999c499a907f4c9656b859df9d
parent5069c58a4be58d406585873a0d86852e17f9f89a (diff)
downloaddexon-solidity-0479f7f16c3c85a52b0ae895006f655da5ac76f3.tar.gz
dexon-solidity-0479f7f16c3c85a52b0ae895006f655da5ac76f3.tar.zst
dexon-solidity-0479f7f16c3c85a52b0ae895006f655da5ac76f3.zip
Test for trying to construct an inconstructible contract before its definition.
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 3b137572..437f2adc 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -5060,6 +5060,24 @@ BOOST_AUTO_TEST_CASE(inconstructible_internal_constructor)
CHECK_ERROR(text, TypeError, "Contract with internal constructor cannot be created directly.");
}
+BOOST_AUTO_TEST_CASE(inconstructible_internal_constructor_inverted)
+{
+ // Previously, the type information for A was not yet available at the point of
+ // "new A".
+ char const* text = R"(
+ contract B {
+ A a;
+ function B() {
+ a = new A(this);
+ }
+ }
+ contract A {
+ function A(address a) internal {}
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Contract with internal constructor cannot be created directly.");
+}
+
BOOST_AUTO_TEST_CASE(constructible_internal_constructor)
{
char const* text = R"(