Files
Nim/tests/overload/t25290.nim
Ryan McConnell 2501e23d81 fixes #25290; tempalte overload scope dupe (#25308)
#25290
drafted bc if this passes full CI I am going to try and remove that
weird stuff in `pickBestCandidate`
2026-04-09 20:44:35 +02:00

35 lines
635 B
Nim

proc temp(one: int, two: int, three: int) =
discard
template temp(body: untyped): untyped =
body
temp:
proc a(tp: int) =
discard
proc mixedTemp(x: int) =
discard
proc mixedTemp(x: bool) =
discard
template mixedTemp(body: untyped): untyped =
body
# The `bool` proc should win here so `xx` survives
mixedTemp (let xx = 1; true)
discard xx
proc sinkTemp(x: int) =
discard
template sinkTemp(body: untyped): untyped =
discard
# Here the template should win here so `let xy` is sunk into template as AST
sinkTemp (let xy = "template"; xy)
when declared(xy):
{.error: "xy leaked from failed proc candidate".}