summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compile/tmacrotypes.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/compile/tmacrotypes.nim b/tests/compile/tmacrotypes.nim
new file mode 100644
index 000000000..7697dba27
--- /dev/null
+++ b/tests/compile/tmacrotypes.nim
@@ -0,0 +1,12 @@
+import macros, typetraits
+
+macro checkType(ex, expected: expr): stmt {.immediate.} =
+  var t = ex.typ
+  assert t.name == expected.strVal
+
+proc voidProc = echo "hello"
+proc intProc(a, b): int = 10
+
+checkType(voidProc(), "void")
+checkType(intProc(10, 20.0), "int")
+checkType(noproc(10, 20.0), "Error Type")