Skip to content

Commit

Permalink
Update our own tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Aug 8, 2018
1 parent 675957b commit 2b76750
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
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.
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.
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[]);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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) {}
Expand Down

0 comments on commit 2b76750

Please sign in to comment.