untyped.nim 383 B

12345678910111213141516
  1. discard """
  2. errormsg: "'untyped' is only allowed in templates and macros or magic procs"
  3. line: 14
  4. """
  5. # magic procs are allowed with `untyped`
  6. proc declaredInScope2*(x: untyped): bool {.magic: "DefinedInScope", noSideEffect, compileTime.}
  7. proc bar(): bool =
  8. var x = 1
  9. declaredInScope2(x)
  10. static: doAssert bar()
  11. # but not non-magic procs
  12. proc fun(x:untyped)=discard
  13. fun(10)