Allow library external functions to be bound with using for

This commit is contained in:
Matheus Aguiar
2023-02-02 13:39:19 -03:00
parent ddbef8f650
commit 2b70b08d5f
29 changed files with 316 additions and 15 deletions
@@ -0,0 +1,31 @@
library L {
function externalFunction(uint a) external pure returns (uint) { return a * 1; }
function publicFunction(uint b) public pure returns (uint) { return b * 2; }
function internalFunction(uint c) internal pure returns (uint) { return c * 3; }
}
contract C {
using {L.externalFunction} for uint;
using {L.publicFunction} for uint;
using {L.internalFunction} for uint;
function f() public pure returns (uint) {
uint x = 1;
return x.externalFunction();
}
function g() public pure returns (uint) {
uint x = 1;
return x.publicFunction();
}
function h() public pure returns (uint) {
uint x = 1;
return x.internalFunction();
}
}
// ----
// library: L
// f() -> 1
// g() -> 2
// h() -> 3