mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Added support for FunctionType::Kind::StringConcat and functions string.concat
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function g() public pure returns (string memory) {
|
||||
return string.concat;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6359: (83-96): Return argument type function () pure returns (string memory) is not implicitly convertible to expected type (type of first return variable) string memory.
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
contract C {
|
||||
function j() external {
|
||||
string memory a = "hello";
|
||||
string memory b = " world";
|
||||
|
||||
string memory d = string.concat(bytes(a), bytes(b));
|
||||
string memory e = string.concat(a, 0);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9977: (153-161): Invalid type for argument in the string.concat function call. string type is required, but t_bytes_memory_ptr provided.
|
||||
// TypeError 9977: (163-171): Invalid type for argument in the string.concat function call. string type is required, but t_bytes_memory_ptr provided.
|
||||
// TypeError 9977: (217-218): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
contract C {
|
||||
string s;
|
||||
function f(string calldata c, string calldata c1) public {
|
||||
string memory a;
|
||||
bytes16 b;
|
||||
uint8[] memory num;
|
||||
bytes1[] memory m;
|
||||
string memory d = string.concat(a, b, c, num, s, "abc", m, c1, bytes(c1));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9977: (232-233): Invalid type for argument in the string.concat function call. string type is required, but t_bytes16 provided.
|
||||
// TypeError 9977: (238-241): Invalid type for argument in the string.concat function call. string type is required, but t_array$_t_uint8_$dyn_memory_ptr provided.
|
||||
// TypeError 9977: (253-254): Invalid type for argument in the string.concat function call. string type is required, but t_array$_t_bytes1_$dyn_memory_ptr provided.
|
||||
// TypeError 9977: (260-269): Invalid type for argument in the string.concat function call. string type is required, but t_bytes_calldata_ptr provided.
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
string.concat([], [], []);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6378: (61-63): Unable to deduce common type for array elements.
|
||||
@@ -0,0 +1,40 @@
|
||||
contract C {
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
|
||||
enum E {A, B, C}
|
||||
|
||||
mapping(uint => E) m;
|
||||
|
||||
function f() public {
|
||||
bool b;
|
||||
uint u;
|
||||
uint8 u8;
|
||||
address a;
|
||||
address payable ap;
|
||||
function () external fext;
|
||||
function () internal fint;
|
||||
uint[] memory uDynamic;
|
||||
uint[2] memory uStatic;
|
||||
C c;
|
||||
S memory s;
|
||||
E e;
|
||||
|
||||
string.concat(b, u, u8, a, ap, fext, fint, uDynamic, uStatic, c, s, e, m);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9977: (426-427): Invalid type for argument in the string.concat function call. string type is required, but t_bool provided.
|
||||
// TypeError 9977: (429-430): Invalid type for argument in the string.concat function call. string type is required, but t_uint256 provided.
|
||||
// TypeError 9977: (432-434): Invalid type for argument in the string.concat function call. string type is required, but t_uint8 provided.
|
||||
// TypeError 9977: (436-437): Invalid type for argument in the string.concat function call. string type is required, but t_address provided.
|
||||
// TypeError 9977: (439-441): Invalid type for argument in the string.concat function call. string type is required, but t_address_payable provided.
|
||||
// TypeError 9977: (443-447): Invalid type for argument in the string.concat function call. string type is required, but t_function_external_nonpayable$__$returns$__$ provided.
|
||||
// TypeError 9977: (449-453): Invalid type for argument in the string.concat function call. string type is required, but t_function_internal_nonpayable$__$returns$__$ provided.
|
||||
// TypeError 9977: (455-463): Invalid type for argument in the string.concat function call. string type is required, but t_array$_t_uint256_$dyn_memory_ptr provided.
|
||||
// TypeError 9977: (465-472): Invalid type for argument in the string.concat function call. string type is required, but t_array$_t_uint256_$2_memory_ptr provided.
|
||||
// TypeError 9977: (474-475): Invalid type for argument in the string.concat function call. string type is required, but t_contract$_C_$86 provided.
|
||||
// TypeError 9977: (477-478): Invalid type for argument in the string.concat function call. string type is required, but t_struct$_S_$4_memory_ptr provided.
|
||||
// TypeError 9977: (480-481): Invalid type for argument in the string.concat function call. string type is required, but t_enum$_E_$8 provided.
|
||||
// TypeError 9977: (483-484): Invalid type for argument in the string.concat function call. string type is required, but t_mapping$_t_uint256_$_t_enum$_E_$8_$ provided.
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
contract C {
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
|
||||
enum E {A, B, C}
|
||||
|
||||
function f() public {
|
||||
string.concat(
|
||||
false,
|
||||
1,
|
||||
1e10,
|
||||
1e-10,
|
||||
0.1,
|
||||
0x1234567,
|
||||
0x11112222333344445555666677778888999900, // One byte less than an address
|
||||
0x1111222233334444555566667777888899990000, // Address
|
||||
0x111122223333444455556666777788889999000011, // One byte more than an address
|
||||
0x00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff, // exactly 32 bytes
|
||||
-0x0000000000000000000000000000000000000000000000000000000000000001, // exactly 32 bytes
|
||||
bytes(bytes32(0x00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff))[:],
|
||||
f,
|
||||
(),
|
||||
(0, 0),
|
||||
[0],
|
||||
[0][:],
|
||||
[0][0],
|
||||
new C(),
|
||||
S(0),
|
||||
E.A
|
||||
);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9640: (698-780): Explicit type conversion not allowed from "bytes32" to "bytes memory".
|
||||
// TypeError 1227: (698-783): Index range access is only supported for dynamic calldata arrays.
|
||||
// TypeError 1227: (865-871): Index range access is only supported for dynamic calldata arrays.
|
||||
// TypeError 9977: (134-139): Invalid type for argument in the string.concat function call. string type is required, but t_bool provided.
|
||||
// TypeError 9977: (153-154): Invalid type for argument in the string.concat function call. string type is required, but t_rational_1_by_1 provided.
|
||||
// TypeError 9977: (168-172): Invalid type for argument in the string.concat function call. string type is required, but t_rational_10000000000_by_1 provided.
|
||||
// TypeError 9977: (186-191): Invalid type for argument in the string.concat function call. string type is required, but t_rational_1_by_10000000000 provided.
|
||||
// TypeError 9977: (205-208): Invalid type for argument in the string.concat function call. string type is required, but t_rational_1_by_10 provided.
|
||||
// TypeError 9977: (222-231): Invalid type for argument in the string.concat function call. string type is required, but t_rational_19088743_by_1 provided.
|
||||
// TypeError 9977: (245-285): Invalid type for argument in the string.concat function call. string type is required, but t_rational_380605192295934637532253317235440047844071680_by_1 provided.
|
||||
// TypeError 9977: (336-378): Invalid type for argument in the string.concat function call. string type is required, but t_address provided.
|
||||
// TypeError 9977: (405-449): Invalid type for argument in the string.concat function call. string type is required, but t_rational_24943341882306372405313753398341798975509081620497_by_1 provided.
|
||||
// TypeError 9977: (496-562): Invalid type for argument in the string.concat function call. string type is required, but t_rational_30272441630670900764332283662402067049651745785153368133042924362431065855_by_1 provided.
|
||||
// TypeError 9977: (597-664): Invalid type for argument in the string.concat function call. string type is required, but t_rational_minus_1_by_1 provided.
|
||||
// TypeError 9977: (698-783): Invalid type for argument in the string.concat function call. string type is required, but t_bytes_memory_ptr_slice provided.
|
||||
// TypeError 9977: (797-798): Invalid type for argument in the string.concat function call. string type is required, but t_function_internal_nonpayable$__$returns$__$ provided.
|
||||
// TypeError 9977: (812-814): Invalid type for argument in the string.concat function call. string type is required, but t_tuple$__$ provided.
|
||||
// TypeError 9977: (828-834): Invalid type for argument in the string.concat function call. string type is required, but t_tuple$_t_rational_0_by_1_$_t_rational_0_by_1_$ provided.
|
||||
// TypeError 9977: (848-851): Invalid type for argument in the string.concat function call. string type is required, but t_array$_t_uint8_$1_memory_ptr provided.
|
||||
// TypeError 9977: (865-871): Invalid type for argument in the string.concat function call. string type is required, but t_array$_t_uint8_$1_memory_ptr_slice provided.
|
||||
// TypeError 9977: (885-891): Invalid type for argument in the string.concat function call. string type is required, but t_uint8 provided.
|
||||
// TypeError 9977: (905-912): Invalid type for argument in the string.concat function call. string type is required, but t_contract$_C_$61 provided.
|
||||
// TypeError 9977: (926-930): Invalid type for argument in the string.concat function call. string type is required, but t_struct$_S_$4_memory_ptr provided.
|
||||
// TypeError 9977: (944-947): Invalid type for argument in the string.concat function call. string type is required, but t_enum$_E_$8 provided.
|
||||
@@ -0,0 +1,33 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
string.concat(
|
||||
0,
|
||||
-0,
|
||||
0.0,
|
||||
-0.0,
|
||||
0e10,
|
||||
-0e10,
|
||||
0e-10,
|
||||
-0e-10,
|
||||
(0),
|
||||
0x00,
|
||||
-0x00,
|
||||
0x0000000000000000000000000000000000000000000000000000000000000000, // exactly 32 bytes
|
||||
-0x0000000000000000000000000000000000000000000000000000000000000000 // exactly 32 bytes
|
||||
);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9977: (79-80): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (94-96): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (110-113): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (127-131): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (145-149): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (163-168): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (182-187): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (201-207): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (221-224): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (238-242): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (256-261): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (275-341): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
// TypeError 9977: (375-442): Invalid type for argument in the string.concat function call. string type is required, but t_rational_0_by_1 provided.
|
||||
Reference in New Issue
Block a user