fixup! User-defined operators: Tests

This commit is contained in:
Kamil Śliwak 2023-01-18 14:13:27 +01:00
parent 1edb74dbc9
commit cd83d09cf3
2 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1,9 @@
type Int is int128;
library L {
function privateOperator(Int, Int) private pure returns (Int) {}
}
using {L.privateOperator as +} for Int;
// ----
// TypeError 6772: (112-129): Function "L.privateOperator" is private and therefore cannot be attached to a type outside of the library where it is defined.

View File

@ -3,11 +3,7 @@ type Int is int128;
library L {
function publicOperator(Int, Int) public pure returns (Int) {}
function internalOperator(Int, Int) internal pure returns (Int) {}
function privateOperator(Int, Int) private pure returns (Int) {}
}
using {L.publicOperator as +} for Int;
using {L.internalOperator as +} for Int;
// FIXME: Being able to use private library functions in a file-level 'using for' is a bug.
// See: https://github.com/ethereum/solidity/issues/13764
using {L.privateOperator as +} for Int;