ABIEncoderV2: Implement calldata structs without dynamically encoded members.

This commit is contained in:
Daniel Kirchner
2019-02-11 15:46:58 +01:00
parent 94607011dc
commit 0e4912a203
16 changed files with 377 additions and 18 deletions
@@ -15,7 +15,3 @@ contract B is A {
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (102-112): Calldata structs are not yet supported.
// TypeError: (146-156): Calldata structs are not yet supported.
// TypeError: (198-208): Calldata structs are not yet supported.
// TypeError: (250-260): Calldata structs are not yet supported.
@@ -6,5 +6,3 @@ contract Test {
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (89-101): Calldata structs are not yet supported.
// TypeError: (131-145): Calldata structs are not yet supported.
@@ -5,4 +5,3 @@ contract Test {
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (89-99): Calldata structs are not yet supported.
@@ -0,0 +1,10 @@
pragma experimental ABIEncoderV2;
contract Test {
struct S { int[3] a; }
function f(S calldata s, int[3] calldata a) external {
s.a = a;
}
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (144-147): Expression has to be an lvalue.
@@ -0,0 +1,8 @@
pragma experimental ABIEncoderV2;
contract Test {
struct S { int a; }
function f(S calldata s) external { s.a = 4; }
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (114-117): Expression has to be an lvalue.
@@ -0,0 +1,9 @@
pragma experimental ABIEncoderV2;
contract C {
struct S { function (uint) external returns (uint) fn; }
function f(S calldata s) external returns (uint256 a) {
return s.fn(42);
}
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
@@ -0,0 +1,12 @@
pragma experimental ABIEncoderV2;
contract Test {
struct S { int a; }
function f(S calldata s) external { s = S(2); }
function g(S calldata s) external { S memory m; s = m; }
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (114-115): Expression has to be an lvalue.
// TypeError: (118-122): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata.
// TypeError: (178-179): Expression has to be an lvalue.
// TypeError: (182-183): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata.