Add user operator tests for builtin types

This commit is contained in:
wechman
2022-09-28 13:07:58 +02:00
parent 6feb8aea73
commit e0c688d55d
3 changed files with 26 additions and 2 deletions
@@ -1,4 +1,21 @@
using {f as +} for uint;
using {f as +} for uint[2];
using {f as +} for mapping(uint => uint);
using {f as +} for function (uint) pure returns (uint);
using {f as +} for I;
using {f as +} for C;
using {f as +} for string;
function f(uint, uint) pure returns (uint) {}
interface I {}
contract C {}
// ----
// TypeError 5332: (7-8): Operators can only be implemented for user-defined types and not for contracts.
// TypeError 5332: (7-8): Operators can only be implemented for user-defined value types and structs.
// TypeError 5332: (32-33): Operators can only be implemented for user-defined value types and structs.
// TypeError 5332: (60-61): Operators can only be implemented for user-defined value types and structs.
// TypeError 5332: (102-103): Operators can only be implemented for user-defined value types and structs.
// TypeError 5332: (158-159): Operators can only be implemented for user-defined value types and structs.
// TypeError 5332: (180-181): Operators can only be implemented for user-defined value types and structs.
// TypeError 5332: (202-203): Operators can only be implemented for user-defined value types and structs.
@@ -0,0 +1,7 @@
using {f as +} for L;
function f() {}
library L {}
// ----
// TypeError 1130: (19-20): Invalid use of a library name.