Adding syntax tests for bytes.concat.

This commit is contained in:
Djordje Mijovic 2021-02-23 11:57:02 +01:00
parent 840df80dac
commit e7da9f3d52
4 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,7 @@
contract C {
function g() public pure returns (bytes memory) {
return bytes.concat;
}
}
// ----
// TypeError 6359: (82-94): Return argument type function () pure returns (bytes memory) is not implicitly convertible to expected type (type of first return variable) bytes memory.

View File

@ -0,0 +1,8 @@
contract C {
function f() public {
bytes memory a;
bytes memory b = type(bytes).concat(a);
}
}
// ----
// TypeError 4259: (93-98): Invalid type for argument in the function call. A contract type or an integer type is required, but type(bytes) provided.

View File

@ -0,0 +1,8 @@
contract C {
function f() public {
bytes memory a;
bytes memory b = a.concat();
}
}
// ----
// TypeError 9582: (88-96): Member "concat" not found or not visible after argument-dependent lookup in bytes memory.

View File

@ -0,0 +1,14 @@
contract C {
bytes s;
function f(bytes calldata c, string calldata c1) public {
bytes memory a;
bytes16 b;
uint8[] memory num;
bytes1[] memory m;
bytes memory d = bytes.concat(a, b, c, num, s, "abc", m, c1, bytes(c1));
}
}
// ----
// TypeError 8015: (233-236): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint8[] provided.
// TypeError 8015: (248-249): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but bytes1[] provided.
// TypeError 8015: (251-253): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but string provided.