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 14:15:35 +0200
committerGitHub <noreply@github.com>2018-10-01 14:15:35 +0200
commite867c8e5c3cf5c08c703e76434fc7db962f755f7 (patch)
tree077eea3f3e0986363d8296b1b74cefcceb7310e5 /tests/generics/t8694.nim
parentaa8249d177cbac4a3c08348ea6dbe12d6526928d (diff)
parent5298c509a7b0168f0edce9b28442feca914d15f7 (diff)
downloadNim-e867c8e5c3cf5c08c703e76434fc7db962f755f7.tar.gz
Merge branch 'devel' into fix_issues_9126
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)