Update error message of 4907_error

This commit is contained in:
wechman 2022-09-16 13:17:46 +02:00
parent cdbc06419f
commit ea5309a9e6
21 changed files with 30 additions and 30 deletions

View File

@ -1758,7 +1758,7 @@ bool TypeChecker::visit(UnaryOperation const& _operation)
else else
{ {
string description = string description =
"Unary operator " + string(TokenTraits::toString(op)) + " cannot be applied to type " + subExprType->humanReadableName() + "." + "Built-in unary operator "s + TokenTraits::toString(op) + " cannot be applied to type " + subExprType->humanReadableName() + "." +
(!builtinResult.message().empty() ? " " + builtinResult.message() : "") + (!builtinResult.message().empty() ? " " + builtinResult.message() : "") +
(!userDefinedOperatorResult.message().empty() ? " " + userDefinedOperatorResult.message() : ""); (!userDefinedOperatorResult.message().empty() ? " " + userDefinedOperatorResult.message() : "");
if (modifying) if (modifying)

View File

@ -19,5 +19,5 @@ contract C {
// TypeError 9062: (284-299): Expected an inline tuple, not an expression of a tuple type. // TypeError 9062: (284-299): Expected an inline tuple, not an expression of a tuple type.
// TypeError 2271: (334-345): Binary operator / not compatible with types tuple() and tuple(). // TypeError 2271: (334-345): Binary operator / not compatible with types tuple() and tuple().
// TypeError 9062: (334-345): Expected an inline tuple, not an expression of a tuple type. // TypeError 9062: (334-345): Expected an inline tuple, not an expression of a tuple type.
// TypeError 4907: (380-383): Unary operator ! cannot be applied to type tuple(). // TypeError 4907: (380-383): Built-in unary operator ! cannot be applied to type tuple().
// TypeError 9062: (380-383): Expected an inline tuple, not an expression of a tuple type. // TypeError 9062: (380-383): Expected an inline tuple, not an expression of a tuple type.

View File

@ -8,4 +8,4 @@ contract C {
// ---- // ----
// TypeError 4247: (86-99): Expression has to be an lvalue. // 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). // TypeError 9767: (86-101): Built-in unary operator ++ cannot be applied to type error MyCustomError(uint256,bool).

View File

@ -7,4 +7,4 @@ contract C {
// ---- // ----
// TypeError 4247: (83-96): Expression has to be an lvalue. // TypeError 4247: (83-96): Expression has to be an lvalue.
// TypeError 9767: (83-98): Unary operator ++ cannot be applied to type event MyCustomEvent(uint256). // TypeError 9767: (83-98): Built-in unary operator ++ cannot be applied to type event MyCustomEvent(uint256).

View File

@ -6,4 +6,4 @@ contract C
} }
} }
// ---- // ----
// TypeError 9767: (59-64): Unary operator -- cannot be applied to type tuple(,). // TypeError 9767: (59-64): Built-in unary operator -- cannot be applied to type tuple(,).

View File

@ -7,4 +7,4 @@ contract C
} }
// ---- // ----
// TypeError 4247: (68-69): Expression has to be an lvalue. // TypeError 4247: (68-69): Expression has to be an lvalue.
// TypeError 9767: (59-70): Unary operator delete cannot be applied to type tuple(,int_const 0). // TypeError 9767: (59-70): Built-in unary operator delete cannot be applied to type tuple(,int_const 0).

View File

@ -6,4 +6,4 @@ contract C
} }
} }
// ---- // ----
// TypeError 9767: (61-66): Unary operator ++ cannot be applied to type tuple(,). // TypeError 9767: (61-66): Built-in unary operator ++ cannot be applied to type tuple(,).

View File

@ -10,11 +10,11 @@ contract C
} }
// ---- // ----
// SyntaxError 9636: (59-66): Use of unary + is disallowed. // SyntaxError 9636: (59-66): Use of unary + is disallowed.
// TypeError 4907: (59-66): Unary operator + cannot be applied to type tuple(int_const 0,int_const 0). // TypeError 4907: (59-66): Built-in unary operator + cannot be applied to type tuple(int_const 0,int_const 0).
// TypeError 7364: (51-66): Different number of components on the left hand side (1) than on the right hand side (2). // TypeError 7364: (51-66): Different number of components on the left hand side (1) than on the right hand side (2).
// TypeError 4907: (84-91): Unary operator - cannot be applied to type tuple(int_const 0,int_const 0). // TypeError 4907: (84-91): Built-in unary operator - cannot be applied to type tuple(int_const 0,int_const 0).
// TypeError 7364: (76-91): Different number of components on the left hand side (1) than on the right hand side (2). // TypeError 7364: (76-91): Different number of components on the left hand side (1) than on the right hand side (2).
// TypeError 4907: (111-118): Unary operator ~ cannot be applied to type tuple(int_const 0,int_const 0). // TypeError 4907: (111-118): Built-in unary operator ~ cannot be applied to type tuple(int_const 0,int_const 0).
// TypeError 7364: (101-118): Different number of components on the left hand side (1) than on the right hand side (2). // TypeError 7364: (101-118): Different number of components on the left hand side (1) than on the right hand side (2).
// TypeError 4907: (138-145): Unary operator ! cannot be applied to type tuple(int_const 0,int_const 0). // TypeError 4907: (138-145): Built-in unary operator ! cannot be applied to type tuple(int_const 0,int_const 0).
// TypeError 7364: (128-145): Different number of components on the left hand side (1) than on the right hand side (2). // TypeError 7364: (128-145): Different number of components on the left hand side (1) than on the right hand side (2).

