mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
getInheritableMembers() does not look at BaseContracts
- Also adding tests for improper accessing members of other contracts.
This commit is contained in:
parent
03bc87031e
commit
447320a91d
@ -743,6 +743,35 @@ BOOST_AUTO_TEST_CASE(base_class_state_variable_internal_member)
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNamesWithChecks(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class1)
|
||||
{
|
||||
char const* text = "contract Parent1 {\n"
|
||||
" uint256 internal m_aMember1;\n"
|
||||
"}\n"
|
||||
"contract Parent2 is Parent1{\n"
|
||||
" uint256 internal m_aMember2;\n"
|
||||
"}\n"
|
||||
"contract Child is Parent2{\n"
|
||||
" function foo() returns (uint256) { return Parent2.m_aMember1; }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(state_variable_member_of_wrong_class2)
|
||||
{
|
||||
char const* text = "contract Parent1 {\n"
|
||||
" uint256 internal m_aMember1;\n"
|
||||
"}\n"
|
||||
"contract Parent2 is Parent1{\n"
|
||||
" uint256 internal m_aMember2;\n"
|
||||
"}\n"
|
||||
"contract Child is Parent2{\n"
|
||||
" function foo() returns (uint256) { return Child.m_aMember2; }\n"
|
||||
" uint256 public m_aMember3;\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(fallback_function)
|
||||
{
|
||||
char const* text = R"(
|
||||
|
Loading…
Reference in New Issue
Block a user