fixes #297
This commit is contained in:
parent
a4ccd7b865
commit
5d6053173a
1 changed files with 32 additions and 0 deletions
32
tests/typerel/texplicitcmp.nim
Normal file
32
tests/typerel/texplicitcmp.nim
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
discard """
|
||||||
|
output: '''[1 2 3 ]
|
||||||
|
[1 2 3 ]
|
||||||
|
[1 2 3 ]'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #297
|
||||||
|
|
||||||
|
import json, tables, algorithm
|
||||||
|
|
||||||
|
proc outp(a: openarray[int]) =
|
||||||
|
stdout.write "["
|
||||||
|
for i in a: stdout.write($i & " ")
|
||||||
|
stdout.write "]\n"
|
||||||
|
|
||||||
|
proc works() =
|
||||||
|
var f = @[3, 2, 1]
|
||||||
|
sort(f, system.cmp[int])
|
||||||
|
outp(f)
|
||||||
|
|
||||||
|
proc weird(json_params: TTable) =
|
||||||
|
var f = @[3, 2, 1]
|
||||||
|
# The following line doesn't compile: type mismatch. Why?
|
||||||
|
sort(f, system.cmp[int])
|
||||||
|
outp(f)
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
var t = @[3, 2, 1]
|
||||||
|
sort(t, system.cmp[int])
|
||||||
|
outp(t)
|
||||||
|
works()
|
||||||
|
weird(initTable[string, TJsonNode]())
|
||||||
Loading…
Add table
Add a link
Reference in a new issue