From 19ea2672c545288c8cf4b4bd925ed3fd3bdd88b2 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sat, 16 Jan 2016 13:58:40 +0000 Subject: [PATCH] Added test for #1846. --- tests/closure/tissue1846.nim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/closure/tissue1846.nim diff --git a/tests/closure/tissue1846.nim b/tests/closure/tissue1846.nim new file mode 100644 index 0000000000..3fbef169d2 --- /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