Update tests.

This commit is contained in:
chriseth
2018-08-14 18:53:06 +02:00
parent 16de7a0493
commit 13905a2094
62 changed files with 179 additions and 113 deletions
@@ -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.
@@ -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.
@@ -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 {}
}
@@ -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; }
}
// ----
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.
@@ -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.