summary refs log tree commit diff stats
path: root/tests/array
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-08-30 23:01:15 +0200
committerGitHub <noreply@github.com>2018-08-30 23:01:15 +0200
commitdf4d5b77a14b3b84f3ff37b3741dd039c9e21ce4 (patch)
tree79693afbc7fc9ba2385c8807bff2c955dbf35926 /tests/array
parentdfdf8e58c711cadaeb9f830f128eef28aeb6f1ab (diff)
downloadNim-df4d5b77a14b3b84f3ff37b3741dd039c9e21ce4.tar.gz
introduce precise string '[]', '[]=' accessors; fixes #8049 (#8817)
Diffstat (limited to 'tests/array')
-rw-r--r--tests/array/tarrindx.nim14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/array/tarrindx.nim b/tests/array/tarrindx.nim
index 3bb6b0148..9e8ec31b6 100644
--- a/tests/array/tarrindx.nim
+++ b/tests/array/tarrindx.nim
@@ -1,6 +1,8 @@
 discard """
   output: '''0
-0'''
+0
+bc
+bcdefg'''
 """
 
 # test another strange bug ... (I hate this compiler; it is much too buggy!)
@@ -29,3 +31,13 @@ var
 
 echo obj.s1[0]
 echo obj.s1[0u]
+
+
+# bug #8049
+
+when true:
+  type ustring* = distinct string
+  converter toUString*(s: string): ustring = ustring(s)
+  proc `[]`*(s: ustring, i: int): ustring = s
+  echo "abcdefgh"[1..2]
+  echo "abcdefgh"[1..^2]