fixes #5430
This commit is contained in:
parent
d91d338d03
commit
2589d69ed2
12 changed files with 58 additions and 42 deletions
15
tests/errmsgs/tshow_asgn.nim
Normal file
15
tests/errmsgs/tshow_asgn.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got (int) but expected 'cshort = int16'"
|
||||
line: 12
|
||||
column: 10
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue