solidity/test/libsolidity/semanticTests/libraries/internal_library_function_bound_to_enum.sol

22 lines
390 B
Solidity

library L {
enum E { A, B }
function equals(E a, E b) internal pure returns (bool) {
return a == b;
}
}
contract C {
using L for L.E;
function equalsA(uint choice) public returns (bool) {
L.E x = L.E.A;
return x.equals(L.E(choice));
}
}
// ====
// compileViaYul: also
// ----
// equalsA(uint256): 0 -> true
// equalsA(uint256): 1 -> false