Extract recursive struct tests.

This commit is contained in:
chriseth
2018-04-03 16:27:28 +02:00
committed by Alex Beregszaszi
parent 7753249f64
commit c42caedec2
8 changed files with 53 additions and 93 deletions
@@ -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.
@@ -0,0 +1,8 @@
contract Test {
struct MyStructName {
address addr;
MyStructName x;
}
}
// ----
// TypeError: Recursive struct definition.
@@ -0,0 +1,12 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
MyStructName2 x;
}
struct MyStructName2 {
MyStructName1 x;
}
}
// ----
// TypeError: Recursive struct definition.
@@ -0,0 +1,4 @@
contract Test {
struct S1 { uint a; }
struct S2 { S1 x; S1 y; }
}
@@ -0,0 +1,7 @@
contract Test {
struct MyStructName1 {
address addr;
uint256 count;
mapping(uint => MyStructName1) x;
}
}