Merge pull request #5526 from ethereum/fixGetterNewCoder

Fix: Disallow structs in getters for old encoder.
This commit is contained in:
chriseth
2018-11-28 17:05:52 +01:00
committed by GitHub
6 changed files with 67 additions and 13 deletions
@@ -0,0 +1,7 @@
contract C {
struct Y {
uint a;
uint b;
}
mapping(uint256 => Y) public m;
}
@@ -0,0 +1,11 @@
contract C {
struct Y {
uint b;
}
struct X {
Y a;
}
mapping(uint256 => X) public m;
}
// ----
// TypeError: (88-118): The following types are only supported for getters in the new experimental ABI encoder: struct C.Y memory. Either remove "public" or use "pragma experimental ABIEncoderV2;" to enable the feature.
@@ -0,0 +1,8 @@
contract C {
struct Y {
Y[] x;
}
mapping(uint256 => Y) public m;
}
// ----
// TypeError: (53-83): Internal or recursive type is not allowed for public state variables.
@@ -0,0 +1,6 @@
contract C {
struct Y {
uint b;
}
mapping(uint256 => Y) public m;
}