mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow internal function types as parameters for public/external library function
This commit is contained in:
+6
@@ -0,0 +1,6 @@
|
||||
library L {
|
||||
// Used to cause internal error
|
||||
function f(function(uint) internal returns (uint)[] memory x) public { }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (63-112): Internal type is not allowed for public or external functions.
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
library L {
|
||||
// Used to cause internal error
|
||||
function g(function(uint) internal returns (uint)[] storage x) public { }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (63-113): Internal type is not allowed for public or external functions.
|
||||
+1
-1
@@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (124-164): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (124-164): Internal type is not allowed for public or external functions.
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ library L {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (27-67): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (27-67): Internal type is not allowed for public or external functions.
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (129-169): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (129-169): Internal type is not allowed for public or external functions.
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
library L {
|
||||
struct S
|
||||
{
|
||||
function(uint) internal returns (uint)[] x;
|
||||
}
|
||||
function f(S storage s) public { }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (104-115): Internal type is not allowed for public or external functions.
|
||||
+1
-1
@@ -6,4 +6,4 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
|
||||
// TypeError: (103-111): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (103-111): Internal type is not allowed for public or external functions.
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
|
||||
// TypeError: (105-113): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (105-113): Only libraries are allowed to use the mapping type in public or external functions.
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
|
||||
// TypeError: (132-140): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (132-140): Only libraries are allowed to use the mapping type in public or external functions.
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
contract Test {
|
||||
struct MyStructName {
|
||||
address addr;
|
||||
MyStructName[] x;
|
||||
}
|
||||
|
||||
function f(MyStructName memory s) public {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (112-133): Recursive type not allowed for public or external contract functions.
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
library Test {
|
||||
struct MyStructName {
|
||||
address addr;
|
||||
MyStructName[] x;
|
||||
}
|
||||
|
||||
function f(MyStructName storage s) public {}
|
||||
}
|
||||
// ----
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
library Test {
|
||||
struct MyStructName {
|
||||
address addr;
|
||||
MyStructName[] x;
|
||||
}
|
||||
|
||||
function f(MyStructName memory _x) public {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
|
||||
// TypeError: (146-168): Recursive structs can only be passed as storage pointers to libraries, not as memory objects to contract functions.
|
||||
+1
-1
@@ -8,4 +8,4 @@ contract Data {
|
||||
}
|
||||
// ----
|
||||
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
|
||||
// TypeError: (63-78): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (63-78): Recursive type not allowed for public or external contract functions.
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
library Test {
|
||||
struct MyStructName {
|
||||
address addr;
|
||||
MyStructName[] x;
|
||||
function() internal y;
|
||||
}
|
||||
|
||||
function f(MyStructName storage s) public {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (142-164): Internal type is not allowed for public or external functions.
|
||||
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (91-99): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (91-99): Recursive type not allowed for public or external contract functions.
|
||||
|
||||
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (94-102): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (94-102): Recursive type not allowed for public or external contract functions.
|
||||
|
||||
@@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (119-129): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (119-129): Recursive type not allowed for public or external contract functions.
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ contract c {
|
||||
}
|
||||
// ----
|
||||
// TypeError: (29-61): Type is required to live outside storage.
|
||||
// TypeError: (29-61): Internal or recursive type is not allowed for public or external functions.
|
||||
// TypeError: (29-61): Only libraries are allowed to use the mapping type in public or external functions.
|
||||
|
||||
Reference in New Issue
Block a user