summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2014-03-24 12:17:22 +0200
committerZahary Karadjov <zahary@gmail.com>2014-03-24 12:17:22 +0200
commite8c50640d7a4d386197b8508c82b26f5563060cb (patch)
tree2ea504e656ae44e0b78c0b7030b14f32bccc3942 /tests
parentd310b01db1c6f2c8e63a561c40352b17978e1bdb (diff)
downloadNim-e8c50640d7a4d386197b8508c82b26f5563060cb.tar.gz
failing test case preventing the use of --gc:v2: tsymchoicefield
Diffstat (limited to 'tests')
-rw-r--r--tests/template/tsymchoicefield.nim12
-rw-r--r--tests/vm/tstaticprintseq.nim11
2 files changed, 19 insertions, 4 deletions
diff --git a/tests/template/tsymchoicefield.nim b/tests/template/tsymchoicefield.nim
new file mode 100644
index 000000000..ab05500bf
--- /dev/null
+++ b/tests/template/tsymchoicefield.nim
@@ -0,0 +1,12 @@
+type Foo = object
+  len: int
+
+var f = Foo(len: 40)
+
+template getLen(f: Foo): expr = f.len
+
+echo f.getLen
+# This fails, because `len` gets the nkOpenSymChoice
+# treatment inside the template early pass and then
+# it can't be recognized as a field anymore
+
diff --git a/tests/vm/tstaticprintseq.nim b/tests/vm/tstaticprintseq.nim
index 1fe65cca5..3dfd0048d 100644
--- a/tests/vm/tstaticprintseq.nim
+++ b/tests/vm/tstaticprintseq.nim
@@ -13,6 +13,8 @@ discard """
 3
 aa
 bb
+11
+22
 aa
 bb
 24'''
@@ -45,9 +47,11 @@ type
 const data: TData = (@["aa", "bb"], @[11, 22])
 
 static:
-  var m = data
-  for x in m.letters:
-    echo x
+  var m1 = data
+  for x in m1.letters: echo x
+
+  var m2: TData = data
+  for x in m2.numbers: echo x
 
 macro ff(d: static[TData]): stmt =
   for x in d.letters:
@@ -55,7 +59,6 @@ macro ff(d: static[TData]): stmt =
 
 ff(data)
 
-
 # bug #1010
 
 proc `*==`(x: var int, y: int) {.inline, noSideEffect.} =