mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-27 15:25:12 +00:00
#25290 drafted bc if this passes full CI I am going to try and remove that weird stuff in `pickBestCandidate`
35 lines
635 B
Nim
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".}
|