Added test for #1846.
This commit is contained in:
parent
ac71ece673
commit
19ea2672c5
1 changed files with 16 additions and 0 deletions
16
tests/closure/tissue1846.nim
Normal file
16
tests/closure/tissue1846.nim
Normal file
|
|
@ -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)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue