mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
Reverts #24184, reopens #12942, reopens #19118 #24184 seems to have caused a regression in https://github.com/c-blake/thes and https://github.com/c-blake/bu/blob/main/rp.nim#L84 reproducible with `git clone https://github.com/c-blake/cligen; git clone https://github.com/c-blake/thes; cd thes; nim c -p=../cligen thes`. Changing the `const` to `let` makes it compile. A minimization that is probably the same issue is: ```nim const a: seq[string] = @[] proc foo(x = a) = echo typeof(x) echo x import macros macro resemFoo() = result = getImpl(bindSym"foo") block: resemFoo() # Error: cannot infer the type of parameter 'x' ``` This should be a regression test in a future reimplementation of #24184.
28 lines
788 B
Nim
28 lines
788 B
Nim
discard """
|
|
cmd: "nim check $file"
|
|
errormsg: "type mismatch: got <string, set[char], maxsplits: int literal(1)>"
|
|
nimout: '''
|
|
func rsplit(s: string; sep: char; maxsplit: int = -1): seq[string]
|
|
first type mismatch at position: 2
|
|
required type for sep: char
|
|
but expression '{':'}' is of type: set[char]
|
|
func rsplit(s: string; sep: string; maxsplit: int = -1): seq[string]
|
|
first type mismatch at position: 2
|
|
required type for sep: string
|
|
but expression '{':'}' is of type: set[char]
|
|
func rsplit(s: string; seps: set[char] = Whitespace; maxsplit: int = -1): seq[
|
|
string]
|
|
first type mismatch at position: 3
|
|
unknown named parameter: maxsplits
|
|
|
|
expression: rsplit("abc:def", {':'}, maxsplits = 1)
|
|
'''
|
|
"""
|
|
|
|
|
|
# bug #8043
|
|
|
|
|
|
import strutils
|
|
"abc:def".rsplit({':'}, maxsplits = 1)
|