mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Extract recursive struct tests.
This commit is contained in:
committed by
Alex Beregszaszi
parent
7753249f64
commit
c42caedec2
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
struct S { uint a; S[] sub; }
|
||||
function f() public pure returns (uint, S) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: Internal or recursive type is not allowed for public or external functions.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
struct S { uint a; S[2][] sub; }
|
||||
function f() public pure returns (uint, S) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: Internal or recursive type is not allowed for public or external functions.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
struct S { uint a; S[][][] sub; }
|
||||
struct T { S s; }
|
||||
function f() public pure returns (uint x, T t) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: Internal or recursive type is not allowed for public or external functions.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
contract Test {
|
||||
struct MyStructName {
|
||||
address addr;
|
||||
MyStructName x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: Recursive struct definition.
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
contract Test {
|
||||
struct MyStructName1 {
|
||||
address addr;
|
||||
uint256 count;
|
||||
MyStructName2 x;
|
||||
}
|
||||
struct MyStructName2 {
|
||||
MyStructName1 x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: Recursive struct definition.
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
contract Test {
|
||||
struct S1 { uint a; }
|
||||
struct S2 { S1 x; S1 y; }
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
contract Test {
|
||||
struct MyStructName1 {
|
||||
address addr;
|
||||
uint256 count;
|
||||
mapping(uint => MyStructName1) x;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user