Files
Nim/tests/generics/toptions.nim
ringabout 0506d5b973 don't warn/error symbols in semGenericStmt/templates (#24907)
fixes #24905
fixes #24903
fixes https://github.com/nim-lang/Nim/issues/11805
fixes https://github.com/nim-lang/Nim/issues/15650

In the first phase of generic checking, we cannot warn/error symbols
because they can belong a false branch of `when` or there is a
`push/pop` options using open symbols. So we cannot decide whether to
warn/error or not
2025-04-29 11:08:10 +02:00

40 lines
644 B
Nim

discard """
matrix: "--warningAsError:Deprecated"
"""
block: # bug #24905
proc y() {.deprecated.} = discard
proc v(_: int | int) =
{.push warning[Deprecated]: off.}
y()
{.pop.}
v(1)
block: # bug #24903
block:
proc y() {.deprecated.} = discard
proc m(_: int | int) =
when false: y()
block:
proc y() {.error.} = discard
proc m(_: int | int) =
when false: y()
block:
proc y() {.error.} = discard
proc m(_: int | int) =
when true: y()
block: # bug #15650
proc bar() {.deprecated.} = discard
template foo() =
when false:
bar()
else:
discard
foo()