mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow assignments to structs and mappings.
This commit is contained in:
parent
366514a725
commit
5cecf5699b
@ -244,6 +244,36 @@ BOOST_AUTO_TEST_CASE(balance_invalid)
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(assignment_to_mapping)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" struct str {\n"
|
||||
" mapping(uint=>uint) map;\n"
|
||||
" }\n"
|
||||
" str data;"
|
||||
" function fun() {\n"
|
||||
" var a = data.map;\n"
|
||||
" data.map = a;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(assignment_to_struct)
|
||||
{
|
||||
char const* text = "contract test {\n"
|
||||
" struct str {\n"
|
||||
" mapping(uint=>uint) map;\n"
|
||||
" }\n"
|
||||
" str data;"
|
||||
" function fun() {\n"
|
||||
" var a = data;\n"
|
||||
" data = a;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user