diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 54b83d3a1..accd37724 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1758,7 +1758,7 @@ bool TypeChecker::visit(UnaryOperation const& _operation) else { 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() : "") + (!userDefinedOperatorResult.message().empty() ? " " + userDefinedOperatorResult.message() : ""); if (modifying) diff --git a/test/libsolidity/syntaxTests/abiEncoder/abi_encodeCall_tuple_from_invalid_operator.sol b/test/libsolidity/syntaxTests/abiEncoder/abi_encodeCall_tuple_from_invalid_operator.sol index b4c484b85..5c779d8f0 100644 --- a/test/libsolidity/syntaxTests/abiEncoder/abi_encodeCall_tuple_from_invalid_operator.sol +++ b/test/libsolidity/syntaxTests/abiEncoder/abi_encodeCall_tuple_from_invalid_operator.sol @@ -19,5 +19,5 @@ contract C { // 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 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. diff --git a/test/libsolidity/syntaxTests/errors/error_incompatible_unary_operator.sol b/test/libsolidity/syntaxTests/errors/error_incompatible_unary_operator.sol index f4bc34ca4..147d2a3e6 100644 --- a/test/libsolidity/syntaxTests/errors/error_incompatible_unary_operator.sol +++ b/test/libsolidity/syntaxTests/errors/error_incompatible_unary_operator.sol @@ -8,4 +8,4 @@ contract C { // ---- // 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). diff --git a/test/libsolidity/syntaxTests/events/event_incompatible_unary_operator.sol b/test/libsolidity/syntaxTests/events/event_incompatible_unary_operator.sol index 110b8d214..751be2132 100644 --- a/test/libsolidity/syntaxTests/events/event_incompatible_unary_operator.sol +++ b/test/libsolidity/syntaxTests/events/event_incompatible_unary_operator.sol @@ -7,4 +7,4 @@ contract C { // ---- // 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). diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_dec_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_dec_tuple.sol index fa1950d92..9398ef473 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_dec_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_dec_tuple.sol @@ -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(,). diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_delete_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_delete_tuple.sol index c73fe7435..649eae56f 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_delete_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_delete_tuple.sol @@ -7,4 +7,4 @@ contract C } // ---- // 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). diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_inc_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_inc_tuple.sol index 3cbab1423..2f20a6216 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_inc_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_inc_tuple.sol @@ -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(,). diff --git a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_unary_tuple.sol b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_unary_tuple.sol index 01056ffe2..b6b2ec2e2 100644 --- a/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_unary_tuple.sol +++ b/test/libsolidity/syntaxTests/iceRegressionTests/declarationUnaryTuple/declaration_unary_tuple.sol @@ -10,11 +10,11 @@ contract C } // ---- // 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 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 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 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). diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol index c4fff97b4..83c39fbda 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol @@ -1,3 +1,3 @@ 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. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol index e0db21efa..7d452197e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/213_no_delete_on_storage_pointers.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol index eeaa66ebc..0c579062b 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/308_rational_unary_plus_operation.sol @@ -7,4 +7,4 @@ contract test { } // ---- // 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. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol index 4bf484ff1..46cda0a1c 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/negation.sol b/test/libsolidity/syntaxTests/negation.sol index 4a9d87b8a..c5805f4f7 100644 --- a/test/libsolidity/syntaxTests/negation.sol +++ b/test/libsolidity/syntaxTests/negation.sol @@ -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. diff --git a/test/libsolidity/syntaxTests/operators/custom/implicit_conversion_is_blocked.sol b/test/libsolidity/syntaxTests/operators/custom/implicit_conversion_is_blocked.sol index a7a4c8181..e91fee25d 100644 --- a/test/libsolidity/syntaxTests/operators/custom/implicit_conversion_is_blocked.sol +++ b/test/libsolidity/syntaxTests/operators/custom/implicit_conversion_is_blocked.sol @@ -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 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 4907: (364-369): 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: (391-396): Unary operator - cannot be applied to type bool. +// 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): Built-in unary operator - cannot be applied to type struct S storage ref. No matching user-defined operator found. +// TypeError 4907: (391-396): Built-in unary operator - cannot be applied to type bool. diff --git a/test/libsolidity/syntaxTests/operators/custom/operator_with_calldata_parameters.sol b/test/libsolidity/syntaxTests/operators/custom/operator_with_calldata_parameters.sol index d8b14130c..d64f72a72 100644 --- a/test/libsolidity/syntaxTests/operators/custom/operator_with_calldata_parameters.sol +++ b/test/libsolidity/syntaxTests/operators/custom/operator_with_calldata_parameters.sol @@ -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 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 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. diff --git a/test/libsolidity/syntaxTests/operators/custom/operator_with_storage_parameters.sol b/test/libsolidity/syntaxTests/operators/custom/operator_with_storage_parameters.sol index 47c5312bc..b3cd23576 100644 --- a/test/libsolidity/syntaxTests/operators/custom/operator_with_storage_parameters.sol +++ b/test/libsolidity/syntaxTests/operators/custom/operator_with_storage_parameters.sol @@ -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 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 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. diff --git a/test/libsolidity/syntaxTests/operators/custom/two_argument_function_bound_to_unary_operator.sol b/test/libsolidity/syntaxTests/operators/custom/two_argument_function_bound_to_unary_operator.sol index 5acebcf72..f8e62840b 100644 --- a/test/libsolidity/syntaxTests/operators/custom/two_argument_function_bound_to_unary_operator.sol +++ b/test/libsolidity/syntaxTests/operators/custom/two_argument_function_bound_to_unary_operator.sol @@ -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 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. diff --git a/test/libsolidity/syntaxTests/operators/unary_operator_cannot_be_applied.sol b/test/libsolidity/syntaxTests/operators/unary_operator_cannot_be_applied.sol index 3b95318e8..29273852e 100644 --- a/test/libsolidity/syntaxTests/operators/unary_operator_cannot_be_applied.sol +++ b/test/libsolidity/syntaxTests/operators/unary_operator_cannot_be_applied.sol @@ -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 9767: (78-81): Unary operator ++ cannot be applied to type Int. +// TypeError 4907: (70-72): Built-in unary operator - cannot be applied to type Int. No matching user-defined operator found. +// TypeError 9767: (78-81): Built-in unary operator ++ cannot be applied to type Int. diff --git a/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol b/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol index 7005c8848..41384d98f 100644 --- a/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol +++ b/test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol @@ -6,4 +6,4 @@ contract test { } // ---- // 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. diff --git a/test/libsolidity/syntaxTests/types/bool_ops.sol b/test/libsolidity/syntaxTests/types/bool_ops.sol index 13a932399..ef6a28f4f 100644 --- a/test/libsolidity/syntaxTests/types/bool_ops.sol +++ b/test/libsolidity/syntaxTests/types/bool_ops.sol @@ -39,12 +39,12 @@ contract C { // 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: (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: (382-384): 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): 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: (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: (452-454): 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): 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: (487-492): Binary operator / not compatible with types bool and bool. // TypeError 2271: (506-512): Binary operator ** not compatible with types bool and bool. diff --git a/test/libsolidity/syntaxTests/types/hex_literal_bitnot.sol b/test/libsolidity/syntaxTests/types/hex_literal_bitnot.sol index b5676f23c..5b24153c8 100644 --- a/test/libsolidity/syntaxTests/types/hex_literal_bitnot.sol +++ b/test/libsolidity/syntaxTests/types/hex_literal_bitnot.sol @@ -2,4 +2,4 @@ contract C { 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".