mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add user operator test cases
This commit is contained in:
+12
@@ -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.
|
||||
+12
@@ -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 '*').
|
||||
+12
@@ -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
|
||||
Reference in New Issue
Block a user