Add user operator test cases

This commit is contained in:
wechman
2022-09-28 13:06:25 +02:00
parent 3be5114fb0
commit 7d12eb5745
7 changed files with 144 additions and 0 deletions
@@ -0,0 +1,12 @@
type Int is int;
function add(Int, Int) returns (Int) {
return Int.wrap(0);
}
contract C {
using {add as +} for *;
}
// ----
// SyntaxError 3349: (101-124): The type has to be specified explicitly when attaching specific functions.
@@ -0,0 +1,12 @@
type Int is int;
contract C {
using {add as +} for Int;
function add(Int, Int) public returns (Int) {
return 0;
}
}
// ----
// TypeError 4167: (42-45): Only file-level functions and library functions can be bound to a type in a "using" statement
@@ -0,0 +1,8 @@
using {add as +} for *;
function add(int, int) returns (int) {
return 0;
}
// ----
// SyntaxError 8118: (0-23): The type has to be specified explicitly at file level (cannot use '*').
@@ -0,0 +1,12 @@
type Int is int;
using {C.add as +} for Int;
contract C {
function add(Int, Int) public returns (Int) {
return 0;
}
}
// ----
// TypeError 4167: (25-30): Only file-level functions and library functions can be bound to a type in a "using" statement