diff options
author | Araq <rumpf_a@web.de> | 2017-02-16 00:43:14 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-02-16 00:43:14 +0100 |
commit | 97e26967f1f37a33edf6877cedfc9854fabab5eb (patch) | |
tree | 083851e15d15f26118b23b0db1330b8f5ccb6fcf /tests | |
parent | 95abf30fae3d1d91e1980fa9a5a46e7319201cd8 (diff) | |
download | Nim-97e26967f1f37a33edf6877cedfc9854fabab5eb.tar.gz |
fixes #5383
Diffstat (limited to 'tests')
-rw-r--r-- | tests/template/tgensymregression.nim | 13 | ||||
-rw-r--r-- | tests/template/tparams_gensymed.nim | 9 |
2 files changed, 17 insertions, 5 deletions
diff --git a/tests/template/tgensymregression.nim b/tests/template/tgensymregression.nim index e73ff258d..e49678fec 100644 --- a/tests/template/tgensymregression.nim +++ b/tests/template/tgensymregression.nim @@ -19,3 +19,16 @@ proc foo(): void = echo repr(v1 *** v2) foo() + +# bug #5383 +import sequtils + +proc zipWithIndex[A](ts: seq[A]): seq[(int, A)] = + toSeq(pairs(ts)) + +proc main = + discard zipWithIndex(@["foo", "bar"]) + discard zipWithIndex(@[1, 2]) + discard zipWithIndex(@[true, false]) + +main() diff --git a/tests/template/tparams_gensymed.nim b/tests/template/tparams_gensymed.nim index 6c4413866..568725fd4 100644 --- a/tests/template/tparams_gensymed.nim +++ b/tests/template/tparams_gensymed.nim @@ -5,8 +5,8 @@ import macros # Test that parameters are properly gensym'ed finally: -template genNodeKind(kind, name: expr): stmt = - proc name*(children: varargs[PNimrodNode]): PNimrodNode {.compiletime.}= +template genNodeKind(kind, name: untyped) = + proc name*(children: varargs[NimNode]): NimNode {.compiletime.}= result = newNimNode(kind) for c in children: result.add(c) @@ -22,7 +22,7 @@ type Something = object proc testA(x: Something) = discard -template def(name: expr) {.immediate.} = +template def(name: untyped) = proc testB[T](reallyUniqueName: T) = `test name`(reallyUniqueName) def A @@ -35,8 +35,7 @@ testB(x) # Test that templates in generics still work (regression to fix the # regression...) -template forStatic(index: expr, slice: Slice[int], predicate: stmt): - stmt {.immediate.} = +template forStatic(index, slice, predicate: untyped) = const a = slice.a const b = slice.b when a <= b: |