summary refs log tree commit diff stats
path: root/tests/macros
diff options
context:
space:
mode:
authorzah <zahary@gmail.com>2017-03-12 10:33:49 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-03-12 09:33:49 +0100
commit1be0022e7c6a8d168918998fd27412901432075d (patch)
tree64be855cb15ffb466098e33b526799a6aa49a9c7 /tests/macros
parent6e358e318747ecd6bea66911d6144cb7eff9d172 (diff)
downloadNim-1be0022e7c6a8d168918998fd27412901432075d.tar.gz
Fixes #5167 and related problems (#5475)
This commit returns to a bit less strict checking of the number
of macro arguments, because some old immediate macros rely on a
behavior where even the arity of the macro is not being checked.

It may be better if such macros are just declared to use varargs[expr],
but this remains for another day.
Diffstat (limited to 'tests/macros')
-rw-r--r--tests/macros/tmacro4.nim2
-rw-r--r--tests/macros/tquotewords.nim2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/macros/tmacro4.nim b/tests/macros/tmacro4.nim
index a56369369..fb07941a9 100644
--- a/tests/macros/tmacro4.nim
+++ b/tests/macros/tmacro4.nim
@@ -5,7 +5,7 @@ discard """
 import
   macros, strutils
 
-macro test_macro*(n: stmt): stmt {.immediate.} =
+macro test_macro*(s: string, n: stmt): stmt {.immediate.} =
   result = newNimNode(nnkStmtList)
   var ass : NimNode = newNimNode(nnkAsgn)
   add(ass, newIdentNode("str"))
diff --git a/tests/macros/tquotewords.nim b/tests/macros/tquotewords.nim
index 7a575f541..48fcafd62 100644
--- a/tests/macros/tquotewords.nim
+++ b/tests/macros/tquotewords.nim
@@ -6,7 +6,7 @@ discard """
 
 import macros
 
-macro quoteWords(n: expr): expr {.immediate.} =
+macro quoteWords(n: varargs[expr]): expr {.immediate.} =
   let n = callsite()
   result = newNimNode(nnkBracket, n)
   for i in 1..n.len-1: