diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/generics/timplicit_and_explicit.nim | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/generics/timplicit_and_explicit.nim b/tests/generics/timplicit_and_explicit.nim index ba24b79e9..fe61004e4 100644 --- a/tests/generics/timplicit_and_explicit.nim +++ b/tests/generics/timplicit_and_explicit.nim @@ -42,4 +42,23 @@ block: #4688 block: #4164 proc printStr[T](s: static[string]): T = discard - discard printStr[int]("hello static") \ No newline at end of file + discard printStr[int]("hello static") + +import macros + +block: # issue #9040, statics with template, macro, symchoice explicit generics + block: # macro + macro fun[N: static int](): untyped = + newLit 1 + const a = fun[2]() + doAssert a == 1 + block: # template + template fun[N: static int](): untyped = + 1 + const a = fun[2]() + doAssert a == 1 + block: # symchoice + proc newSeq[x: static int](): int = 1 + template foo: int = + newSeq[2]() + doAssert foo() == 1 |