now.sol 997 B

1234567891011121314151617181920212223242526272829303132
  1. contract c {
  2. struct S { int f1; }
  3. function f(S s) public returns (int) {
  4. return now.s;
  5. }
  6. function g() public {
  7. now();
  8. }
  9. function h() public returns (uint) {
  10. return now;
  11. }
  12. function j() public returns (bool) {
  13. return now > 102;
  14. }
  15. function k() public returns (int) {
  16. int now = 5;
  17. return now;
  18. }
  19. event LockRecord(address a,uint n,uint256 m);
  20. function foo() public {
  21. emit LockRecord(address(this), now, 34);
  22. emit LockRecord({a: address(this), n: now, m: 34});
  23. }
  24. }
  25. // ---- Expect: diagnostics ----
  26. // error: 4:10-13: 'now' not found
  27. // error: 7:3-6: unknown function or type 'now'
  28. // error: 10:10-13: 'now' not found. 'now' was an alias for 'block.timestamp' in older versions of the Solidity language. Please use 'block.timestamp' instead.
  29. // error: 13:10-13: 'now' not found. 'now' was an alias for 'block.timestamp' in older versions of the Solidity language. Please use 'block.timestamp' instead.
  30. // error: 21:34-37: 'now' not found
  31. // error: 22:41-44: 'now' not found