mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow mappings of arrays as arguments and return values of internal functions.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f(mapping(uint => uint)[] storage) external pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-51): Location has to be calldata for external functions (remove the "memory" or "storage" keyword).
|
||||
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function f(mapping(uint => uint)[] storage) internal pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function f(mapping(uint => uint)[] storage) private pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f(mapping(uint => uint)[] storage) public pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (28-51): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword).
|
||||
@@ -0,0 +1,6 @@
|
||||
library L {
|
||||
function f(mapping(uint => uint)[] storage) external pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (27-50): Type is required to live outside storage.
|
||||
@@ -0,0 +1,4 @@
|
||||
library L {
|
||||
function f(mapping(uint => uint)[] storage) internal pure {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
library L {
|
||||
function f(mapping(uint => uint)[] storage) private pure {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
library L {
|
||||
function f(mapping(uint => uint)[] storage) public pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (27-50): Type is required to live outside storage.
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f() external pure returns (mapping(uint=>uint)[] storage m) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (53-84): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword).
|
||||
@@ -0,0 +1,16 @@
|
||||
contract C {
|
||||
mapping(uint=>uint)[] m;
|
||||
function f() internal view returns (mapping(uint=>uint)[] storage) {
|
||||
return m;
|
||||
}
|
||||
function g() private view returns (mapping(uint=>uint)[] storage) {
|
||||
return m;
|
||||
}
|
||||
function h() internal view returns (mapping(uint=>uint)[] storage r) {
|
||||
r = m;
|
||||
}
|
||||
function i() private view returns (mapping(uint=>uint)[] storage r) {
|
||||
(r,r) = (m,m);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f() public pure returns (mapping(uint=>uint)[] storage m) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (51-82): Location has to be memory for publicly visible functions (remove the "storage" or "calldata" keyword).
|
||||
Reference in New Issue
Block a user