diff options
-rw-r--r-- | tests/static/tstaticparammacro.nim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/static/tstaticparammacro.nim b/tests/static/tstaticparammacro.nim index 7fb9e2014..ebd6caa47 100644 --- a/tests/static/tstaticparammacro.nim +++ b/tests/static/tstaticparammacro.nim @@ -10,6 +10,9 @@ AST a AST b (e: [55, 66], f: [77, 88]) 55 +10 +20Test +20 ''' """ @@ -50,3 +53,22 @@ macro mB(data: static[Tb]): stmt = mA(a) mB(b) +type + Foo[N: static[int], Z: static[string]] = object + +macro staticIntMacro(f: static[int]): stmt = echo f +staticIntMacro 10 + +var + x: Foo[20, "Test"] + +macro genericMacro[N; Z: static[string]](f: Foo[N, Z], ll = 3, zz = 12): stmt = + echo N, Z + +genericMacro x + +template genericTemplate[N, Z](f: Foo[N, Z], ll = 3, zz = 12): int = N + +static: + echo genericTemplate(x) # Error: internal error: (filename: compiler/evaltempl.nim, line: 39) + |