mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
45 lines
527 B
Nim
45 lines
527 B
Nim
discard """
|
|
cmd: "nim -d:testdef $target $file"
|
|
output: '''works 34
|
|
34
|
|
defined
|
|
3'''
|
|
"""
|
|
|
|
{.reorder: on.}
|
|
{.experimental.}
|
|
|
|
proc bar(x: T)
|
|
|
|
proc foo() =
|
|
bar(34)
|
|
whendep()
|
|
|
|
proc foo(dummy: int) = echo dummy
|
|
|
|
proc bar(x: T) =
|
|
echo "works ", x
|
|
foo(x)
|
|
|
|
when defined(testdef):
|
|
proc whendep() = echo "defined"
|
|
else:
|
|
proc whendep() = echo "undefined"
|
|
|
|
foo()
|
|
|
|
type
|
|
T = int
|
|
|
|
|
|
when not declared(goo):
|
|
proc goo(my, omy) = echo my
|
|
|
|
when not declared(goo):
|
|
proc goo(my, omy) = echo omy
|
|
|
|
using
|
|
my, omy: int
|
|
|
|
goo(3, 4)
|