tunknown_named_parameter.nim 788 B

12345678910111213141516171819202122232425262728
  1. discard """
  2. cmd: "nim check $file"
  3. errormsg: "type mismatch: got <string, set[char], maxsplits: int literal(1)>"
  4. nimout: '''
  5. func rsplit(s: string; sep: char; maxsplit: int = -1): seq[string]
  6. first type mismatch at position: 2
  7. required type for sep: char
  8. but expression '{':'}' is of type: set[char]
  9. func rsplit(s: string; sep: string; maxsplit: int = -1): seq[string]
  10. first type mismatch at position: 2
  11. required type for sep: string
  12. but expression '{':'}' is of type: set[char]
  13. func rsplit(s: string; seps: set[char] = Whitespace; maxsplit: int = -1): seq[
  14. string]
  15. first type mismatch at position: 3
  16. unknown named parameter: maxsplits
  17. expression: rsplit("abc:def", {':'}, maxsplits = 1)
  18. '''
  19. """
  20. # bug #8043
  21. import strutils
  22. "abc:def".rsplit({':'}, maxsplits = 1)