View File

@ -1,3 +1,3 @@
contract test { fallback() external { uint x = 1; !x; } } contract test { fallback() external { uint x = 1; !x; } }
// ---- // ----
// TypeError 4907: (50-52): Unary operator ! cannot be applied to type uint256. // TypeError 4907: (50-52): Built-in unary operator ! cannot be applied to type uint256.

View File

@ -6,4 +6,4 @@ contract C {
} }
} }
// ---- // ----
// TypeError 9767: (97-105): Unary operator delete cannot be applied to type uint256[] storage pointer. // TypeError 9767: (97-105): Built-in unary operator delete cannot be applied to type uint256[] storage pointer.

View File

@ -7,4 +7,4 @@ contract test {
} }
// ---- // ----
// SyntaxError 9636: (70-75): Use of unary + is disallowed. // SyntaxError 9636: (70-75): Use of unary + is disallowed.
// TypeError 4907: (70-75): Unary operator + cannot be applied to type rational_const 13 / 4. // TypeError 4907: (70-75): Built-in unary operator + cannot be applied to type rational_const 13 / 4.

View File

@ -4,4 +4,4 @@ contract test {
} }
} }
// ---- // ----
// TypeError 4907: (50-61): Unary operator ~ cannot be applied to type fixed128x18. // TypeError 4907: (50-61): Built-in unary operator ~ cannot be applied to type fixed128x18.

View File

@ -6,4 +6,4 @@ contract test {
} }
} }
// ---- // ----
// TypeError 4907: (97-99): Unary operator - cannot be applied to type uint256. Unary negation is only allowed for signed integers. // TypeError 4907: (97-99): Built-in unary operator - cannot be applied to type uint256. Unary negation is only allowed for signed integers.

View File

