tnested.nim 699 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. block: # issue #22775
  2. proc h(c: int) = discard
  3. template k(v: int) =
  4. template p() = v.h()
  5. p()
  6. let a = @[0]
  7. k(0 and not a[0])
  8. block: # issue #22775 case 2
  9. proc h(c: int, q: int) = discard
  10. template k(v: int) =
  11. template p() = h(v, v)
  12. p()
  13. let a = [0]
  14. k(0 and not a[0])
  15. block: # issue #22775 minimal cases
  16. proc h(c: int) = discard
  17. template k(v: int) =
  18. template p() = h(v)
  19. p()
  20. let a = [0]
  21. k(not a[0])
  22. block:
  23. k(-a[0])
  24. block:
  25. proc f(x: int): int = x
  26. k(f a[0])
  27. block: # bracket assignment case of above tests
  28. proc h(c: int) = discard
  29. template k(v: int) =
  30. template p() = h(v)
  31. p()
  32. var a = [0]
  33. k(not (block:
  34. a[0] = 1
  35. 1))