mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add test cases for user type operators with global using for directive
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
==== Source: s1.sol ====
|
||||
type Int is int;
|
||||
using {add as +} for Int global;
|
||||
|
||||
function add(Int, Int) pure returns (Int) {
|
||||
return Int.wrap(3);
|
||||
}
|
||||
|
||||
==== Source: s2.sol ====
|
||||
import "s1.sol";
|
||||
|
||||
using {another_add as +} for Int;
|
||||
|
||||
function another_add(Int, Int) pure returns (Int) {
|
||||
return Int.wrap(3);
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
Int.wrap(0) + Int.wrap(0);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2271: (s2.sol:184-209): Operator + not compatible with types Int and Int. Multiple user-defined functions provided for this operator.
|
||||
@@ -0,0 +1,15 @@
|
||||
==== Source: s1.sol ====
|
||||
type Int is int;
|
||||
using {add as +} for Int global;
|
||||
|
||||
function add(Int, Int) pure returns (Int) {
|
||||
return Int.wrap(3);
|
||||
}
|
||||
|
||||
==== Source: s2.sol ====
|
||||
import "s1.sol";
|
||||
contract C {
|
||||
function f() pure public {
|
||||
Int.wrap(0) + Int.wrap(0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user