From 22f85d5af371bb621f8735957b7519d14e3b40c9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 1 Jun 2017 12:26:13 +0200 Subject: [PATCH] Update tests and error messages. --- libsolidity/codegen/ContractCompiler.cpp | 2 +- test/libsolidity/SolidityEndToEndTest.cpp | 8 ++++---- .../SolidityNameAndTypeResolution.cpp | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 514963681..92782b8d7 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -333,7 +333,7 @@ void ContractCompiler::appendCalldataUnpacker(TypePointers const& _typeParameter { // stack: v1 v2 ... v(k-1) base_offset current_offset TypePointer type = parameterType->decodingType(); - solAssert(type, "No decoding type found."); + solUnimplementedAssert(type, "No decoding type found."); if (type->category() == Type::Category::Array) { auto const& arrayType = dynamic_cast(*type); diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 6ea026738..3b657e39d 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -9691,10 +9691,10 @@ BOOST_AUTO_TEST_CASE(return_structs) function f() returns (uint x, S s) { x = 7; s.a = 8; - s.sub = new S[](3); - s.sub[0][0] = 9; - s.sub[1][0] = 10; - s.sub[2][1] = 11; + s.sub = new T[](3); + s.sub[0].x[0] = 9; + s.sub[1].x[0] = 10; + s.sub[2].x[1] = 11; } } )"; diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 037bc9a0c..162190bf7 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -3283,7 +3283,7 @@ BOOST_AUTO_TEST_CASE(library_memory_struct) 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) @@ -5402,7 +5402,7 @@ BOOST_AUTO_TEST_CASE(return_structs) contract C { struct S { uint a; T[] sub; } 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"( contract C { 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) { char const* text = R"( contract C { - struct S { uint a; S[2] sub; } - function f() returns (uint x, S s) { + struct S { uint a; S[2][] sub; } + 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) { char const* text = R"( contract C { - struct S { uint a; S sub; } + struct S { uint a; S[][][] sub; } struct T { S s; } 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)