From f927da9182f6225d5ab354d4224b842262756a07 Mon Sep 17 00:00:00 2001 From: Kristofer Peterson Date: Thu, 18 Oct 2018 22:53:59 +0100 Subject: Refactor of bool TypeChecker::visit(FunctionCall const& _functionCall). Visit method now cleanly determines if node represents a function call, struct construction or type conversion. Type checking, validation and error message logic is moved to separate methods. --- .../102_duplicate_parameter_names_in_named_args.sol | 2 +- .../583_abi_encode_packed_with_rational_number_constant.sol | 5 +++++ .../584_abi_decode_with_tuple_of_other_than_types.sol | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/583_abi_encode_packed_with_rational_number_constant.sol create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/102_duplicate_parameter_names_in_named_args.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/102_duplicate_parameter_names_in_named_args.sol index fab4beff..88402fa3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/102_duplicate_parameter_names_in_named_args.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/102_duplicate_parameter_names_in_named_args.sol @@ -8,4 +8,4 @@ contract test { } // ---- // Warning: (31-37): This declaration shadows an existing declaration. -// TypeError: (159-160): Duplicate named argument. +// TypeError: (159-160): Duplicate named argument "a". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/583_abi_encode_packed_with_rational_number_constant.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/583_abi_encode_packed_with_rational_number_constant.sol new file mode 100644 index 00000000..6be591f6 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/583_abi_encode_packed_with_rational_number_constant.sol @@ -0,0 +1,5 @@ +contract C { + function f() pure public { abi.encodePacked(0/1); } +} +// ---- +// TypeError: (61-64): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. \ No newline at end of file diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol new file mode 100644 index 00000000..c95eeb35 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol @@ -0,0 +1,5 @@ +contract C { + function f() pure public { abi.decode("", (0)); } +} +// ---- +// TypeError: (60-61): Argument has to be a type name. -- cgit