summary refs log tree commit diff stats
path: root/tests/generics/t8694.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-10-01 08:53:35 +0200
committerGitHub <noreply@github.com>2018-10-01 08:53:35 +0200
commit3d60f1b0af6fc3d8d9446a87bd26ff054562fa20 (patch)
tree61fd6089fe9e4ff03bce388e635777a1d0b0b1cc /tests/generics/t8694.nim
parent5676e032bda9d86232b003797bdb67070af43e28 (diff)
parent6d4503325cc667dcfd18c53cee6ef0d245d9f870 (diff)
downloadNim-3d60f1b0af6fc3d8d9446a87bd26ff054562fa20.tar.gz
Merge pull request #9131 from LemonBoy/fix-9130
Fix regression with runnableExamples in generic expr
Diffstat (limited to 'tests/generics/t8694.nim')
-rw-r--r--tests/generics/t8694.nim31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/generics/t8694.nim b/tests/generics/t8694.nim
new file mode 100644
index 000000000..da6c6dbed
--- /dev/null
+++ b/tests/generics/t8694.nim
@@ -0,0 +1,31 @@
+discard """
+  output: '''
+true
+true
+true
+'''
+"""
+
+when true:
+  # Error: undeclared identifier: '|'
+  proc bar[T](t:T): bool =
+    runnableExamples:
+      type Foo = int | float
+    true
+  echo bar(0)
+
+when true:
+  # ok
+  proc bar(t:int): bool =
+    runnableExamples:
+      type Foo = int | float
+    true
+  echo bar(0)
+
+when true:
+  # Error: undeclared identifier: '|'
+  proc bar(t:typedesc): bool =
+    runnableExamples:
+      type Foo = int | float
+    true
+  echo bar(int)