mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 22:33:49 +00:00
* test disable do: block lambda lifting * fix last test [skip ci] * deprecate `do:` meaning `do ():` + misc cleanup closes https://github.com/nim-lang/RFCs/issues/486 * oops * fix * no idea what could be causing nimsuggest failure other than this * ensure ci works
34 lines
812 B
Nim
34 lines
812 B
Nim
{.push warningAsError[ImplicitTemplateRedefinition]: on.}
|
|
|
|
doAssert not (compiles do:
|
|
template foo(): int = 1
|
|
template foo(): int = 2)
|
|
doAssert (compiles do:
|
|
template foo(): int = 1
|
|
template foo(): int {.redefine.} = 2)
|
|
doAssert not (compiles do:
|
|
block:
|
|
template foo() =
|
|
template bar: string {.gensym.} = "a"
|
|
template bar: string {.gensym.} = "b"
|
|
foo())
|
|
doAssert (compiles do:
|
|
block:
|
|
template foo() =
|
|
template bar: string {.gensym.} = "a"
|
|
template bar: string {.gensym, redefine.} = "b"
|
|
foo())
|
|
|
|
block:
|
|
template foo(): int = 1
|
|
template foo(): int {.redefine.} = 2
|
|
doAssert foo() == 2
|
|
block:
|
|
template foo(): string =
|
|
template bar: string {.gensym.} = "a"
|
|
template bar: string {.gensym, redefine.} = "b"
|
|
bar()
|
|
doAssert foo() == "b"
|
|
|
|
{.pop.}
|