mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow redefining <<, >>, ** and !
This commit is contained in:
+25
-17
@@ -1,8 +1,12 @@
|
||||
using {
|
||||
f as new,
|
||||
f as delete,
|
||||
f as **,
|
||||
f as <<,
|
||||
f as >>,
|
||||
f as &&,
|
||||
f as ||,
|
||||
f as !,
|
||||
f as =,
|
||||
f as |=,
|
||||
f as ^=,
|
||||
@@ -18,20 +22,24 @@ using {
|
||||
f as --
|
||||
} for int256;
|
||||
// ----
|
||||
// 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: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, !
|
||||
// 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-76): Not a user-definable operator: >>. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (87-89): Not a user-definable operator: &&. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (100-102): Not a user-definable operator: ||. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (113-114): Not a user-definable operator: !. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (125-126): Not a user-definable operator: =. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (137-139): Not a user-definable operator: |=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (150-152): Not a user-definable operator: ^=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (163-165): Not a user-definable operator: &=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (176-179): Not a user-definable operator: <<=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (190-193): Not a user-definable operator: >>=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (204-206): Not a user-definable operator: +=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (217-219): Not a user-definable operator: -=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (230-232): Not a user-definable operator: *=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (243-245): Not a user-definable operator: /=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (256-258): Not a user-definable operator: %=. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (269-271): Not a user-definable operator: ++. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 4403: (282-284): Not a user-definable operator: --. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
|
||||
+5
-5
@@ -6,9 +6,9 @@ using {
|
||||
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 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 ')'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
using {f as} for uint;
|
||||
// ----
|
||||
// ParserError 4403: (11-12): Not a user-definable operator: }. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, !
|
||||
// ParserError 4403: (11-12): Not a user-definable operator: }. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
// ParserError 2314: (13-16): Expected '}' but got 'for'
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
using {f as as} for uint;
|
||||
// ----
|
||||
// ParserError 4403: (12-14): Not a user-definable operator: as. Only the following operators can be user-defined: |, &, ^, ~, <<, >>, +, -, *, /, %, **, ==, !=, <, >, <=, >=, !
|
||||
// ParserError 4403: (12-14): Not a user-definable operator: as. Only the following operators can be user-defined: |, &, ^, ~, +, -, *, /, %, ==, !=, <, >, <=, >=
|
||||
|
||||
+4
-4
@@ -1,13 +1,13 @@
|
||||
==== Source: s1.sol ====
|
||||
type Bool is bool;
|
||||
type Int is int;
|
||||
|
||||
==== Source: s2.sol ====
|
||||
import "s1.sol";
|
||||
|
||||
function not(Bool) pure returns (bool) {}
|
||||
function bitnot(Int) pure returns (Int) {}
|
||||
|
||||
contract C {
|
||||
using {not as !} for Bool global;
|
||||
using {bitnot as ~} for Int global;
|
||||
}
|
||||
// ----
|
||||
// SyntaxError 3367: (s2.sol:78-111): "global" can only be used at file level.
|
||||
// SyntaxError 3367: (s2.sol:79-114): "global" can only be used at file level.
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
==== Source: s1.sol ====
|
||||
type Bool is bool;
|
||||
type Int is int;
|
||||
|
||||
==== Source: s2.sol ====
|
||||
import "s1.sol";
|
||||
|
||||
function not(Bool) pure returns (bool) {}
|
||||
function bitnot(Int) pure returns (Int) {}
|
||||
|
||||
using {not as !} for Bool global;
|
||||
using {bitnot as ~} for Int global;
|
||||
// ----
|
||||
// TypeError 4117: (s2.sol:61-94): Can only use "global" with types defined in the same source unit at file level.
|
||||
// TypeError 4117: (s2.sol:62-97): Can only use "global" with types defined in the same source unit at file level.
|
||||
|
||||
Reference in New Issue
Block a user