diff options
Diffstat (limited to 'tests/generics/tconfusing_arrow.nim')
-rw-r--r-- | tests/generics/tconfusing_arrow.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/generics/tconfusing_arrow.nim b/tests/generics/tconfusing_arrow.nim new file mode 100644 index 000000000..6a5a9d682 --- /dev/null +++ b/tests/generics/tconfusing_arrow.nim @@ -0,0 +1,15 @@ +import algorithm, future + +type Deck = object + value: int + +proc sort(h: var seq[Deck]) = + # works: + h.sort(proc (x, y: Deck): auto = + cmp(x.value, y.value)) + # fails: + h.sort((x, y: Deck) => cmp(ord(x.value), ord(y.value))) + +var player: seq[Deck] = @[] + +player.sort() |