summary refs log tree commit diff stats
path: root/tests/fields
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-20 18:50:17 +0100
committerAraq <rumpf_a@web.de>2015-02-20 20:01:24 +0100
commitaef7be2e79831f4cdbd3292a7c5060e403bbff5e (patch)
tree62318c40205a4e74af32a7d9b3a0e973938bb473 /tests/fields
parent540f66cb096077ea377d7184d7d74bb15df023bf (diff)
downloadNim-aef7be2e79831f4cdbd3292a7c5060e403bbff5e.tar.gz
fixes #1902
Diffstat (limited to 'tests/fields')
-rw-r--r--tests/fields/tfields_in_template.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/fields/tfields_in_template.nim b/tests/fields/tfields_in_template.nim
new file mode 100644
index 000000000..9352a7a51
--- /dev/null
+++ b/tests/fields/tfields_in_template.nim
@@ -0,0 +1,15 @@
+discard """
+  output: '''n
+n'''
+"""
+
+# bug #1902
+# This works.
+for name, value in (n: "v").fieldPairs:
+  echo name
+
+# This doesn't compile - "expression 'name' has no type (or is ambiguous)".
+template wrapper: stmt =
+  for name, value in (n: "v").fieldPairs:
+    echo name
+wrapper()