-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
10 additions
and
10 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 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: (173-179): Data location must be "memory" for parameter in function, but "calldata" was given. | ||
// TypeError: (357-363): Data location must be "memory" for parameter in function, but "storage" was given. |
9 changes: 9 additions & 0 deletions
9
test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type_fail.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
3 changes: 1 addition & 2 deletions
3
test/libsolidity/syntaxTests/dataLocations/function_parameters_with_data_location_fine.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +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 {} | ||
function i(uint[] calldata) external pure {} | ||
// No warning for events. | ||
// No data location for events. | ||
event e(uint[]); | ||
} |
1 change: 0 additions & 1 deletion
1
...solidity/syntaxTests/dataLocations/function_return_parameters_with_data_location_fine.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters