tconstprocassignments.nim 472 B

12345678910111213141516171819202122232425262728293031323334
  1. discard """
  2. output: '''
  3. 100
  4. 100
  5. '''
  6. """
  7. proc f():int {.compileTime.} = 100
  8. const F = f
  9. echo F()
  10. const G = proc ():int =
  11. let x = f
  12. let y = x
  13. y()
  14. echo G()
  15. block: # bug #24359
  16. block:
  17. proc h(_: bool) = discard
  18. const m = h
  19. static: m(true) # works
  20. m(true) # does not work
  21. block:
  22. block:
  23. proc h(_: bool): int = result = 1
  24. const m = h
  25. static: doAssert m(true) == 1 # works
  26. doAssert m(true) == 1 # does not work