using_functions.sol 560 B

12345678910111213141516171819202122232425262728293031
  1. contract C {
  2. function foo(int256 a) internal pure returns (int256) {
  3. return a;
  4. }
  5. }
  6. library L {
  7. function bar(int256 a) internal pure returns (int256) {
  8. return a;
  9. }
  10. }
  11. library Lib {
  12. function baz(int256 a, bool b) internal pure returns (int256) {
  13. if (b) {
  14. return 1;
  15. } else {
  16. return a;
  17. }
  18. }
  19. using {L.bar, baz} for int256;
  20. }
  21. library Lib2 {
  22. using {L.foo.bar, C.foo} for int256;
  23. }
  24. // ---- Expect: diagnostics ----
  25. // error: 25:15-18: 'foo' not found
  26. // error: 25:20-25: 'C.foo' is not a library function
  27. // note 2:2-55: definition of C.foo