summary refs log tree commit diff stats
path: root/tests/overload
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-12 14:56:42 +0100
committerAraq <rumpf_a@web.de>2015-02-12 14:56:57 +0100
commitc4eddb3fdafe3494fa1b1300bcbf1314b7540490 (patch)
tree87ebc8d8f759efedf09f127f0c2acebc0c87bf0e /tests/overload
parent41385f3aaf4da7a13df64ec98a2b0b713c88c1d6 (diff)
downloadNim-c4eddb3fdafe3494fa1b1300bcbf1314b7540490.tar.gz
ordinary parameters can follow a varargs parameter
Diffstat (limited to 'tests/overload')
-rw-r--r--tests/overload/tparams_after_varargs.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/overload/tparams_after_varargs.nim b/tests/overload/tparams_after_varargs.nim
new file mode 100644
index 000000000..a93e280b9
--- /dev/null
+++ b/tests/overload/tparams_after_varargs.nim
@@ -0,0 +1,17 @@
+discard """
+  output: '''a 1 b 2 x @[3, 4, 5] y 6 z 7
+yay
+12'''
+"""
+
+proc test(a, b: int, x: varargs[int]; y, z: int) =
+  echo "a ", a, " b ", b, " x ", @x, " y ", y, " z ", z
+
+test 1, 2, 3, 4, 5, 6, 7
+
+template takesBlock(a, b: int, x: varargs[expr]; blck: stmt) =
+  blck
+  echo a, b
+
+takesBlock 1, 2, "some", 0.90, "random stuff":
+  echo "yay"
147'>147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203