summary refs log tree commit diff stats
path: root/tests/closure
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@gmail.com>2016-01-16 13:58:40 +0000
committerDominik Picheta <dominikpicheta@gmail.com>2016-01-16 13:58:40 +0000
commit19ea2672c545288c8cf4b4bd925ed3fd3bdd88b2 (patch)
treecf36fff2fb5256e0ea691dfba14469ca56d81ff6 /tests/closure
parentac71ece6738b14019d0512b4d93394cea2ab924d (diff)
downloadNim-19ea2672c545288c8cf4b4bd925ed3fd3bdd88b2.tar.gz
Added test for #1846.
Diffstat (limited to 'tests/closure')
-rw-r--r--tests/closure/tissue1846.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/closure/tissue1846.nim b/tests/closure/tissue1846.nim
new file mode 100644
index 000000000..3fbef169d
--- /dev/null
+++ b/tests/closure/tissue1846.nim
@@ -0,0 +1,16 @@
+type
+    TBinOp*[T] = proc (x,y: T): bool
+
+    THeap*[T] = object
+        cmp*:   TBinOp[T]
+
+proc less*[T](x,y: T): bool =
+    x < y
+
+proc initHeap*[T](cmp: TBinOp[T]): THeap[T] =
+    result.cmp = cmp
+
+when isMainModule:
+    var h = initHeap[int](less[int])
+
+    echo h.cmp(2,3)
\ No newline at end of file