summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorPeter Mora <morapeter@gmail.com>2015-08-21 21:15:08 +0200
committerPeter Mora <morapeter@gmail.com>2015-08-21 21:15:08 +0200
commit6da8c7857e41cc21dd3a0685417ac7e2f0465561 (patch)
tree8ee69e797ad2a5643baae1b8969e1cdf7294340d /tests
parentd230b75e0a7cd49cf5c4e4f687515c296cd2ce5b (diff)
downloadNim-6da8c7857e41cc21dd3a0685417ac7e2f0465561.tar.gz
extending metatype matching in sigmatch.nim
Diffstat (limited to 'tests')
-rw-r--r--tests/metatype/tprocbothmeta.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/metatype/tprocbothmeta.nim b/tests/metatype/tprocbothmeta.nim
new file mode 100644
index 000000000..ad12c5d26
--- /dev/null
+++ b/tests/metatype/tprocbothmeta.nim
@@ -0,0 +1,10 @@
+
+proc myFun[A,B](x: A): B =
+  result = float(x+10)
+
+proc myMap[T,S](sIn: seq[T], f: proc (q: T): S): seq[S] =
+  result = newSeq[S](sIn.len)
+  for i in 0..<sIn.len:
+    result[i] = f(sIn[i])
+
+assert myMap(@[1,2,3], myFun) == @[11.0, 12.0, 13.0]