diff options
author | flywind <43030857+xflywind@users.noreply.github.com> | 2021-01-16 00:23:49 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 22:23:49 -0800 |
commit | e4a529962e7df83d6297a68f5a1913358119b632 (patch) | |
tree | f9811280d6519329f27d8c63b6cb6a63fd762852 /tests | |
parent | 5ed6a94d8f1c13abb1681f5425a59d2bac827242 (diff) | |
download | Nim-e4a529962e7df83d6297a68f5a1913358119b632.tar.gz |
close #10735 add testcase (#16690)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/errmsgs/t10735.nim | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/errmsgs/t10735.nim b/tests/errmsgs/t10735.nim new file mode 100644 index 000000000..514c4f101 --- /dev/null +++ b/tests/errmsgs/t10735.nim @@ -0,0 +1,41 @@ +discard """ + cmd: "nim check $file" + errormsg: "selector must be of an ordinal type, float or string" + nimout: ''' +t10735.nim(38, 5) Error: 'let' symbol requires an initialization +t10735.nim(39, 10) Error: undeclared identifier: 'pos' +t10735.nim(39, 9) Error: type mismatch: got <cstring, > +but expected one of: +proc `[]`(s: string; i: BackwardsIndex): char + first type mismatch at position: 0 +proc `[]`(s: var string; i: BackwardsIndex): var char + first type mismatch at position: 0 +proc `[]`[I: Ordinal; T](a: T; i: I): T + first type mismatch at position: 0 +proc `[]`[Idx, T, U, V](a: array[Idx, T]; x: HSlice[U, V]): seq[T] + first type mismatch at position: 0 +proc `[]`[Idx, T](a: array[Idx, T]; i: BackwardsIndex): T + first type mismatch at position: 0 +proc `[]`[Idx, T](a: var array[Idx, T]; i: BackwardsIndex): var T + first type mismatch at position: 0 +proc `[]`[T, U, V](s: openArray[T]; x: HSlice[U, V]): seq[T] + first type mismatch at position: 0 +proc `[]`[T, U](s: string; x: HSlice[T, U]): string + first type mismatch at position: 0 +proc `[]`[T](s: openArray[T]; i: BackwardsIndex): T + first type mismatch at position: 0 +proc `[]`[T](s: var openArray[T]; i: BackwardsIndex): var T + first type mismatch at position: 0 +template `[]`(s: string; i: int): char + first type mismatch at position: 0 + +expression: `[]`(buf, pos) +t10735.nim(39, 9) Error: selector must be of an ordinal type, float or string +''' + joinable: false +""" + +let buf: cstring +case buf[pos] +else: + case buf[pos] |