|
| 1 | +contract C { |
| 2 | + function g(uint[] calldata a) public returns(uint, uint, uint, uint) { |
| 3 | + (uint[] calldata b, ) = true ? (a, 0) : (a, 0); |
| 4 | + return (b.length, b[0], b[1], b[2]); |
| 5 | + } |
| 6 | + |
| 7 | + struct N { |
| 8 | + address addr; |
| 9 | + bytes data; |
| 10 | + } |
| 11 | + |
| 12 | + struct S { |
| 13 | + uint8 a; |
| 14 | + address addr; |
| 15 | + N[] ns; |
| 16 | + bytes data; |
| 17 | + } |
| 18 | + |
| 19 | + function g() public returns(S[] memory) { |
| 20 | + S[] memory ss = new S[](3); |
| 21 | + ss[0].addr = address(this); |
| 22 | + ss[0].a = 123; |
| 23 | + ss[0].ns = new N[](1); |
| 24 | + |
| 25 | + ss[0].ns[0].addr = address(this); |
| 26 | + ss[0].ns[0].data = "abdeff00"; |
| 27 | + |
| 28 | + ss[0].data = "abdeff"; |
| 29 | + |
| 30 | + ss[1].addr = msg.sender; |
| 31 | + ss[1].a = 124; |
| 32 | + ss[1].ns = new N[](2); |
| 33 | + ss[1].ns[0].addr = msg.sender; |
| 34 | + ss[1].ns[0].data = "abdeff10"; |
| 35 | + ss[1].ns[1].addr = msg.sender; |
| 36 | + ss[1].ns[1].data = "abdeff11"; |
| 37 | + ss[1].data = "deabff"; |
| 38 | + |
| 39 | + ss[2].addr = tx.origin; |
| 40 | + ss[2].a = 125; |
| 41 | + ss[2].ns = new N[](3); |
| 42 | + ss[2].ns[0].addr = tx.origin; |
| 43 | + ss[2].ns[0].data = "abdeff20"; |
| 44 | + ss[2].ns[1].addr = tx.origin; |
| 45 | + ss[2].ns[1].data = "abdeff21"; |
| 46 | + ss[2].ns[2].addr = tx.origin; |
| 47 | + ss[2].ns[2].data = "abdeff22"; |
| 48 | + ss[2].data = "deffab"; |
| 49 | + |
| 50 | + return ss; |
| 51 | + } |
| 52 | + |
| 53 | + function g(S[] calldata a) public returns(S[] memory) { |
| 54 | + (S[] calldata b, ) = true ? (a, 0) : (a, 0); |
| 55 | + return b; |
| 56 | + } |
| 57 | +} |
| 58 | +// Two last results and input to last call must all be equal. |
| 59 | +// ---- |
| 60 | +// g(uint256[]): 0x20, 3, 11111111, 2222222, 888888888 -> 3, 11111111, 2222222, 888888888 |
| 61 | +// g() |
| 62 | +// -> |
| 63 | +// 0x20, 0x03, 0x60, 0x01e0, 0x0400, 0x7b, 0xc06afe3a8444fc0004668591e8306bfb9968e79e, 0x80, 0x0140, 0x01, 0x20, 1098512253422041666021416798982440481960491542430, 0x40, 8, 0x6162646566663030000000000000000000000000000000000000000000000000, 6, 44048190233298227891509493227738300628996713231762343836654645076567135354880, 0x7c, 0x1212121212121212121212121212120000000012, 0x80, 0x01e0, 0x02, 0x40, 0xc0, 0x1212121212121212121212121212120000000012, 0x40, 0x08, 0x6162646566663130000000000000000000000000000000000000000000000000, 0x1212121212121212121212121212120000000012, 0x40, 0x08, 0x6162646566663131000000000000000000000000000000000000000000000000, 6, 45410408534123481836474933912542458712564453942015096274585020526880243056640, 0x7d, 0x9292929292929292929292929292929292929292, 0x80, 0x0280, 0x03, 0x60, 0xe0, 0x0160, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663230000000000000000000000000000000000000000000000000, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663231000000000000000000000000000000000000000000000000, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663232000000000000000000000000000000000000000000000000, 6, 45410443150166795494996323125458085338169329380009076603811707127780899553280 |
| 64 | +// g((uint8,address,(address,bytes)[],bytes)[]): |
| 65 | +// 0x20, 0x03, 0x60, 0x01e0, 0x0400, 0x7b, 0xc06afe3a8444fc0004668591e8306bfb9968e79e, 0x80, 0x0140, 0x01, 0x20, 1098512253422041666021416798982440481960491542430, 0x40, 8, 0x6162646566663030000000000000000000000000000000000000000000000000, 6, 44048190233298227891509493227738300628996713231762343836654645076567135354880, 0x7c, 0x1212121212121212121212121212120000000012, 0x80, 0x01e0, 0x02, 0x40, 0xc0, 0x1212121212121212121212121212120000000012, 0x40, 0x08, 0x6162646566663130000000000000000000000000000000000000000000000000, 0x1212121212121212121212121212120000000012, 0x40, 0x08, 0x6162646566663131000000000000000000000000000000000000000000000000, 6, 45410408534123481836474933912542458712564453942015096274585020526880243056640, 0x7d, 0x9292929292929292929292929292929292929292, 0x80, 0x0280, 0x03, 0x60, 0xe0, 0x0160, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663230000000000000000000000000000000000000000000000000, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663231000000000000000000000000000000000000000000000000, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663232000000000000000000000000000000000000000000000000, 6, 45410443150166795494996323125458085338169329380009076603811707127780899553280 |
| 66 | +// -> |
| 67 | +//0x20, 0x03, 0x60, 0x01e0, 0x0400, 0x7b, 0xc06afe3a8444fc0004668591e8306bfb9968e79e, 0x80, 0x0140, 0x01, 0x20, 1098512253422041666021416798982440481960491542430, 0x40, 8, 0x6162646566663030000000000000000000000000000000000000000000000000, 6, 44048190233298227891509493227738300628996713231762343836654645076567135354880, 0x7c, 0x1212121212121212121212121212120000000012, 0x80, 0x01e0, 0x02, 0x40, 0xc0, 0x1212121212121212121212121212120000000012, 0x40, 0x08, 0x6162646566663130000000000000000000000000000000000000000000000000, 0x1212121212121212121212121212120000000012, 0x40, 0x08, 0x6162646566663131000000000000000000000000000000000000000000000000, 6, 45410408534123481836474933912542458712564453942015096274585020526880243056640, 0x7d, 0x9292929292929292929292929292929292929292, 0x80, 0x0280, 0x03, 0x60, 0xe0, 0x0160, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663230000000000000000000000000000000000000000000000000, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663231000000000000000000000000000000000000000000000000, 0x9292929292929292929292929292929292929292, 0x40, 0x08, 0x6162646566663232000000000000000000000000000000000000000000000000, 6, 45410443150166795494996323125458085338169329380009076603811707127780899553280 |
0 commit comments