Files
Nim/tests/misc/t12869.nim
Bung 5917c2d5b7 fix #15836 proc arg return type auto unexpectly match proc with concr… (#21065)
* fix #15836 proc arg return type auto unexpectly match proc with concrete type

* fix #16244

* add test case for #12869
2022-12-12 06:26:18 +01:00

15 lines
352 B
Nim

discard """
errormsg: "type mismatch: got <bool> but expected 'int'"
line: 12
"""
import sugar
from algorithm import sorted, SortOrder
let a = 5
proc sorted*[T](a: openArray[T], key: proc(v: T): int, order = SortOrder.Ascending): seq[T] =
sorted(a, (x, y) => key(x) < key(y), order)
echo sorted(@[9, 1, 8, 2, 6, 4, 5, 0], (x) => (a - x).abs)