summary refs log tree commit diff stats
path: root/tests/errmsgs/tshow_asgn.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errmsgs/tshow_asgn.nim')
-rw-r--r--tests/errmsgs/tshow_asgn.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/errmsgs/tshow_asgn.nim b/tests/errmsgs/tshow_asgn.nim
new file mode 100644
index 000000000..28a9acbeb
--- /dev/null
+++ b/tests/errmsgs/tshow_asgn.nim
@@ -0,0 +1,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