tfields_in_template.nim 284 B

12345678910111213141516
  1. discard """
  2. output: '''n
  3. n'''
  4. """
  5. # bug #1902
  6. # This works.
  7. for name, value in (n: "v").fieldPairs:
  8. echo name
  9. # This doesn't compile - "expression 'name' has no type (or is ambiguous)".
  10. template wrapper: typed =
  11. for name, value in (n: "v").fieldPairs:
  12. echo name
  13. wrapper()