t10735.nim 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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: Ordinal](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: Ordinal](s: string; x: HSlice[T, U]): string
  22. first type mismatch at position: 0
  23. proc `[]`[T; U, V: Ordinal](s: openArray[T]; x: HSlice[U, V]): seq[T]
  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. expression: `[]`(buf, pos)
  32. t10735.nim(39, 9) Error: selector must be of an ordinal type, float or string
  33. '''
  34. joinable: false
  35. """
  36. let buf: cstring
  37. case buf[pos]
  38. else:
  39. case buf[pos]