mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update tests and error messages.
This commit is contained in:
parent
59ea19b3b9
commit
22f85d5af3
@ -333,7 +333,7 @@ void ContractCompiler::appendCalldataUnpacker(TypePointers const& _typeParameter
|
|||||||
{
|
{
|
||||||
// stack: v1 v2 ... v(k-1) base_offset current_offset
|
// stack: v1 v2 ... v(k-1) base_offset current_offset
|
||||||
TypePointer type = parameterType->decodingType();
|
TypePointer type = parameterType->decodingType();
|
||||||
solAssert(type, "No decoding type found.");
|
solUnimplementedAssert(type, "No decoding type found.");
|
||||||
if (type->category() == Type::Category::Array)
|
if (type->category() == Type::Category::Array)
|
||||||
{
|
{
|
||||||
auto const& arrayType = dynamic_cast<ArrayType const&>(*type);
|
auto const& arrayType = dynamic_cast<ArrayType const&>(*type);
|
||||||
|
@ -9691,10 +9691,10 @@ BOOST_AUTO_TEST_CASE(return_structs)
|
|||||||
function f() returns (uint x, S s) {
|
function f() returns (uint x, S s) {
|
||||||
x = 7;
|
x = 7;
|
||||||
s.a = 8;
|
s.a = 8;
|
||||||
s.sub = new S[](3);
|
s.sub = new T[](3);
|
||||||
s.sub[0][0] = 9;
|
s.sub[0].x[0] = 9;
|
||||||
s.sub[1][0] = 10;
|
s.sub[1].x[0] = 10;
|
||||||
s.sub[2][1] = 11;
|
s.sub[2].x[1] = 11;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
@ -3283,7 +3283,7 @@ BOOST_AUTO_TEST_CASE(library_memory_struct)
|
|||||||
function f() public returns (S ) {}
|
function f() public returns (S ) {}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_ERROR(text, TypeError, "Internal type is not allowed for public or external functions.");
|
CHECK_SUCCESS(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(using_for_arbitrary_mismatch)
|
BOOST_AUTO_TEST_CASE(using_for_arbitrary_mismatch)
|
||||||
@ -5402,7 +5402,7 @@ BOOST_AUTO_TEST_CASE(return_structs)
|
|||||||
contract C {
|
contract C {
|
||||||
struct S { uint a; T[] sub; }
|
struct S { uint a; T[] sub; }
|
||||||
struct T { uint[] x; }
|
struct T { uint[] x; }
|
||||||
function f() returns (uint x, S s) {
|
function f() returns (uint, S) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
@ -5414,36 +5414,36 @@ BOOST_AUTO_TEST_CASE(return_recursive_structs)
|
|||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract C {
|
contract C {
|
||||||
struct S { uint a; S[] sub; }
|
struct S { uint a; S[] sub; }
|
||||||
function f() returns (uint x, S s) {
|
function f() returns (uint, S) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
success(text);
|
CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(return_recursive_structs2)
|
BOOST_AUTO_TEST_CASE(return_recursive_structs2)
|
||||||
{
|
{
|
||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract C {
|
contract C {
|
||||||
struct S { uint a; S[2] sub; }
|
struct S { uint a; S[2][] sub; }
|
||||||
function f() returns (uint x, S s) {
|
function f() returns (uint, S) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_ERROR(text, TypeError, "recursive data types in external functions.");
|
CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(return_recursive_structs3)
|
BOOST_AUTO_TEST_CASE(return_recursive_structs3)
|
||||||
{
|
{
|
||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
contract C {
|
contract C {
|
||||||
struct S { uint a; S sub; }
|
struct S { uint a; S[][][] sub; }
|
||||||
struct T { S s; }
|
struct T { S s; }
|
||||||
function f() returns (uint x, T t) {
|
function f() returns (uint x, T t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CHECK_ERROR(text, TypeError, "recursive data types in external functions.");
|
CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(address_checksum_type_deduction)
|
BOOST_AUTO_TEST_CASE(address_checksum_type_deduction)
|
||||||
|
Loading…
Reference in New Issue
Block a user