using_07.sol 934 B

123456789101112131415161718192021222324252627282930313233
  1. function foo1() {}
  2. function foo2(int) {}
  3. function foo2(uint) {}
  4. function foo3(int v) returns (int) {
  5. return v * 3;
  6. }
  7. function foo4(int v, int b) returns (int) {
  8. return v * 3 + b;
  9. }
  10. contract C {
  11. using {foo1} for int global;
  12. using {foo2} for * feh;
  13. using {foo3} for uint;
  14. using {foo3, foo4} for int;
  15. function test(int c) public {
  16. int a = c.foo3();
  17. a.foo4(1);
  18. }
  19. }
  20. // ---- Expect: diagnostics ----
  21. // error: 12:9-13: 'foo1' has no arguments. At least one argument required
  22. // note 1:10-14: definition of 'foo1'
  23. // error: 12:23-29: 'global' on using within contract not permitted
  24. // error: 13:9-13: 'foo2' is an overloaded function
  25. // note 2:10-14: definition of 'foo2'
  26. // note 3:1-21: definition of 'foo2'
  27. // error: 13:21-24: 'feh' not expected, did you mean 'global'?
  28. // error: 14:9-13: function cannot be used since first argument is 'int256' rather than the required 'uint256'
  29. // note 4:10-14: definition of 'foo3'