mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow mapping arguments and return values in internal library functions.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(mapping(uint => uint) storage) external pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// 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.
|
||||
@@ -0,0 +1,7 @@
|
||||
// This is expected to fail now, but may work in the future.
|
||||
contract C {
|
||||
function f(mapping(uint => uint) storage) internal pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (89-110): Type is required to live outside storage.
|
||||
@@ -0,0 +1,7 @@
|
||||
// This is expected to fail now, but may work in the future.
|
||||
contract C {
|
||||
function f(mapping(uint => uint) storage) private pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (89-110): Type is required to live outside storage.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(mapping(uint => uint) storage) public pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// 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.
|
||||
@@ -0,0 +1,6 @@
|
||||
library L {
|
||||
function f(mapping(uint => uint) storage) external pure {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (27-48): 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-48): Type is required to live outside storage.
|
||||
@@ -0,0 +1,10 @@
|
||||
library L
|
||||
{
|
||||
function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) external pure returns(mapping(uint => uint) storage) {
|
||||
return c ? a : b;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (27-58): Type is required to live outside storage.
|
||||
// TypeError: (60-91): Type is required to live outside storage.
|
||||
// TypeError: (123-144): Type is required to live outside storage.
|
||||
@@ -0,0 +1,6 @@
|
||||
library L
|
||||
{
|
||||
function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) internal pure returns(mapping(uint => uint) storage) {
|
||||
return c ? a : b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
library L
|
||||
{
|
||||
function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) private pure returns(mapping(uint => uint) storage) {
|
||||
return c ? a : b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
library L
|
||||
{
|
||||
function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) public pure returns(mapping(uint => uint) storage) {
|
||||
return c ? a : b;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (27-58): Type is required to live outside storage.
|
||||
// TypeError: (60-91): Type is required to live outside storage.
|
||||
// TypeError: (121-142): Type is required to live outside storage.
|
||||
Reference in New Issue
Block a user