Files
Nim/tests/template/tredefinition_override.nim
metagn 6d8cf25bd7 deprecate do: meaning do (): + misc cleanup (#20927)
* 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
2022-12-06 09:44:26 +01:00

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.}