mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Using for for operators.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
type Type is uint;
|
||||
using {f as +} for Type;
|
||||
function f(Type, Type) pure returns (Type) {}
|
||||
|
||||
Type constant t = Type.wrap(1);
|
||||
Type constant u = v + t;
|
||||
Type constant v = u + t;
|
||||
// ----
|
||||
// TypeError 8349: (141-146): Initial value for constant variable has to be compile-time constant.
|
||||
// TypeError 8349: (166-171): Initial value for constant variable has to be compile-time constant.
|
||||
@@ -0,0 +1,4 @@
|
||||
using {f as +} for uint;
|
||||
function f(uint, uint) pure returns (uint) {}
|
||||
// ----
|
||||
// TypeError 5332: (7-8): Operators can only be implemented for user-defined types and not for contracts.
|
||||
Reference in New Issue
Block a user