mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test for trying to construct an inconstructible contract before its definition.
This commit is contained in:
parent
5069c58a4b
commit
0479f7f16c
@ -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"(
|
||||
|
Loading…
Reference in New Issue
Block a user