test case for semistatic
This commit is contained in:
parent
edab4aaad0
commit
86108be24b
1 changed files with 24 additions and 0 deletions
24
tests/run/tsemistatic.nim
Normal file
24
tests/run/tsemistatic.nim
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
discard """
|
||||||
|
msg: "static 10\ndynamic\nstatic 20\n"
|
||||||
|
output: "s\nd\nd\ns"
|
||||||
|
"""
|
||||||
|
|
||||||
|
proc foo(x: semistatic[int]) =
|
||||||
|
when isStatic(x):
|
||||||
|
static: echo "static ", x
|
||||||
|
echo "s"
|
||||||
|
else:
|
||||||
|
static: echo "dynamic"
|
||||||
|
echo "d"
|
||||||
|
|
||||||
|
foo 10
|
||||||
|
|
||||||
|
var
|
||||||
|
x = 10
|
||||||
|
y: int
|
||||||
|
|
||||||
|
foo x
|
||||||
|
foo y
|
||||||
|
|
||||||
|
foo 20
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue