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:
+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.
|
||||
|
||||
Reference in New Issue
Block a user