teval1.nim 546 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. discard """
  2. nimout: "##"
  3. """
  4. import macros
  5. proc testProc: string {.compileTime.} =
  6. result = ""
  7. result = result & ""
  8. when true:
  9. macro test(n: untyped): untyped =
  10. result = newNimNode(nnkStmtList)
  11. echo "#", testProc(), "#"
  12. test:
  13. "hi"
  14. const
  15. x = testProc()
  16. doAssert x == ""
  17. # bug #1310
  18. static:
  19. var i, j: set[int8] = {}
  20. var k = i + j
  21. type
  22. Obj = object
  23. x: int
  24. converter toObj(x: int): Obj = Obj(x: x)
  25. # bug #10514
  26. block:
  27. const
  28. b: Obj = 42
  29. bar = [b]
  30. let i_runtime = 0
  31. doAssert bar[i_runtime] == b