mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #13210 from timweri/display_human_readable_type_name_in_conversion
Display human readable type name in error messages
This commit is contained in:
+1
-1
@@ -18,4 +18,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2443: (B:91-100): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2443: (B:91-100): The type of this parameter, struct C.Item memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
+1
-1
@@ -18,4 +18,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2443: (B:119-129): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2443: (B:119-129): The type of this parameter, struct C.Item memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
+1
-1
@@ -20,4 +20,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2443: (B:166-175): The type of this parameter, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2443: (B:166-175): The type of this parameter, struct C.Item memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
+1
-1
@@ -14,4 +14,4 @@ contract D {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2428: (B:85-105): The type of return parameter 1, string[], is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2428: (B:85-105): The type of return parameter 1, string[] memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
+1
-1
@@ -18,4 +18,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2428: (B:90-112): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2428: (B:90-112): The type of return parameter 1, struct C.Item memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
+1
-1
@@ -18,4 +18,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2428: (B:90-112): The type of return parameter 1, struct C.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2428: (B:90-112): The type of return parameter 1, struct C.Item memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
@@ -17,4 +17,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2443: (B:94-104): The type of this parameter, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2443: (B:94-104): The type of this parameter, struct L.Item memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
+1
-1
@@ -20,4 +20,4 @@ contract D {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2428: (B:106-117): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2428: (B:106-117): The type of return parameter 1, struct L.Item memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
+1
-1
@@ -18,4 +18,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2428: (B:90-97): The type of return parameter 1, struct L.Item, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2428: (B:90-97): The type of return parameter 1, struct L.Item memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ contract C {
|
||||
// ====
|
||||
// EVMVersion: <byzantium
|
||||
// ----
|
||||
// TypeError 9574: (166-196): Type inaccessible dynamic type is not implicitly convertible to expected type uint256[] memory[] memory.
|
||||
// TypeError 9574: (166-196): Type inaccessible dynamic type is not implicitly convertible to expected type uint256[][] memory.
|
||||
|
||||
@@ -29,4 +29,4 @@ contract C is B {
|
||||
{}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2428: (B:80-102): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2428: (B:80-102): The type of return parameter 1, struct Data memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
@@ -30,4 +30,4 @@ contract C is B {
|
||||
{}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2428: (B:80-102): The type of return parameter 1, struct Data, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
// TypeError 2428: (B:80-102): The type of return parameter 1, struct Data memory, is only supported in ABI coder v2. Use "pragma abicoder v2;" to enable the feature.
|
||||
|
||||
@@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4259: (93-98): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(bytes) provided.
|
||||
// TypeError 4259: (93-98): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(bytes storage pointer) provided.
|
||||
|
||||
+3
-3
@@ -9,6 +9,6 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// 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.
|
||||
// TypeError 8015: (233-236): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint8[] memory provided.
|
||||
// TypeError 8015: (248-249): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but bytes1[] memory provided.
|
||||
// TypeError 8015: (251-253): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but string calldata provided.
|
||||
|
||||
@@ -32,9 +32,9 @@ contract C {
|
||||
// TypeError 8015: (438-440): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but address payable provided.
|
||||
// TypeError 8015: (442-446): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but function () external provided.
|
||||
// TypeError 8015: (448-452): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but function () provided.
|
||||
// TypeError 8015: (454-462): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint256[] provided.
|
||||
// TypeError 8015: (464-471): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint256[2] provided.
|
||||
// TypeError 8015: (454-462): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint256[] memory provided.
|
||||
// TypeError 8015: (464-471): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint256[2] memory provided.
|
||||
// TypeError 8015: (473-474): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but contract C provided.
|
||||
// TypeError 8015: (476-477): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but struct C.S provided.
|
||||
// TypeError 8015: (476-477): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but struct C.S memory provided.
|
||||
// TypeError 8015: (479-480): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but enum C.E provided.
|
||||
// TypeError 8015: (482-483): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but mapping(uint256 => enum C.E) provided.
|
||||
|
||||
+4
-4
@@ -46,13 +46,13 @@ contract C {
|
||||
// TypeError 8015: (404-448): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but int_const 2494...(42 digits omitted)...0497 provided.
|
||||
// TypeError 8015: (495-561): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but int_const 3027...(66 digits omitted)...5855 provided.
|
||||
// TypeError 8015: (596-663): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but int_const -1 provided.
|
||||
// TypeError 8015: (697-782): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but bytes slice provided.
|
||||
// TypeError 8015: (697-782): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but bytes memory slice provided.
|
||||
// TypeError 8015: (796-797): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but function () provided.
|
||||
// TypeError 8015: (811-813): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but tuple() provided.
|
||||
// TypeError 8015: (827-833): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but tuple(int_const 0,int_const 0) provided.
|
||||
// TypeError 8015: (847-850): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint8[1] provided.
|
||||
// TypeError 8015: (864-870): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint8[1] slice provided.
|
||||
// TypeError 8015: (847-850): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint8[1] memory provided.
|
||||
// TypeError 8015: (864-870): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint8[1] memory slice provided.
|
||||
// TypeError 8015: (884-890): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but uint8 provided.
|
||||
// TypeError 8015: (904-911): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but contract C provided.
|
||||
// TypeError 8015: (925-929): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but struct C.S provided.
|
||||
// TypeError 8015: (925-929): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but struct C.S memory provided.
|
||||
// TypeError 8015: (943-946): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but enum C.E provided.
|
||||
|
||||
@@ -3,4 +3,4 @@ library L {
|
||||
function f(mapping(uint => uint)[2] memory a) external pure returns (mapping(uint => uint)[2] memory) {}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4061: (61-94): Type mapping(uint256 => uint256)[2] is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (61-94): Type mapping(uint256 => uint256)[2] memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
interface MyInterface {
|
||||
error MyCustomError(uint256, bool);
|
||||
}
|
||||
|
||||
contract MyContract {
|
||||
function f(bytes4 arg) public {}
|
||||
function test() public {
|
||||
f(MyInterface.MyCustomError);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9553: (165-190): Invalid type for argument in function call. Invalid implicit conversion from error MyCustomError(uint256,bool) to bytes4 requested.
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
interface MyInterface {
|
||||
error MyCustomError(uint256, bool);
|
||||
}
|
||||
|
||||
contract Test {
|
||||
function test() public returns(bytes4) {
|
||||
return (MyInterface.MyCustomError);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6359: (143-170): Return argument type error MyCustomError(uint256,bool) is not implicitly convertible to expected type (type of first return variable) bytes4.
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
contract MyContract {
|
||||
event MyCustomEvent(uint256);
|
||||
function f(bytes4 arg) public {}
|
||||
function test() public {
|
||||
f(MyCustomEvent);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9553: (132-145): Invalid type for argument in function call. Invalid implicit conversion from event MyCustomEvent(uint256) to bytes4 requested.
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
contract Test {
|
||||
event MyCustomEvent(uint256);
|
||||
|
||||
function test() public returns(bytes4) {
|
||||
return (MyCustomEvent);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6359: (111-126): Return argument type event MyCustomEvent(uint256) is not implicitly convertible to expected type (type of first return variable) bytes4.
|
||||
+1
-1
@@ -6,4 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6359: (122-147): Return argument type string memory[5] memory is not implicitly convertible to expected type (type of first return variable) string calldata[5] calldata.
|
||||
// TypeError 6359: (122-147): Return argument type string[5] memory is not implicitly convertible to expected type (type of first return variable) string[5] calldata.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
error MyCustomError(uint, bool);
|
||||
contract C {
|
||||
function f() public {
|
||||
bytes memory a;
|
||||
bytes memory b = type(MyCustomError).concat(a);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4259: (126-139): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but error MyCustomError(uint256,bool) provided.
|
||||
@@ -0,0 +1,8 @@
|
||||
error MyCustomError(uint, bool);
|
||||
contract Test {
|
||||
function f() public {
|
||||
abi.decode(MyCustomError, (bool));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 1956: (94-107): The first argument to "abi.decode" must be implicitly convertible to bytes memory or bytes calldata, but is of type error MyCustomError(uint256,bool).
|
||||
@@ -0,0 +1,10 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
bytes.concat(MyCustomError, MyCustomError);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 8015: (99-112): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but error MyCustomError(uint256,bool) provided.
|
||||
// TypeError 8015: (114-127): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but error MyCustomError(uint256,bool) provided.
|
||||
@@ -0,0 +1,40 @@
|
||||
error MyCustomError(uint, bool);
|
||||
contract C {
|
||||
enum testEnum { choice1, choice2, choice3 }
|
||||
|
||||
function f1(uint8, uint8) external {}
|
||||
function f2(uint32) external {}
|
||||
function f3(uint) external {}
|
||||
function g1(bytes memory) external {}
|
||||
function g2(bytes32) external {}
|
||||
function h(string memory) external {}
|
||||
function i(bool) external {}
|
||||
function j(address) external {}
|
||||
function k(address payable) external {}
|
||||
function l(testEnum) external {}
|
||||
|
||||
function f() pure public {
|
||||
abi.encodeCall(this.f1, (MyCustomError, MyCustomError));
|
||||
abi.encodeCall(this.f2, (MyCustomError));
|
||||
abi.encodeCall(this.f3, (MyCustomError));
|
||||
abi.encodeCall(this.g1, (MyCustomError));
|
||||
abi.encodeCall(this.g2, (MyCustomError));
|
||||
abi.encodeCall(this.h, (MyCustomError));
|
||||
abi.encodeCall(this.i, (MyCustomError));
|
||||
abi.encodeCall(this.j, (MyCustomError));
|
||||
abi.encodeCall(this.k, (MyCustomError));
|
||||
abi.encodeCall(this.l, (MyCustomError));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5407: (543-556): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "uint8".
|
||||
// TypeError 5407: (558-571): Cannot implicitly convert component at position 1 from "error MyCustomError(uint256,bool)" to "uint8".
|
||||
// TypeError 5407: (607-622): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "uint32".
|
||||
// TypeError 5407: (657-672): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "uint256".
|
||||
// TypeError 5407: (707-722): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "bytes memory".
|
||||
// TypeError 5407: (757-772): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "bytes32".
|
||||
// TypeError 5407: (806-821): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "string memory".
|
||||
// TypeError 5407: (855-870): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "bool".
|
||||
// TypeError 5407: (904-919): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "address".
|
||||
// TypeError 5407: (953-968): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "address payable".
|
||||
// TypeError 5407: (1002-1017): Cannot implicitly convert component at position 0 from "error MyCustomError(uint256,bool)" to "enum C.testEnum".
|
||||
@@ -0,0 +1,47 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
MyCustomError << MyCustomError;
|
||||
MyCustomError >> MyCustomError;
|
||||
MyCustomError ^ MyCustomError;
|
||||
MyCustomError | MyCustomError;
|
||||
MyCustomError & MyCustomError;
|
||||
|
||||
MyCustomError * MyCustomError;
|
||||
MyCustomError / MyCustomError;
|
||||
MyCustomError % MyCustomError;
|
||||
MyCustomError + MyCustomError;
|
||||
MyCustomError - MyCustomError;
|
||||
|
||||
MyCustomError == MyCustomError;
|
||||
MyCustomError != MyCustomError;
|
||||
MyCustomError >= MyCustomError;
|
||||
MyCustomError <= MyCustomError;
|
||||
MyCustomError < MyCustomError;
|
||||
MyCustomError > MyCustomError;
|
||||
|
||||
MyCustomError || MyCustomError;
|
||||
MyCustomError && MyCustomError;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 2271: (86-116): Operator << not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (126-156): Operator >> not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (166-195): Operator ^ not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (205-234): Operator | not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (244-273): Operator & not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (284-313): Operator * not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (323-352): Operator / not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (362-391): Operator % not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (401-430): Operator + not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (440-469): Operator - not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (480-510): Operator == not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (520-550): Operator != not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (560-590): Operator >= not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (600-630): Operator <= not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (640-669): Operator < not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (679-708): Operator > not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (719-749): Operator || not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
// TypeError 2271: (759-789): Operator && not compatible with types error MyCustomError(uint256,bool) and error MyCustomError(uint256,bool)
|
||||
@@ -0,0 +1,19 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
uint a;
|
||||
MyCustomError += 1;
|
||||
MyCustomError -= 1;
|
||||
a += MyCustomError;
|
||||
a -= MyCustomError;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 4247: (102-115): Expression has to be an lvalue.
|
||||
// TypeError 7366: (102-120): Operator += not compatible with types error MyCustomError(uint256,bool) and int_const 1
|
||||
// TypeError 4247: (130-143): Expression has to be an lvalue.
|
||||
// TypeError 7366: (130-148): Operator -= not compatible with types error MyCustomError(uint256,bool) and int_const 1
|
||||
// TypeError 7366: (158-176): Operator += not compatible with types uint256 and error MyCustomError(uint256,bool)
|
||||
// TypeError 7366: (186-204): Operator -= not compatible with types uint256 and error MyCustomError(uint256,bool)
|
||||
@@ -0,0 +1,11 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
MyCustomError++;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 4247: (86-99): Expression has to be an lvalue.
|
||||
// TypeError 9767: (86-101): Unary operator ++ cannot be applied to type error MyCustomError(uint256,bool)
|
||||
@@ -0,0 +1,9 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract B {
|
||||
function f() mod1(MyCustomError) public { }
|
||||
modifier mod1(uint a) { if (a > 0) _; }
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 4649: (69-82): Invalid type for argument in modifier invocation. Invalid implicit conversion from error MyCustomError(uint256,bool) to uint256 requested.
|
||||
@@ -0,0 +1,10 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract C {
|
||||
function f() public returns (uint8, uint8, int) {
|
||||
return ((MyCustomError, 8, MyCustomError));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 5992: (116-151): Return argument type tuple(error MyCustomError(uint256,bool),int_const 8,error MyCustomError(uint256,bool)) is not implicitly convertible to expected type tuple(uint8,uint8,int256).
|
||||
@@ -0,0 +1,18 @@
|
||||
error MyCustomError(uint, bool);
|
||||
error MyCustomError2(uint, bool);
|
||||
error MyCustomError3(uint, bool, bool);
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
true ? MyCustomError : MyCustomError;
|
||||
true ? MyCustomError : MyCustomError2;
|
||||
true ? MyCustomError : MyCustomError3;
|
||||
true ? MyCustomError : true;
|
||||
true ? true : MyCustomError;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 1080: (253-290): True expression's type error MyCustomError(uint256,bool) does not match false expression's type error MyCustomError3(uint256,bool,bool).
|
||||
// TypeError 1080: (300-327): True expression's type error MyCustomError(uint256,bool) does not match false expression's type bool.
|
||||
// TypeError 1080: (337-364): True expression's type bool does not match false expression's type error MyCustomError(uint256,bool).
|
||||
@@ -0,0 +1,7 @@
|
||||
error E();
|
||||
|
||||
contract C {
|
||||
function() internal pure x = E;
|
||||
}
|
||||
// ----
|
||||
// TypeError 7407: (58-59): Type error E() is not implicitly convertible to expected type function () pure. Special functions can not be converted to function types.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract C {
|
||||
function f() public {
|
||||
bytes4 a = MyCustomError;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 9574: (81-105): Type error MyCustomError(uint256,bool) is not implicitly convertible to expected type bytes4.
|
||||
@@ -0,0 +1,10 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract Base {
|
||||
constructor(uint8) {}
|
||||
}
|
||||
|
||||
contract Derived is Base(MyCustomError) {}
|
||||
|
||||
// ----
|
||||
// TypeError 9827: (104-117): Invalid type for argument in constructor call. Invalid implicit conversion from error MyCustomError(uint256,bool) to uint8 requested.
|
||||
@@ -9,4 +9,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9582: (133-136): Member "f" not found or not visible after argument-dependent lookup in function (uint256) pure.
|
||||
// TypeError 9582: (133-136): Member "f" not found or not visible after argument-dependent lookup in error E(uint256).
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
function f() public {
|
||||
bytes memory a;
|
||||
bytes memory b = type(MyCustomEvent).concat(a);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4259: (124-137): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but event MyCustomEvent(uint256) provided.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract Test {
|
||||
event E(uint);
|
||||
function f() public {
|
||||
abi.decode(E, (bool));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 1956: (80-81): The first argument to "abi.decode" must be implicitly convertible to bytes memory or bytes calldata, but is of type event E(uint256).
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
function f() pure public {
|
||||
bytes.concat(MyCustomEvent, MyCustomEvent);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 8015: (96-109): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but event MyCustomEvent(uint256) provided.
|
||||
// TypeError 8015: (111-124): Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but event MyCustomEvent(uint256) provided.
|
||||
@@ -0,0 +1,41 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
|
||||
enum testEnum { choice1, choice2, choice3 }
|
||||
|
||||
function f1(uint8, uint8) external {}
|
||||
function f2(uint32) external {}
|
||||
function f3(uint) external {}
|
||||
function g1(bytes memory) external {}
|
||||
function g2(bytes32) external {}
|
||||
function h(string memory) external {}
|
||||
function i(bool) external {}
|
||||
function j(address) external {}
|
||||
function k(address payable) external {}
|
||||
function l(testEnum) external {}
|
||||
|
||||
function f() pure public {
|
||||
abi.encodeCall(this.f1, (MyCustomEvent, MyCustomEvent));
|
||||
abi.encodeCall(this.f2, (MyCustomEvent));
|
||||
abi.encodeCall(this.f3, (MyCustomEvent));
|
||||
abi.encodeCall(this.g1, (MyCustomEvent));
|
||||
abi.encodeCall(this.g2, (MyCustomEvent));
|
||||
abi.encodeCall(this.h, (MyCustomEvent));
|
||||
abi.encodeCall(this.i, (MyCustomEvent));
|
||||
abi.encodeCall(this.j, (MyCustomEvent));
|
||||
abi.encodeCall(this.k, (MyCustomEvent));
|
||||
abi.encodeCall(this.l, (MyCustomEvent));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5407: (542-555): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "uint8".
|
||||
// TypeError 5407: (557-570): Cannot implicitly convert component at position 1 from "event MyCustomEvent(uint256)" to "uint8".
|
||||
// TypeError 5407: (606-621): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "uint32".
|
||||
// TypeError 5407: (656-671): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "uint256".
|
||||
// TypeError 5407: (706-721): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "bytes memory".
|
||||
// TypeError 5407: (756-771): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "bytes32".
|
||||
// TypeError 5407: (805-820): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "string memory".
|
||||
// TypeError 5407: (854-869): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "bool".
|
||||
// TypeError 5407: (903-918): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "address".
|
||||
// TypeError 5407: (952-967): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "address payable".
|
||||
// TypeError 5407: (1001-1016): Cannot implicitly convert component at position 0 from "event MyCustomEvent(uint256)" to "enum C.testEnum".
|
||||
@@ -0,0 +1,46 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
function f() pure public {
|
||||
MyCustomEvent << MyCustomEvent;
|
||||
MyCustomEvent >> MyCustomEvent;
|
||||
MyCustomEvent ^ MyCustomEvent;
|
||||
MyCustomEvent | MyCustomEvent;
|
||||
MyCustomEvent & MyCustomEvent;
|
||||
|
||||
MyCustomEvent * MyCustomEvent;
|
||||
MyCustomEvent / MyCustomEvent;
|
||||
MyCustomEvent % MyCustomEvent;
|
||||
MyCustomEvent + MyCustomEvent;
|
||||
MyCustomEvent - MyCustomEvent;
|
||||
|
||||
MyCustomEvent == MyCustomEvent;
|
||||
MyCustomEvent != MyCustomEvent;
|
||||
MyCustomEvent >= MyCustomEvent;
|
||||
MyCustomEvent <= MyCustomEvent;
|
||||
MyCustomEvent < MyCustomEvent;
|
||||
MyCustomEvent > MyCustomEvent;
|
||||
|
||||
MyCustomEvent || MyCustomEvent;
|
||||
MyCustomEvent && MyCustomEvent;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 2271: (83-113): Operator << not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (123-153): Operator >> not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (163-192): Operator ^ not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (202-231): Operator | not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (241-270): Operator & not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (281-310): Operator * not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (320-349): Operator / not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (359-388): Operator % not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (398-427): Operator + not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (437-466): Operator - not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (477-507): Operator == not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (517-547): Operator != not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (557-587): Operator >= not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (597-627): Operator <= not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (637-666): Operator < not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (676-705): Operator > not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (716-746): Operator || not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
// TypeError 2271: (756-786): Operator && not compatible with types event MyCustomEvent(uint256) and event MyCustomEvent(uint256)
|
||||
@@ -0,0 +1,18 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
function f() pure public {
|
||||
uint a;
|
||||
MyCustomEvent += 1;
|
||||
MyCustomEvent -= 1;
|
||||
a += MyCustomEvent;
|
||||
a -= MyCustomEvent;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 4247: (99-112): Expression has to be an lvalue.
|
||||
// TypeError 7366: (99-117): Operator += not compatible with types event MyCustomEvent(uint256) and int_const 1
|
||||
// TypeError 4247: (127-140): Expression has to be an lvalue.
|
||||
// TypeError 7366: (127-145): Operator -= not compatible with types event MyCustomEvent(uint256) and int_const 1
|
||||
// TypeError 7366: (155-173): Operator += not compatible with types uint256 and event MyCustomEvent(uint256)
|
||||
// TypeError 7366: (183-201): Operator -= not compatible with types uint256 and event MyCustomEvent(uint256)
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
function f() pure public {
|
||||
MyCustomEvent++;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 4247: (83-96): Expression has to be an lvalue.
|
||||
// TypeError 9767: (83-98): Unary operator ++ cannot be applied to type event MyCustomEvent(uint256)
|
||||
@@ -0,0 +1,8 @@
|
||||
contract B {
|
||||
event MyCustomEvent(uint);
|
||||
function f() mod1(MyCustomEvent) public { }
|
||||
modifier mod1(uint a) { if (a > 0) _; }
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 4649: (66-79): Invalid type for argument in modifier invocation. Invalid implicit conversion from event MyCustomEvent(uint256) to uint256 requested.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
function f() public returns (uint8, uint8, int) {
|
||||
return ((MyCustomEvent, 8, MyCustomEvent));
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 5992: (113-148): Return argument type tuple(event MyCustomEvent(uint256),int_const 8,event MyCustomEvent(uint256)) is not implicitly convertible to expected type tuple(uint8,uint8,int256).
|
||||
+1
-1
@@ -8,4 +8,4 @@ contract D {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9582: (123-135): Member "selector" not found or not visible after argument-dependent lookup in function ().
|
||||
// TypeError 9582: (123-135): Member "selector" not found or not visible after argument-dependent lookup in event E().
|
||||
|
||||
+1
-1
@@ -10,4 +10,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9582: (70-82): Member "selector" not found or not visible after argument-dependent lookup in function ().
|
||||
// TypeError 9582: (70-82): Member "selector" not found or not visible after argument-dependent lookup in event E().
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
event MyCustomEvent2(uint);
|
||||
event MyCustomEvent3(uint, bool);
|
||||
function f() pure public {
|
||||
true ? MyCustomEvent : MyCustomEvent;
|
||||
true ? MyCustomEvent : MyCustomEvent2;
|
||||
true ? MyCustomEvent : MyCustomEvent3;
|
||||
true ? MyCustomEvent : true;
|
||||
true ? true : MyCustomEvent;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 1080: (246-283): True expression's type event MyCustomEvent(uint256) does not match false expression's type event MyCustomEvent3(uint256,bool).
|
||||
// TypeError 1080: (293-320): True expression's type event MyCustomEvent(uint256) does not match false expression's type bool.
|
||||
// TypeError 1080: (330-357): True expression's type bool does not match false expression's type event MyCustomEvent(uint256).
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
error E();
|
||||
|
||||
contract C {
|
||||
event E(uint);
|
||||
function() internal pure x = E;
|
||||
}
|
||||
// ----
|
||||
// TypeError 7407: (58-59): Type function () pure is not implicitly convertible to expected type function () pure. Special functions can not be converted to function types.
|
||||
// TypeError 7407: (66-67): Type event E(uint256) is not implicitly convertible to expected type function () pure. Special functions can not be converted to function types.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
event MyCustomEvent(uint);
|
||||
function f() public {
|
||||
bytes4 a = MyCustomEvent;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 9574: (78-102): Type event MyCustomEvent(uint256) is not implicitly convertible to expected type bytes4.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract Base {
|
||||
event MyCustomEvent(uint);
|
||||
constructor(uint8) {}
|
||||
}
|
||||
|
||||
contract Derived is Base(Base.MyCustomEvent) {}
|
||||
|
||||
// ----
|
||||
// TypeError 9827: (101-119): Invalid type for argument in constructor call. Invalid implicit conversion from event MyCustomEvent(uint256) to uint8 requested.
|
||||
@@ -4,4 +4,4 @@
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4061: (91-136): Type mapping(string => uint24)[1] is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (91-136): Type mapping(string => uint24)[1] memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -11,4 +11,4 @@ contract Test {
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 2333: (157-198): Identifier already declared.
|
||||
// TypeError 4061: (268-300): Type struct Test.RecursiveStruct[1] is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (268-300): Type struct Test.RecursiveStruct[1] memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
interface MyInterface {
|
||||
error MyCustomError(uint256, bool);
|
||||
}
|
||||
|
||||
contract MyContract {
|
||||
function test() public {
|
||||
MyInterface.MyCustomError[];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2614: (126-151): Indexed expression has to be a type, mapping or array (is error MyCustomError(uint256,bool))
|
||||
@@ -0,0 +1,8 @@
|
||||
contract MyContract {
|
||||
event MyCustomEvent(uint256);
|
||||
function test() public {
|
||||
MyCustomEvent[];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2614: (93-106): Indexed expression has to be a type, mapping or array (is event MyCustomEvent(uint256))
|
||||
+1
-1
@@ -9,4 +9,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4061: (161-172): Type struct Test.S2 is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (161-172): Type struct Test.S2 memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4061: (104-114): Type struct Test.S is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (104-114): Type struct Test.S memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4259: (154-155): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(struct Test.S) provided.
|
||||
// TypeError 4259: (154-155): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(struct Test.S storage pointer) provided.
|
||||
+1
-1
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4061: (47-77): Type mapping(uint256 => uint256)[] is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (47-77): Type mapping(uint256 => uint256)[] memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
error MyCustomError(uint, bool);
|
||||
contract Test {
|
||||
function f() public {
|
||||
uint[] memory a;
|
||||
a[MyCustomError];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 7407: (110-123): Type error MyCustomError(uint256,bool) is not implicitly convertible to expected type uint256.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract Test {
|
||||
event MyCustomEvent(uint);
|
||||
function f() public {
|
||||
uint[] memory a;
|
||||
a[MyCustomEvent];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 7407: (108-121): Type event MyCustomEvent(uint256) is not implicitly convertible to expected type uint256.
|
||||
+1
-1
@@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9611: (92-101): Decoding type uint256[] memory[3] memory not supported.
|
||||
// TypeError 9611: (92-101): Decoding type uint256[][3] memory not supported.
|
||||
|
||||
@@ -3,4 +3,4 @@ contract test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4061: (31-64): Type mapping(uint256 => uint256)[2] is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (31-64): Type mapping(uint256 => uint256)[2] memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -4,4 +4,4 @@ library L {
|
||||
function f(S memory a) external pure returns (S memory) {}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4061: (103-113): Type struct L.S is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (103-113): Type struct L.S memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -17,4 +17,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4061: (143-153): Type struct Test.S is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (143-153): Type struct Test.S memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -12,4 +12,4 @@ contract Test {
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 4061: (172-182): Type struct Test.S is only valid in storage because it contains a (nested) mapping.
|
||||
// TypeError 4061: (172-182): Type struct Test.S memory is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
Reference in New Issue
Block a user