diff options
author | chriseth <chris@ethereum.org> | 2018-08-08 01:12:49 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-08-15 00:53:06 +0800 |
commit | 13905a2094d454aa94259412a3cf20a5f8176fff (patch) | |
tree | 40ee6df0b3e735df5f192744caad5910e559c1ec | |
parent | 16de7a04935ecee9c33392965f23dcfc775b799d (diff) | |
download | dexon-solidity-13905a2094d454aa94259412a3cf20a5f8176fff.tar.gz dexon-solidity-13905a2094d454aa94259412a3cf20a5f8176fff.tar.zst dexon-solidity-13905a2094d454aa94259412a3cf20a5f8176fff.zip |
Update tests.
62 files changed, 179 insertions, 113 deletions
diff --git a/test/libsolidity/ASTJSON/function_type.json b/test/libsolidity/ASTJSON/function_type.json index 7b10f0dc..5dbc5b80 100644 --- a/test/libsolidity/ASTJSON/function_type.json +++ b/test/libsolidity/ASTJSON/function_type.json @@ -83,7 +83,7 @@ "id" : 3, "name" : "", "nodeType" : "VariableDeclaration", - "scope" : 16, + "scope" : 5, "src" : "61:4:1", "stateVariable" : false, "storageLocation" : "default", @@ -167,7 +167,7 @@ "id" : 10, "name" : "", "nodeType" : "VariableDeclaration", - "scope" : 16, + "scope" : 12, "src" : "113:4:1", "stateVariable" : false, "storageLocation" : "default", diff --git a/test/libsolidity/ASTJSON/function_type.sol b/test/libsolidity/ASTJSON/function_type.sol index b63bcbf0..bed2742b 100644 --- a/test/libsolidity/ASTJSON/function_type.sol +++ b/test/libsolidity/ASTJSON/function_type.sol @@ -1 +1,3 @@ contract C { function f(function() external payable returns (uint) x) returns (function() external view returns (uint)) {} } + +// ---- diff --git a/test/libsolidity/ASTJSON/function_type_legacy.json b/test/libsolidity/ASTJSON/function_type_legacy.json index 952fd865..af0c42dd 100644 --- a/test/libsolidity/ASTJSON/function_type_legacy.json +++ b/test/libsolidity/ASTJSON/function_type_legacy.json @@ -100,7 +100,7 @@ { "constant" : false, "name" : "", - "scope" : 16, + "scope" : 5, "stateVariable" : false, "storageLocation" : "default", "type" : "uint256", @@ -191,7 +191,7 @@ { "constant" : false, "name" : "", - "scope" : 16, + "scope" : 12, "stateVariable" : false, "storageLocation" : "default", "type" : "uint256", diff --git a/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol b/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol index 5add9106..59328140 100644 --- a/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol +++ b/test/libsolidity/syntaxTests/array/length/array_length_cannot_be_constant_function_parameter.sol @@ -4,4 +4,5 @@ contract C { } } // ---- +// DeclarationError: (28-45): The "constant" keyword can only be used for state variables. // TypeError: (69-72): Invalid array length, expected integer literal or constant expression. diff --git a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type.sol b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type.sol index 2a485581..b23fbb89 100644 --- a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type.sol +++ b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type.sol @@ -1,11 +1,4 @@ library L { struct Nested { uint y; } - // data location specifier in function signature should be optional even if there are multiple choices - function a(function(Nested) external returns (uint)[] storage) external pure {} - function b(function(Nested calldata) external returns (uint)[] storage) external pure {} function c(function(Nested memory) external returns (uint)[] storage) external pure {} - function d(function(Nested storage) external returns (uint)[] storage) external pure {} } - -// ---- -// TypeError: (441-447): Location has to be calldata or memory for function type of external function. Remove the data location keyword to fix this error. diff --git a/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol new file mode 100644 index 00000000..e1ea6989 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol @@ -0,0 +1,9 @@ +library L { + struct Nested { uint y; } + function b(function(Nested calldata) external returns (uint)[] storage) external pure {} + function d(function(Nested storage) external returns (uint)[] storage) external pure {} +} + +// ---- +// TypeError: (66-72): Data location must be "memory" for parameter in function, but "calldata" was given. +// TypeError: (159-165): Data location must be "memory" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol index 0ed954ed..cbcf2a6e 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/external_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function i() external pure returns(uint[]) {} } // ---- -// TypeError: (52-58): Storage location must be "memory" for parameter in external function, but none was given. +// TypeError: (52-58): Data location must be "memory" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol index 807cc064..d914fa5b 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_memory.sol @@ -2,4 +2,4 @@ contract test { function f(bytes memory) external; } // ---- -// TypeError: (31-36): Location has to be calldata for external functions (remove the "memory" or "storage" keyword). +// TypeError: (31-36): Data location must be "calldata" for parameter in external function, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol index 2664dbab..adb7e52e 100644 --- a/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol +++ b/test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_storage.sol @@ -2,4 +2,4 @@ contract test { function f(bytes storage) external; } // ---- -// TypeError: (31-36): Location has to be calldata for external functions (remove the "memory" or "storage" keyword). +// TypeError: (31-36): Data location must be "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_library.sol b/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_library.sol deleted file mode 100644 index 4348482a..00000000 --- a/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_library.sol +++ /dev/null @@ -1,5 +0,0 @@ -library test { - function f(bytes calldata) public; -} -// ---- -// TypeError: (30-35): Location cannot be calldata for non-external functions (remove the "calldata" keyword). diff --git a/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_non_reference_type.sol b/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_non_reference_type.sol index 70f6c5eb..71756ebb 100644 --- a/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_non_reference_type.sol +++ b/test/libsolidity/syntaxTests/dataLocations/function_argument_location_specifier_test_non_reference_type.sol @@ -2,4 +2,4 @@ contract test { function f(bytes4 memory) public; } // ---- -// TypeError: (31-37): Data location can only be given for array or struct types. +// TypeError: (31-37): Data location can only be specified for array, struct or mapping types, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/function_parameters_with_data_location_fine.sol b/test/libsolidity/syntaxTests/dataLocations/function_parameters_with_data_location_fine.sol index da4a7354..2bc7b393 100644 --- a/test/libsolidity/syntaxTests/dataLocations/function_parameters_with_data_location_fine.sol +++ b/test/libsolidity/syntaxTests/dataLocations/function_parameters_with_data_location_fine.sol @@ -1,10 +1,8 @@ contract C { - // Warning for no data location provided can be silenced with storage or memory. function f(uint[] memory, uint[] storage) private pure {} function g(uint[] memory, uint[] storage) internal pure {} function h(uint[] memory) public pure {} - // No warning on external functions, because of default to calldata. - function i(uint[]) external pure {} - // No warning for events. + function i(uint[] calldata) external pure {} + // No data location for events. event e(uint[]); -}
\ No newline at end of file +} diff --git a/test/libsolidity/syntaxTests/dataLocations/function_return_parameters_with_data_location_fine.sol b/test/libsolidity/syntaxTests/dataLocations/function_return_parameters_with_data_location_fine.sol index 047b6b80..ea019198 100644 --- a/test/libsolidity/syntaxTests/dataLocations/function_return_parameters_with_data_location_fine.sol +++ b/test/libsolidity/syntaxTests/dataLocations/function_return_parameters_with_data_location_fine.sol @@ -1,7 +1,6 @@ contract C { - // Shows that the warning for no data location provided can be silenced with storage or memory. function f() private pure returns(uint[] memory, uint[] storage b) { b = b; } function g() internal pure returns(uint[] memory, uint[] storage b) { b = b; } function h() public pure returns(uint[] memory) {} function i() external pure returns(uint[] memory) {} -}
\ No newline at end of file +} diff --git a/test/libsolidity/syntaxTests/dataLocations/function_type_array_as_reference_type.sol b/test/libsolidity/syntaxTests/dataLocations/function_type_array_as_reference_type.sol index a5d6af34..b3856f58 100644 --- a/test/libsolidity/syntaxTests/dataLocations/function_type_array_as_reference_type.sol +++ b/test/libsolidity/syntaxTests/dataLocations/function_type_array_as_reference_type.sol @@ -1,10 +1,8 @@ contract C { struct Nested { uint y; } // ensure that we consider array of function pointers as reference type - function a(function(Nested) external returns (uint)[]) public pure {} - function b(function(Nested) external returns (uint)[] storage) public pure {} - function c(function(Nested) external returns (uint)[] memory) public pure {} - function d(function(Nested) external returns (uint)[] calldata) public pure {} + function b(function(Nested memory) external returns (uint)[] storage) internal pure {} + function c(function(Nested memory) external returns (uint)[] memory) public pure {} + function d(function(Nested memory) external returns (uint)[] calldata) external pure {} } // ---- -// TypeError: (208-250): Location has to be memory for public function. Remove the data location keyword to fix this error. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol index f2740946..771f1525 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_calldata.sol @@ -2,4 +2,4 @@ contract test { function f(bytes calldata) internal; } // ---- -// TypeError: (31-36): Variable cannot be declared as "calldata" (remove the "calldata" keyword). +// TypeError: (31-36): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol index 1ec530a9..f1c4a550 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function g(uint[]) internal pure {} } // ---- -// TypeError: (28-34): Storage location must be "storage" or "memory" for parameter in internal function, but none was given. +// TypeError: (28-34): Data location must be "storage" or "memory" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol index 243151f0..a32995e7 100644 --- a/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/internalFunction/internal_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function g() internal pure returns(uint[]) {} } // ---- -// TypeError: (52-58): Storage location must be "storage" or "memory" for parameter in internal function, but none was given. +// TypeError: (52-58): Data location must be "storage" or "memory" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol new file mode 100644 index 00000000..c20088b7 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_params_no_data_location.sol @@ -0,0 +1,12 @@ +library L { + struct S { uint x; } + function g(uint[2]) external pure {} + function h(uint[]) external pure {} + function i(S) external pure {} + function j(mapping(uint => uint)) external pure {} +} +// ---- +// TypeError: (52-59): Data location must be "storage" or "calldata" for parameter in external function, but none was given. +// TypeError: (93-99): Data location must be "storage" or "calldata" for parameter in external function, but none was given. +// TypeError: (133-134): Data location must be "storage" or "calldata" for parameter in external function, but none was given. +// TypeError: (168-189): Data location must be "storage" or "calldata" for parameter in external function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol new file mode 100644 index 00000000..fa3a7821 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_external_function_return_no_data_location.sol @@ -0,0 +1,12 @@ +library L { + struct S { uint x; } + function g() external pure returns (uint[2]) {} + function h() external pure returns (uint[]) {} + function i() external pure returns (S) {} + function j() external pure returns (mapping(uint => uint)) {} +} +// ---- +// TypeError: (77-84): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (129-135): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (180-181): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (226-247): Data location must be "storage" or "memory" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_parameters_with_data_location_fine.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_parameters_with_data_location_fine.sol deleted file mode 100644 index f778b7ed..00000000 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_parameters_with_data_location_fine.sol +++ /dev/null @@ -1,8 +0,0 @@ -library L { - // Warning for no data location provided can be silenced with storage or memory. - function f(uint[] memory, uint[] storage) private pure {} - function g(uint[] memory, uint[] storage) internal pure {} - function h(uint[] memory) public pure {} - // No warning on external functions, because of default to calldata. - function i(uint[]) external pure {} -}
\ No newline at end of file diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_fine.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_fine.sol new file mode 100644 index 00000000..7a276f95 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_function_with_data_location_fine.sol @@ -0,0 +1,10 @@ +library L { + struct S { uint x; } + function f(uint[] memory, uint[] storage, S storage) private pure + returns (mapping(uint => uint) storage a, S memory b, uint[] storage c) { return (a, b, c); } + function g(uint[] memory, uint[] storage) internal pure + returns (mapping(uint => uint) storage a, S memory b, uint[] storage c) { return (a, b, c); } + function h(uint[] memory, uint[] storage) public pure returns (S storage x) { return x; } + function i(uint[] calldata, uint[] storage) external pure returns (S storage x) {return x; } +} +// ---- diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol new file mode 100644 index 00000000..68c177a8 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_no_data_location.sol @@ -0,0 +1,20 @@ +library L { + struct S { uint x; } + function g() internal pure returns (uint[2]) {} + function h() internal pure returns (uint[]) {} + function i() internal pure returns (S) {} + function j() internal pure returns (mapping(uint => uint)) {} + function gp(uint[2]) internal pure {} + function hp(uint[]) internal pure {} + function ip(S) internal pure {} + function jp(mapping(uint => uint)) internal pure {} +} +// ---- +// TypeError: (77-84): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (129-135): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (180-181): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (226-247): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (268-275): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (310-316): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (351-352): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (387-408): Data location must be "storage" or "memory" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_return_parameters_no_data_location.sol deleted file mode 100644 index 8218dded..00000000 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_internal_function_return_parameters_no_data_location.sol +++ /dev/null @@ -1,5 +0,0 @@ -library L { - function g(uint[]) internal pure {} -} -// ---- -// TypeError: (27-33): Storage location must be "storage" or "memory" for parameter in internal function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol new file mode 100644 index 00000000..35256eae --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_no_data_location.sol @@ -0,0 +1,20 @@ +library L { + struct S { uint x; } + function g() private pure returns (uint[2]) {} + function h() private pure returns (uint[]) {} + function i() private pure returns (S) {} + function j() private pure returns (mapping(uint => uint)) {} + function gp(uint[2]) private pure {} + function hp(uint[]) private pure {} + function ip(S) private pure {} + function jp(mapping(uint => uint)) private pure {} +} +// ---- +// TypeError: (76-83): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (127-133): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (177-178): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (222-243): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (264-271): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (305-311): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (345-346): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (380-401): Data location must be "storage" or "memory" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_parameters_no_data_location.sol deleted file mode 100644 index 79307cd0..00000000 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_private_function_parameters_no_data_location.sol +++ /dev/null @@ -1,5 +0,0 @@ -library L { - function h(uint[]) public pure {} -} -// ---- -// TypeError: (27-33): Storage location must be "storage" or "memory" for parameter in public function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol new file mode 100644 index 00000000..f8f8dcb2 --- /dev/null +++ b/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_no_data_location.sol @@ -0,0 +1,19 @@ +library L { + struct S { uint x; } + function g() private pure returns (uint[2]) {} + function h() private pure returns (uint[]) {} + function i() private pure returns (S) {} + function j() private pure returns (mapping(uint => uint)) {} + function gp(uint[2]) private pure {} + function hp(uint[]) private pure {} + function ip(S) private pure {} + function jp(mapping(uint => uint)) private pure {}} +// ---- +// TypeError: (76-83): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (127-133): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (177-178): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (222-243): Data location must be "storage" or "memory" for return parameter in function, but none was given. +// TypeError: (264-271): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (305-311): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (345-346): Data location must be "storage" or "memory" for parameter in function, but none was given. +// TypeError: (380-401): Data location must be "storage" or "memory" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_return_parameters_no_data_location.sol deleted file mode 100644 index 79307cd0..00000000 --- a/test/libsolidity/syntaxTests/dataLocations/libraries/library_public_function_return_parameters_no_data_location.sol +++ /dev/null @@ -1,5 +0,0 @@ -library L { - function h(uint[]) public pure {} -} -// ---- -// TypeError: (27-33): Storage location must be "storage" or "memory" for parameter in public function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol index 6fa0a152..9a6b8b7c 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol @@ -2,4 +2,4 @@ library test { function f(bytes memory) external; } // ---- -// TypeError: (30-35): Location has to be calldata or storage for external library functions (remove the "memory" keyword). +// TypeError: (30-35): Data location must be "storage" or "calldata" for parameter in external function, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol index 868c5c30..99b89dfc 100644 --- a/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol @@ -2,4 +2,4 @@ library test { function f(bytes calldata) internal pure {} } // ---- -// TypeError: (30-35): Variable cannot be declared as "calldata" (remove the "calldata" keyword). +// TypeError: (30-35): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol index 2f4e2a34..fdd5cbaf 100644 --- a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function f(uint[]) private pure {} } // ---- -// TypeError: (28-34): Storage location must be "storage" or "memory" for parameter in private function, but none was given. +// TypeError: (28-34): Data location must be "storage" or "memory" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol index 5356f944..65ec1bce 100644 --- a/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/privateFunction/private_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function f() private pure returns(uint[]) {} } // ---- -// TypeError: (51-57): Storage location must be "storage" or "memory" for parameter in private function, but none was given. +// TypeError: (51-57): Data location must be "storage" or "memory" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol index cb00199f..efc92cf3 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_calldata.sol @@ -2,4 +2,4 @@ contract test { function f(bytes calldata) public; } // ---- -// TypeError: (31-36): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword). +// TypeError: (31-36): Data location must be "memory" for parameter in function, but "calldata" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol index 9380d9df..b954ea78 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_storage.sol @@ -2,4 +2,4 @@ contract test { function f(bytes storage) public; } // ---- -// TypeError: (31-36): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword). +// TypeError: (31-36): Data location must be "memory" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol index 47d9c47b..f76bd631 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function h(uint[]) public pure {} } // ---- -// TypeError: (28-34): Storage location must be "memory" for parameter in public function, but none was given. +// TypeError: (28-34): Data location must be "memory" for parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol index 42980c51..6b087c34 100644 --- a/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol +++ b/test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_return_parameters_no_data_location.sol @@ -2,4 +2,4 @@ contract C { function h() public pure returns(uint[]) {} } // ---- -// TypeError: (50-56): Storage location must be "memory" for parameter in public function, but none was given. +// TypeError: (50-56): Data location must be "memory" for return parameter in function, but none was given. diff --git a/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_non_reference_type.sol b/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_non_reference_type.sol index ac312685..5f6daf68 100644 --- a/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_non_reference_type.sol +++ b/test/libsolidity/syntaxTests/dataLocations/variable_declaration_location_specifier_test_non_reference_type.sol @@ -7,7 +7,7 @@ contract test { } } // ---- -// TypeError: (48-63): Data location can only be given for array or struct types. -// TypeError: (71-89): Data location can only be given for array or struct types. -// TypeError: (97-111): Data location can only be given for array or struct types. -// TypeError: (119-136): Data location can only be given for array or struct types. +// TypeError: (48-63): Data location can only be specified for array, struct or mapping types, but "storage" was given. +// TypeError: (71-89): Data location can only be specified for array, struct or mapping types, but "storage" was given. +// TypeError: (97-111): Data location can only be specified for array, struct or mapping types, but "memory" was given. +// TypeError: (119-136): Data location can only be specified for array, struct or mapping types, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol b/test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol index eb4f0693..f22afe5e 100644 --- a/test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol +++ b/test/libsolidity/syntaxTests/functionTypes/external_function_to_function_type_calldata_parameter.sol @@ -3,7 +3,7 @@ // when converting to a function type. contract C { function f(function(bytes memory) pure external /*g*/) pure public { } - function callback(bytes) pure external {} + function callback(bytes calldata) pure external {} function g() view public { f(this.callback); } diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/105_constant_input_parameter.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/105_constant_input_parameter.sol index df47aa6b..ba05fcb3 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/105_constant_input_parameter.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/105_constant_input_parameter.sol @@ -2,6 +2,6 @@ contract test { function f(uint[] memory constant a) public { } } // ---- -// TypeError: (31-55): Illegal use of "constant" specifier. +// DeclarationError: (31-55): The "constant" keyword can only be used for state variables. // TypeError: (31-55): Constants of non-value type not yet implemented. // TypeError: (31-55): Uninitialized "constant" variable. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol index 871af310..bc1c4267 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/149_test_for_bug_override_function_with_bytearray_type.sol @@ -1,8 +1,8 @@ contract Vehicle { - function f(bytes) external returns (uint256 r) {r = 1;} + function f(bytes calldata) external returns (uint256 r) {r = 1;} } contract Bike is Vehicle { - function f(bytes) external returns (uint256 r) {r = 42;} + function f(bytes calldata) external returns (uint256 r) {r = 42;} } // ---- -// Warning: (23-78): Function state mutability can be restricted to pure +// Warning: (23-87): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/204_overwrite_memory_location_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/204_overwrite_memory_location_external.sol index 16d71ca4..22d515ea 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/204_overwrite_memory_location_external.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/204_overwrite_memory_location_external.sol @@ -2,4 +2,4 @@ contract C { function f(uint[] memory a) external {} } // ---- -// TypeError: (28-43): Location has to be calldata for external functions (remove the "memory" or "storage" keyword). +// TypeError: (28-43): Data location must be "calldata" for parameter in external function, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol index 99c9827d..3825809c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/205_overwrite_storage_location_external.sol @@ -2,4 +2,4 @@ contract C { function f(uint[] storage a) external {} } // ---- -// TypeError: (28-44): Location has to be calldata for external functions (remove the "memory" or "storage" keyword). +// TypeError: (28-44): Data location must be "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/224_string_bytes_conversion.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/224_string_bytes_conversion.sol index 7b953abb..ed6a9b37 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/224_string_bytes_conversion.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/224_string_bytes_conversion.sol @@ -1,17 +1,11 @@ contract Test { string s; bytes b; - function h(string _s) external { bytes(_s).length; } - function i(string memory _s) internal { bytes(_s).length; } - function j() internal { bytes(s).length; } - function k(bytes _b) external { string(_b); } - function l(bytes memory _b) internal { string(_b); } - function m() internal { string(b); } + function h(string calldata _s) pure external { bytes(_s).length; } + function i(string memory _s) pure internal { bytes(_s).length; } + function j() view internal { bytes(s).length; } + function k(bytes calldata _b) pure external { string(_b); } + function l(bytes memory _b) pure internal { string(_b); } + function m() view internal { string(b); } } // ---- -// Warning: (47-99): Function state mutability can be restricted to pure -// Warning: (104-163): Function state mutability can be restricted to pure -// Warning: (168-210): Function state mutability can be restricted to view -// Warning: (215-260): Function state mutability can be restricted to pure -// Warning: (265-317): Function state mutability can be restricted to pure -// Warning: (322-358): Function state mutability can be restricted to view diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/385_inline_assembly_calldata_variables.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/385_inline_assembly_calldata_variables.sol index 9e324ce1..952b9af6 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/385_inline_assembly_calldata_variables.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/385_inline_assembly_calldata_variables.sol @@ -1,9 +1,9 @@ contract C { - function f(bytes bytesAsCalldata) external { + function f(bytes calldata bytesAsCalldata) external { assembly { let x := bytesAsCalldata } } } // ---- -// TypeError: (102-117): Call data elements cannot be accessed directly. Copy to a local variable first or use "calldataload" or "calldatacopy" with manually determined offsets and sizes. +// TypeError: (111-126): Call data elements cannot be accessed directly. Copy to a local variable first or use "calldataload" or "calldatacopy" with manually determined offsets and sizes. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol index 6e401920..de42ebd7 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/471_unspecified_storage_fail.sol @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (104-107): Data location must be specified as either "memory" or "storage". -// TypeError: (123-131): Data location must be specified as either "memory" or "storage". +// TypeError: (104-107): Data location must be "storage" or "memory" for variable, but none was given. +// TypeError: (123-131): Data location must be "storage" or "memory" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/473_storage_location_non_array_or_struct_disallowed.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/473_storage_location_non_array_or_struct_disallowed.sol index 6c9f50af..fe846aa0 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/473_storage_location_non_array_or_struct_disallowed.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/473_storage_location_non_array_or_struct_disallowed.sol @@ -2,4 +2,4 @@ contract C { function f(uint storage a) public { } } // ---- -// TypeError: (28-42): Data location can only be given for array or struct types. +// TypeError: (28-42): Data location can only be specified for array, struct or mapping types, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/474_storage_location_non_array_or_struct_disallowed_is_not_fatal.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/474_storage_location_non_array_or_struct_disallowed_is_not_fatal.sol index a2f47407..e74db375 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/474_storage_location_non_array_or_struct_disallowed_is_not_fatal.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/474_storage_location_non_array_or_struct_disallowed_is_not_fatal.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError: (28-42): Data location can only be given for array or struct types. +// TypeError: (28-42): Data location can only be specified for array, struct or mapping types, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol index de8b7501..78c38aaf 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol @@ -1,6 +1,6 @@ contract C { - function f(uint[85678901234] a) pure external { + function f(uint[85678901234] calldata a) pure external { } } // ---- -// TypeError: (28-47): Array is too large to be encoded. +// TypeError: (28-56): Array is too large to be encoded. diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params.sol index 72b6ce84..bf78e59c 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_params.sol @@ -2,4 +2,6 @@ contract Foo { function f(uint[] storage constant x, uint[] memory y) internal { } } // ---- -// TypeError: (30-55): Data location has to be "memory" (or unspecified) for constants. +// DeclarationError: (30-55): The "constant" keyword can only be used for state variables. +// TypeError: (30-55): Constants of non-value type not yet implemented. +// TypeError: (30-55): Uninitialized "constant" variable. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/argument_external.sol index 0354893f..02beefec 100644 --- a/test/libsolidity/syntaxTests/types/mapping/argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/argument_external.sol @@ -3,5 +3,4 @@ contract C { } } // ---- -// TypeError: (28-49): Type is required to live outside storage. -// TypeError: (28-49): Internal or recursive type is not allowed for public or external functions. +// TypeError: (28-49): Data location must be "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/argument_public.sol index e4121c7f..3939cf26 100644 --- a/test/libsolidity/syntaxTests/types/mapping/argument_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/argument_public.sol @@ -3,5 +3,4 @@ contract C { } } // ---- -// TypeError: (28-49): Type is required to live outside storage. -// TypeError: (28-49): Internal or recursive type is not allowed for public or external functions. +// TypeError: (28-49): Data location must be "memory" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol index 8dea6907..ef0046d4 100644 --- a/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-51): Location has to be calldata for external functions (remove the "memory" or "storage" keyword). +// TypeError: (28-51): Data location must be "calldata" for parameter in external function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol b/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol index 69dcec01..fb3f25a4 100644 --- a/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/array_argument_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (28-51): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword). +// TypeError: (28-51): Data location must be "memory" for parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol index 7fe74fb6..349a4f97 100644 --- a/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/function_type_argument_external.sol @@ -3,4 +3,5 @@ contract C { } } // ---- +// TypeError: (37-56): Data location must be "memory" for parameter in function, but "storage" was given. // TypeError: (37-56): Internal type cannot be used for external function type. diff --git a/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol index f0f8dea6..108d9861 100644 --- a/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/function_type_return_external.sol @@ -3,4 +3,5 @@ contract C { } } // ---- +// TypeError: (57-76): Data location must be "memory" for return parameter in function, but "storage" was given. // TypeError: (57-76): Internal type cannot be used for external function type. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol index dbe030fb..fe021bd0 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_external.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (53-84): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword). +// TypeError: (53-84): Data location must be "memory" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol index 7dfecf19..1eb9d03b 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_array_return_public.sol @@ -3,4 +3,4 @@ contract C { } } // ---- -// TypeError: (51-82): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword). +// TypeError: (51-82): Data location must be "memory" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol index c73c7f32..deff7c14 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_calldata.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (81-113): Data location for mappings must be specified as "storage". +// TypeError: (81-113): Data location must be "storage" for variable, but "calldata" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol index 85531ae1..e5253f00 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_default.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (81-104): Data location for mappings must be specified as "storage". +// TypeError: (81-104): Data location must be "storage" for variable, but none was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol index 7151e887..600ae669 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_data_location_memory.sol @@ -6,4 +6,4 @@ contract c { } } // ---- -// TypeError: (81-111): Data location for mappings must be specified as "storage". +// TypeError: (81-111): Data location must be "storage" for variable, but "memory" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol index 85121241..17e646ce 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_external.sol @@ -3,5 +3,4 @@ contract C { } } // ---- -// TypeError: (53-82): Type is required to live outside storage. -// TypeError: (53-82): Internal or recursive type is not allowed for public or external functions. +// TypeError: (53-82): Data location must be "memory" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol index 383fa797..cf5ec4ff 100644 --- a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public.sol @@ -3,5 +3,4 @@ contract C { } } // ---- -// TypeError: (51-80): Type is required to live outside storage. -// TypeError: (51-80): Internal or recursive type is not allowed for public or external functions. +// TypeError: (51-80): Data location must be "memory" for return parameter in function, but "storage" was given. diff --git a/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol new file mode 100644 index 00000000..35c3abc9 --- /dev/null +++ b/test/libsolidity/syntaxTests/types/mapping/mapping_return_public_memory.sol @@ -0,0 +1,7 @@ +contract C { + function f() public pure returns (mapping(uint=>uint) memory m) { + } +} +// ---- +// TypeError: (51-79): Type is required to live outside storage. +// TypeError: (51-79): Internal or recursive type is not allowed for public or external functions. |