Semantic tests.

This commit is contained in:
Daniel Kirchner 2020-10-16 18:08:01 +02:00
parent 909ce9164a
commit e06d4303fb
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,9 @@
contract C {
function f(bytes calldata x) public returns (C[] memory) {
return abi.decode(x, (C[]));
}
}
// ====
// compileViaYul: also
// ----
// f(bytes): 0x20, 0xA0, 0x20, 3, 0x01, 0x02, 0x03 -> 0x20, 3, 0x01, 0x02, 0x03

View File

@ -0,0 +1,12 @@
pragma experimental ABIEncoderV2;
contract C {
function f(bytes calldata x) public returns (C[] memory) {
return abi.decode(x, (C[]));
}
}
// ====
// compileViaYul: also
// ----
// f(bytes): 0x20, 0xA0, 0x20, 3, 0x01, 0x02, 0x03 -> 0x20, 3, 0x01, 0x02, 0x03
// f(bytes): 0x20, 0x60, 0x20, 1, 0x0102030405060708090a0b0c0d0e0f1011121314 -> 0x20, 1, 0x0102030405060708090a0b0c0d0e0f1011121314
// f(bytes): 0x20, 0x60, 0x20, 1, 0x0102030405060708090a0b0c0d0e0f101112131415 -> FAILURE