From 203475ef020d8bf0c0334e51580dc798185b2359 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 15 May 2018 12:53:23 +0200 Subject: [PATCH] Adjust tests. --- .../syntaxTests/constants/cyclic_dependency_2.sol | 1 + .../syntaxTests/constants/cyclic_dependency_4.sol | 4 +++- test/libsolidity/syntaxTests/deprecated_functions.sol | 6 +++--- .../syntaxTests/deprecated_functions_050.sol | 1 + ...es_with_unspecified_encoding_internal_functions.sol | 10 +++++----- .../types_with_unspecified_encoding_structs.sol | 1 + .../types_with_unspecified_encoding_structs_abiv2.sol | 1 + .../types_without_encoding_problems.sol | 2 +- .../libsolidity/syntaxTests/tight_packing_literals.sol | 4 ++++ .../syntaxTests/tight_packing_literals_050.sol | 4 ++++ .../syntaxTests/tight_packing_literals_fine.sol | 4 ++++ 11 files changed, 28 insertions(+), 10 deletions(-) diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol index 00f9bb0f1..0728c9625 100644 --- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol +++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_2.sol @@ -5,6 +5,7 @@ contract C { uint constant d = 2 + a; } // ---- +// Warning: (98-110): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type uint256 is not implicitly convertible to expected type bytes memory. // TypeError: (17-40): The value of the constant a has a cyclic dependency via c. // TypeError: (71-111): The value of the constant c has a cyclic dependency via d. // TypeError: (117-140): The value of the constant d has a cyclic dependency via a. diff --git a/test/libsolidity/syntaxTests/constants/cyclic_dependency_4.sol b/test/libsolidity/syntaxTests/constants/cyclic_dependency_4.sol index f01cb98ee..8954e6a30 100644 --- a/test/libsolidity/syntaxTests/constants/cyclic_dependency_4.sol +++ b/test/libsolidity/syntaxTests/constants/cyclic_dependency_4.sol @@ -3,4 +3,6 @@ contract C { uint constant b = 7; uint constant c = 4 + uint(keccak256(d)); uint constant d = 2 + b; -} \ No newline at end of file +} +// ---- +// Warning: (98-110): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type uint256 is not implicitly convertible to expected type bytes memory. diff --git a/test/libsolidity/syntaxTests/deprecated_functions.sol b/test/libsolidity/syntaxTests/deprecated_functions.sol index 57ee484af..9df2b43ca 100644 --- a/test/libsolidity/syntaxTests/deprecated_functions.sol +++ b/test/libsolidity/syntaxTests/deprecated_functions.sol @@ -1,6 +1,6 @@ contract test { function f() pure public { - bytes32 x = sha3(uint8(1)); + bytes32 x = sha3(); x; } function g() public { @@ -8,5 +8,5 @@ contract test { } } // ---- -// Warning: (58-72): "sha3" has been deprecated in favour of "keccak256" -// Warning: (107-117): "suicide" has been deprecated in favour of "selfdestruct" +// Warning: (58-64): "sha3" has been deprecated in favour of "keccak256" +// Warning: (99-109): "suicide" has been deprecated in favour of "selfdestruct" diff --git a/test/libsolidity/syntaxTests/deprecated_functions_050.sol b/test/libsolidity/syntaxTests/deprecated_functions_050.sol index 7e36543bd..92973c5f6 100644 --- a/test/libsolidity/syntaxTests/deprecated_functions_050.sol +++ b/test/libsolidity/syntaxTests/deprecated_functions_050.sol @@ -10,4 +10,5 @@ contract test { } // ---- // TypeError: (88-102): "sha3" has been deprecated in favour of "keccak256" +// TypeError: (88-102): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type uint8 is not implicitly convertible to expected type bytes memory. // TypeError: (137-147): "suicide" has been deprecated in favour of "selfdestruct" diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol index c98d7a577..b94a43911 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_internal_functions.sol @@ -1,11 +1,11 @@ contract C { function f() public pure { - bytes32 h = keccak256(keccak256, f, this.f.gas, block.blockhash); + bytes32 h = keccak256(abi.encodePacked(keccak256, f, this.f.gas, block.blockhash)); h; } } // ---- -// TypeError: (74-83): This type cannot be encoded. -// TypeError: (85-86): This type cannot be encoded. -// TypeError: (88-98): This type cannot be encoded. -// TypeError: (100-115): This type cannot be encoded. +// TypeError: (91-100): This type cannot be encoded. +// TypeError: (102-103): This type cannot be encoded. +// TypeError: (105-115): This type cannot be encoded. +// TypeError: (117-132): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol index fa9102607..05f5db0bd 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol @@ -9,5 +9,6 @@ contract C { } } // ---- +// Warning: (132-144): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. // TypeError: (139-140): This type cannot be encoded. // TypeError: (142-143): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs_abiv2.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs_abiv2.sol index 1187ce4a7..977a7d73f 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs_abiv2.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs_abiv2.sol @@ -12,5 +12,6 @@ contract C { } // ---- // Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. +// Warning: (167-179): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. // TypeError: (174-175): This type cannot be encoded. // TypeError: (177-178): This type cannot be encoded. diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_without_encoding_problems.sol b/test/libsolidity/syntaxTests/specialFunctions/types_without_encoding_problems.sol index c83645486..d890e35f3 100644 --- a/test/libsolidity/syntaxTests/specialFunctions/types_without_encoding_problems.sol +++ b/test/libsolidity/syntaxTests/specialFunctions/types_without_encoding_problems.sol @@ -2,7 +2,7 @@ contract C { uint[3] sarr; function f() view public { uint[3] memory arr; - bytes32 h = keccak256(this.f, arr, sarr); + bytes32 h = keccak256(abi.encodePacked(this.f, arr, sarr)); h; } } diff --git a/test/libsolidity/syntaxTests/tight_packing_literals.sol b/test/libsolidity/syntaxTests/tight_packing_literals.sol index 8258a8a6c..202a32026 100644 --- a/test/libsolidity/syntaxTests/tight_packing_literals.sol +++ b/test/libsolidity/syntaxTests/tight_packing_literals.sol @@ -18,8 +18,12 @@ contract C { // ---- // Warning: (87-88): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (77-89): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory. // Warning: (161-168): "sha3" has been deprecated in favour of "keccak256" // Warning: (166-167): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (161-168): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory. // Warning: (247-248): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (240-249): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory. // Warning: (331-332): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning. +// Warning: (321-333): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory. // Warning: (420-421): The type of "int_const 1" was inferred as uint8. This is probably not desired. Use an explicit type to silence this warning. diff --git a/test/libsolidity/syntaxTests/tight_packing_literals_050.sol b/test/libsolidity/syntaxTests/tight_packing_literals_050.sol index ef6da75dd..fcf8ec50a 100644 --- a/test/libsolidity/syntaxTests/tight_packing_literals_050.sol +++ b/test/libsolidity/syntaxTests/tight_packing_literals_050.sol @@ -19,8 +19,12 @@ contract C { // ---- // TypeError: (117-118): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. +// TypeError: (107-119): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory. // TypeError: (191-198): "sha3" has been deprecated in favour of "keccak256" // TypeError: (196-197): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. +// TypeError: (191-198): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory. // TypeError: (277-278): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. +// TypeError: (270-279): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory. // TypeError: (361-362): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. +// TypeError: (351-363): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type int_const 1 is not implicitly convertible to expected type bytes memory. // TypeError: (450-451): Cannot perform packed encoding for a literal. Please convert it to an explicit type first. diff --git a/test/libsolidity/syntaxTests/tight_packing_literals_fine.sol b/test/libsolidity/syntaxTests/tight_packing_literals_fine.sol index 81e69eb44..e18fbd9f5 100644 --- a/test/libsolidity/syntaxTests/tight_packing_literals_fine.sol +++ b/test/libsolidity/syntaxTests/tight_packing_literals_fine.sol @@ -19,4 +19,8 @@ contract C { } } // ---- +// Warning: (77-96): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type uint8 is not implicitly convertible to expected type bytes memory. // Warning: (168-182): "sha3" has been deprecated in favour of "keccak256" +// Warning: (168-182): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type uint8 is not implicitly convertible to expected type bytes memory. +// Warning: (254-270): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type uint8 is not implicitly convertible to expected type bytes memory. +// Warning: (342-361): This function only accepts a single "bytes" argument. Please use "abi.encodePacked(...)" or a similar function to encode the data. The provided argument of type uint8 is not implicitly convertible to expected type bytes memory.