Skip to content

Commit e4a5299

Browse files
authored
close #10735 add testcase (#16690)
1 parent 5ed6a94 commit e4a5299

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/errmsgs/t10735.nim

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
discard """
2+
cmd: "nim check $file"
3+
errormsg: "selector must be of an ordinal type, float or string"
4+
nimout: '''
5+
t10735.nim(38, 5) Error: 'let' symbol requires an initialization
6+
t10735.nim(39, 10) Error: undeclared identifier: 'pos'
7+
t10735.nim(39, 9) Error: type mismatch: got <cstring, >
8+
but expected one of:
9+
proc `[]`(s: string; i: BackwardsIndex): char
10+
first type mismatch at position: 0
11+
proc `[]`(s: var string; i: BackwardsIndex): var char
12+
first type mismatch at position: 0
13+
proc `[]`[I: Ordinal; T](a: T; i: I): T
14+
first type mismatch at position: 0
15+
proc `[]`[Idx, T, U, V](a: array[Idx, T]; x: HSlice[U, V]): seq[T]
16+
first type mismatch at position: 0
17+
proc `[]`[Idx, T](a: array[Idx, T]; i: BackwardsIndex): T
18+
first type mismatch at position: 0
19+
proc `[]`[Idx, T](a: var array[Idx, T]; i: BackwardsIndex): var T
20+
first type mismatch at position: 0
21+
proc `[]`[T, U, V](s: openArray[T]; x: HSlice[U, V]): seq[T]
22+
first type mismatch at position: 0
23+
proc `[]`[T, U](s: string; x: HSlice[T, U]): string
24+
first type mismatch at position: 0
25+
proc `[]`[T](s: openArray[T]; i: BackwardsIndex): T
26+
first type mismatch at position: 0
27+
proc `[]`[T](s: var openArray[T]; i: BackwardsIndex): var T
28+
first type mismatch at position: 0
29+
template `[]`(s: string; i: int): char
30+
first type mismatch at position: 0
31+
32+
expression: `[]`(buf, pos)
33+
t10735.nim(39, 9) Error: selector must be of an ordinal type, float or string
34+
'''
35+
joinable: false
36+
"""
37+
38+
let buf: cstring
39+
case buf[pos]
40+
else:
41+
case buf[pos]

0 commit comments

Comments
 (0)