tpragma.nim 668 B

1234567891011121314151617181920212223242526272829
  1. # issue #24186
  2. macro mymacro(typ: typedesc; def) =
  3. def
  4. macro mymacro2(typ: typedesc; typ2: typedesc; def) =
  5. def
  6. template mytemplate(typ: typedesc) = # works
  7. proc myproc() {.mymacro: typ .} =
  8. discard
  9. template mytemplate2(typ: typedesc) = # Error: undeclared identifier: 'typ'
  10. proc myproc2() {.mymacro(typ) .} =
  11. discard
  12. template mytemplate3(typ: typedesc, typ2: typedesc) = # Error: undeclared identifier: 'typ'
  13. proc myproc3() {.mymacro2(typ, typ2) .} =
  14. discard
  15. template mytemplate4() = # works
  16. proc myproc4() {.mymacro2(string, int) .} =
  17. discard
  18. mytemplate(string)
  19. mytemplate2(string)
  20. mytemplate3(string, int)
  21. mytemplate4()