using_06.sol 579 B

123456789101112131415161718
  1. contract test {
  2. using ints for uint32;
  3. function foo(uint32 x) public pure returns (uint64) {
  4. // x is 32 bit but the max function takes 64 bit uint
  5. return x.max(65536, 2);
  6. }
  7. }
  8. library ints {
  9. uint64 constant nada = 0;
  10. function max(uint64 a, uint64 b) internal pure returns (uint64) {
  11. return a > b ? a : b;
  12. }
  13. }
  14. // ---- Expect: diagnostics ----
  15. // error: 6:24-39: using function expects 2 arguments, 3 provided (including self)