@ -31,6 +31,6 @@ contract C {
// TypeError 2271: (311-316): Binary operator + not compatible with types struct S storage ref and struct S storage ref. No matching user-defined operator found. // TypeError 2271: (311-316): Binary operator + not compatible with types struct S storage ref and struct S storage ref. No matching user-defined operator found.
// TypeError 5653: (326-336): User defined binary operator + not compatible with types struct S memory and bool. // TypeError 5653: (326-336): User defined binary operator + not compatible with types struct S memory and bool.
// TypeError 2271: (346-354): Binary operator + not compatible with types bool and struct S storage ref. // TypeError 2271: (346-354): Binary operator + not compatible with types bool and struct S storage ref.
// TypeError 4907: (364-369): Unary operator - cannot be applied to type struct S storage pointer. No matching user-defined operator found. // TypeError 4907: (364-369): Built-in unary operator - cannot be applied to type struct S storage pointer. No matching user-defined operator found.
// TypeError 4907: (379-381): Unary operator - cannot be applied to type struct S storage ref. No matching user-defined operator found. // TypeError 4907: (379-381): Built-in unary operator - cannot be applied to type struct S storage ref. No matching user-defined operator found.
// TypeError 4907: (391-396): Unary operator - cannot be applied to type bool. // TypeError 4907: (391-396): Built-in unary operator - cannot be applied to type bool.

View File

@ -65,4 +65,4 @@ function test(S calldata s) pure {
// TypeError 3605: (82-87): The function "unsub" needs to have parameters and return value of the same type to be used for the operator -. // TypeError 3605: (82-87): The function "unsub" needs to have parameters and return value of the same type to be used for the operator -.
// TypeError 7743: (98-104): The function "bitnot" needs to return exactly one value of type S to be used for the operator ~. // TypeError 7743: (98-104): The function "bitnot" needs to return exactly one value of type S to be used for the operator ~.
// TypeError 2271: (764-769): Binary operator * not compatible with types struct S calldata and struct S calldata. No matching user-defined operator found. // TypeError 2271: (764-769): Binary operator * not compatible with types struct S calldata and struct S calldata. No matching user-defined operator found.
// TypeError 4907: (797-799): Unary operator - cannot be applied to type struct S calldata. No matching user-defined operator found. // TypeError 4907: (797-799): Built-in unary operator - cannot be applied to type struct S calldata. No matching user-defined operator found.

View File

@ -60,4 +60,4 @@ contract C {
// TypeError 7743: (82-87): The function "unsub" needs to return exactly one value of type S to be used for the operator -. // TypeError 7743: (82-87): The function "unsub" needs to return exactly one value of type S to be used for the operator -.
// TypeError 1147: (98-104): The function "bitnot" needs to have exactly one parameter of type S to be used for the operator ~. // TypeError 1147: (98-104): The function "bitnot" needs to have exactly one parameter of type S to be used for the operator ~.
// TypeError 2271: (728-733): Binary operator * not compatible with types struct S storage ref and struct S storage ref. No matching user-defined operator found. // TypeError 2271: (728-733): Binary operator * not compatible with types struct S storage ref and struct S storage ref. No matching user-defined operator found.
// TypeError 4907: (785-787): Unary operator ~ cannot be applied to type struct S storage ref. No matching user-defined operator found. // TypeError 4907: (785-787): Built-in unary operator ~ cannot be applied to type struct S storage ref. No matching user-defined operator found.

View File

@ -15,4 +15,4 @@ contract C {
// ---- // ----
// TypeError 1147: (32-38): The function "bitnot" needs to have exactly one parameter of type Int to be used for the operator ~. // TypeError 1147: (32-38): The function "bitnot" needs to have exactly one parameter of type Int to be used for the operator ~.
// TypeError 4907: (186-198): Unary operator ~ cannot be applied to type Int. No matching user-defined operator found. // TypeError 4907: (186-198): Built-in unary operator ~ cannot be applied to type Int. No matching user-defined operator found.

View File

@ -7,5 +7,5 @@ function f() pure {
} }
// ---- // ----
// TypeError 4907: (70-72): Unary operator - cannot be applied to type Int. No matching user-defined operator found. // TypeError 4907: (70-72): Built-in unary operator - cannot be applied to type Int. No matching user-defined operator found.
// TypeError 9767: (78-81): Unary operator ++ cannot be applied to type Int. // TypeError 9767: (78-81): Built-in unary operator ++ cannot be applied to type Int.

View File

@ -6,4 +6,4 @@ contract test {
} }
// ---- // ----
// SyntaxError 9636: (70-72): Use of unary + is disallowed. // SyntaxError 9636: (70-72): Use of unary + is disallowed.
// TypeError 4907: (70-72): Unary operator + cannot be applied to type uint256. // TypeError 4907: (70-72): Built-in unary operator + cannot be applied to type uint256.

View File

@ -39,12 +39,12 @@ contract C {
// TypeError 2271: (309-314): Binary operator & not compatible with types bool and bool. // TypeError 2271: (309-314): Binary operator & not compatible with types bool and bool.
// TypeError 2271: (328-333): Binary operator | not compatible with types bool and bool. // TypeError 2271: (328-333): Binary operator | not compatible with types bool and bool.
// TypeError 2271: (347-352): Binary operator ^ not compatible with types bool and bool. // TypeError 2271: (347-352): Binary operator ^ not compatible with types bool and bool.
// TypeError 4907: (366-368): Unary operator ~ cannot be applied to type bool. // TypeError 4907: (366-368): Built-in unary operator ~ cannot be applied to type bool.
// TypeError 4907: (382-384): Unary operator ~ cannot be applied to type bool. // TypeError 4907: (382-384): Built-in unary operator ~ cannot be applied to type bool.
// TypeError 2271: (398-403): Binary operator + not compatible with types bool and bool. // TypeError 2271: (398-403): Binary operator + not compatible with types bool and bool.
// TypeError 2271: (417-422): Binary operator - not compatible with types bool and bool. // TypeError 2271: (417-422): Binary operator - not compatible with types bool and bool.
// TypeError 4907: (436-438): Unary operator - cannot be applied to type bool. // TypeError 4907: (436-438): Built-in unary operator - cannot be applied to type bool.
// TypeError 4907: (452-454): Unary operator - cannot be applied to type bool. // TypeError 4907: (452-454): Built-in unary operator - cannot be applied to type bool.
// TypeError 2271: (468-473): Binary operator * not compatible with types bool and bool. // TypeError 2271: (468-473): Binary operator * not compatible with types bool and bool.
// TypeError 2271: (487-492): Binary operator / not compatible with types bool and bool. // TypeError 2271: (487-492): Binary operator / not compatible with types bool and bool.
// TypeError 2271: (506-512): Binary operator ** not compatible with types bool and bool. // TypeError 2271: (506-512): Binary operator ** not compatible with types bool and bool.

View File

@ -2,4 +2,4 @@ contract C {
bytes32 b = ~hex"00ff11"; bytes32 b = ~hex"00ff11";
} }
// ---- // ----
// TypeError 4907: (29-41): Unary operator ~ cannot be applied to type literal_string hex"00ff11". // TypeError 4907: (29-41): Built-in unary operator ~ cannot be applied to type literal_string hex"00ff11".