summary refs log tree commit diff stats
path: root/tests/ccgbugs
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-06-02 17:23:39 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-06-02 17:23:39 +0200
commit87ffff96d2a59a657631022b8dc227196727d311 (patch)
tree51c8f5adc8ce5aea2437f1fbdc18e694c8e97e90 /tests/ccgbugs
parentc8c50011512fbe1c9149b6e0d7c8f9a741726cca (diff)
downloadNim-87ffff96d2a59a657631022b8dc227196727d311.tar.gz
fixes #4186
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r--tests/ccgbugs/tclosureeq.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ccgbugs/tclosureeq.nim b/tests/ccgbugs/tclosureeq.nim
new file mode 100644
index 000000000..0486a9559
--- /dev/null
+++ b/tests/ccgbugs/tclosureeq.nim
@@ -0,0 +1,19 @@
+discard """
+  output: '''true
+true'''
+"""
+
+# bug #4186
+type
+  Predicate[T] = proc(item: T): bool
+
+proc a[T](): Predicate[T] =
+  return nil
+
+proc b[T](): Predicate[T] =
+  return a[T]()
+
+echo b[int]() == nil  # ok
+
+let x = b[int]()
+echo x == nil     #won't compile