From 56ebb5f9014b2ebfc8d46f498808b7f5d1e0d6f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 25 Jan 2023 00:12:07 +0100 Subject: [PATCH] fixup! User-defined operators: Tests --- .../operator_parsing_non_user_definable.sol | 45 ++++++++++++++----- .../operator_parsing_not_an_operator.sol | 14 ++++++ 2 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 test/libsolidity/syntaxTests/operators/userDefined/operator_parsing_not_an_operator.sol diff --git a/test/libsolidity/syntaxTests/operators/userDefined/operator_parsing_non_user_definable.sol b/test/libsolidity/syntaxTests/operators/userDefined/operator_parsing_non_user_definable.sol index d55b8370e..157d5b65e 100644 --- a/test/libsolidity/syntaxTests/operators/userDefined/operator_parsing_non_user_definable.sol +++ b/test/libsolidity/syntaxTests/operators/userDefined/operator_parsing_non_user_definable.sol @@ -1,16 +1,37 @@ using { - f as ++, - f as --, - f as x, - f as delete, f as new, - f as () + f as delete, + f as &&, + f as ||, + f as =, + f as |=, + f as ^=, + f as &=, + f as <<=, + f as >>=, + f as +=, + f as -=, + f as *=, + f as /=, + f as %=, + f as ++, + f as -- } for int256; // ---- -// ParserError 4403: (17-19): Not a user-definable operator: ++. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! -// ParserError 4403: (30-32): Not a user-definable operator: --. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! -// ParserError 4403: (43-44): Not a user-definable operator: x. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! -// ParserError 4403: (55-61): Not a user-definable operator: delete. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! -// ParserError 4403: (72-75): Not a user-definable operator: new. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! -// ParserError 4403: (86-87): Not a user-definable operator: (. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! -// ParserError 2314: (87-88): Expected '}' but got ')' +// ParserError 4403: (17-20): Not a user-definable operator: new. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (31-37): Not a user-definable operator: delete. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (48-50): Not a user-definable operator: &&. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (61-63): Not a user-definable operator: ||. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (74-75): Not a user-definable operator: =. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (86-88): Not a user-definable operator: |=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (99-101): Not a user-definable operator: ^=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (112-114): Not a user-definable operator: &=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (125-128): Not a user-definable operator: <<=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (139-142): Not a user-definable operator: >>=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (153-155): Not a user-definable operator: +=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (166-168): Not a user-definable operator: -=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (179-181): Not a user-definable operator: *=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (192-194): Not a user-definable operator: /=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (205-207): Not a user-definable operator: %=. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (218-220): Not a user-definable operator: ++. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (231-233): Not a user-definable operator: --. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! diff --git a/test/libsolidity/syntaxTests/operators/userDefined/operator_parsing_not_an_operator.sol b/test/libsolidity/syntaxTests/operators/userDefined/operator_parsing_not_an_operator.sol new file mode 100644 index 000000000..eeee25c95 --- /dev/null +++ b/test/libsolidity/syntaxTests/operators/userDefined/operator_parsing_not_an_operator.sol @@ -0,0 +1,14 @@ +using { + f as x, + f as operator, + f as as, + f as 123, + f as () +} for int256; +// ---- +// ParserError 4403: (17-18): Not a user-definable operator: x. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (29-37): Not a user-definable operator: operator. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (48-50): Not a user-definable operator: as. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (61-64): Not a user-definable operator: 123. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 4403: (75-76): Not a user-definable operator: (. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, ! +// ParserError 2314: (76-77): Expected '}' but got ')'