summary refs log tree commit diff stats
path: root/tests/errmsgs/tshow_asgn.nim
blob: 28a9acbeb38692657b1f956dac8cf335778a93e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
discard """
  errormsg: "type mismatch: got <int> but expected 'cshort = int16'"
  line: 12
  column: 27
  file: "tshow_asgn.nim"
"""

# bug #5430

proc random*[T](x: Slice[T]): T =
  ## For a slice `a .. b` returns a value in the range `a .. b-1`.
  result = int(x.b - x.a) + x.a

let slice = 10.cshort..15.cshort
discard slice.random