(cherry picked from commit c5a72ebddd)
This commit is contained in:
Bung
2022-12-22 13:16:25 +08:00
committed by narimiran
parent 24e4099d36
commit c25621d153
2 changed files with 14 additions and 0 deletions

View File

@@ -2123,6 +2123,8 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType,
elif arg.sym.kind in {skMacro, skTemplate}:
return nil
else:
if arg.sym.ast == nil:
return nil
let inferred = c.semGenerateInstance(c, arg.sym, m.bindings, arg.info)
result = newSymNode(inferred, arg.info)
if r == isInferredConvertible:

12
tests/misc/t16541.nim Normal file
View File

@@ -0,0 +1,12 @@
discard """
action: "reject"
"""
import strutils, sugar, nre
proc my_replace*(s: string, r: Regex, by: string | (proc (match: string): string)): string =
nre.replace(s, r, by)
discard my_replace("abcde", re"[bcd]", match => match.to_upper) == "aBCDe"
discard my_replace("abcde", re"[bcd]", (match: string) => match.to_upper) == "aBCDe"