mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow comparison operators on contracts
This commit is contained in:
+3
-3
@@ -20,8 +20,8 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// TypeError 2271: (144-157): Operator != not compatible with types type(contract super C) and contract C
|
||||
// TypeError 2271: (167-180): Operator != not compatible with types contract C and type(contract super C)
|
||||
// TypeError 2271: (167-180): Operator != not compatible with types contract C and type(contract super C). No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
// TypeError 2271: (254-264): Operator != not compatible with types type(contract super C) and contract C
|
||||
// TypeError 2271: (274-284): Operator != not compatible with types contract C and type(contract super C)
|
||||
// TypeError 2271: (274-284): Operator != not compatible with types contract C and type(contract super C). No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
// TypeError 2271: (349-359): Operator != not compatible with types type(contract super C) and contract D
|
||||
// TypeError 2271: (369-379): Operator != not compatible with types contract D and type(contract super C)
|
||||
// TypeError 2271: (369-379): Operator != not compatible with types contract D and type(contract super C). No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
contract C {
|
||||
function f(string calldata data) external pure {
|
||||
C c;
|
||||
assert(this == this);
|
||||
|
||||
assert(this == c);
|
||||
assert(this != c);
|
||||
assert(this >= c);
|
||||
assert(this <= c);
|
||||
assert(this < c);
|
||||
assert(this > c);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2271: (79-91): Operator == not compatible with types contract C and contract C. No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
// TypeError 2271: (104-113): Operator == not compatible with types contract C and contract C. No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
// TypeError 2271: (125-134): Operator != not compatible with types contract C and contract C. No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
// TypeError 2271: (146-155): Operator >= not compatible with types contract C and contract C. No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
// TypeError 2271: (167-176): Operator <= not compatible with types contract C and contract C. No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
// TypeError 2271: (188-196): Operator < not compatible with types contract C and contract C. No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
// TypeError 2271: (208-216): Operator > not compatible with types contract C and contract C. No arithmetic or comparison operations are allowed on contract types. Consider converting to "address".
|
||||
Reference in New Issue
Block a user