diff --git a/test/libsolidity/syntaxTests/array/concat/bytes_concat_empty_invalid.sol b/test/libsolidity/syntaxTests/array/concat/bytes_concat_empty_invalid.sol new file mode 100644 index 000000000..d956c4663 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/concat/bytes_concat_empty_invalid.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/array/concat/bytes_concat_on_type_info.sol b/test/libsolidity/syntaxTests/array/concat/bytes_concat_on_type_info.sol new file mode 100644 index 000000000..e25bac278 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/concat/bytes_concat_on_type_info.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/array/concat/bytes_concat_on_variable.sol b/test/libsolidity/syntaxTests/array/concat/bytes_concat_on_variable.sol new file mode 100644 index 000000000..325c776e2 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/concat/bytes_concat_on_variable.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/array/concat/bytes_concat_wrong_type.sol b/test/libsolidity/syntaxTests/array/concat/bytes_concat_wrong_type.sol new file mode 100644 index 000000000..753bc291c --- /dev/null +++ b/test/libsolidity/syntaxTests/array/concat/bytes_concat_wrong_type.sol @@ -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.