added type check if the type of the var decl is one of base contract type

This commit is contained in:
LianaHus
2015-09-10 17:17:13 +02:00
parent 30e89b3d9a
commit 47e42430f2
4 changed files with 24 additions and 14 deletions
-11
View File
@@ -5230,17 +5230,6 @@ BOOST_AUTO_TEST_CASE(storage_string_as_mapping_key_without_variable)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(2)));
}
BOOST_AUTO_TEST_CASE(string_as_mapping_key)
{
char const* sourceCode = R"(
contract Test {
function f() { var x = new Test(); }
}
)";
compileAndRun(sourceCode, 0, "Test");
}
BOOST_AUTO_TEST_SUITE_END()
}
@@ -2194,6 +2194,18 @@ BOOST_AUTO_TEST_CASE(string_bytes_conversion)
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
}
BOOST_AUTO_TEST_CASE(creating_contract_within_the_contract)
{
char const* sourceCode = R"(
contract Test {
function f() { var x = new Test(); }
}
)";
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
}
BOOST_AUTO_TEST_SUITE_END()
}