summary refs log tree commit diff stats
path: root/tests/macros/t17836.nim
diff options
context:
space:
mode:
authorSaem Ghani <saemghani+github@gmail.com>2021-04-25 01:30:52 -0700
committerGitHub <noreply@github.com>2021-04-25 10:30:52 +0200
commit17db15f9b1a03ac93cb6c5c0264f2b534ab8b2ab (patch)
tree6340814c50483c36b4e6905f8ac9d4b00123951e /tests/macros/t17836.nim
parentffe4328b3513617be0d27c773d59bea441ec1c65 (diff)
downloadNim-17db15f9b1a03ac93cb6c5c0264f2b534ab8b2ab.tar.gz
fix #17836 (typed macro isNil for proc params) (#17841)
thanks @alaviss for the test
Diffstat (limited to 'tests/macros/t17836.nim')
-rw-r--r--tests/macros/t17836.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/macros/t17836.nim b/tests/macros/t17836.nim
new file mode 100644
index 000000000..2453637f5
--- /dev/null
+++ b/tests/macros/t17836.nim
@@ -0,0 +1,15 @@
+import macros
+
+# Ensure that `isNil` works in the typed macro context when pass procs.
+
+type
+  O = object
+    fn: proc(i: int): int
+
+var o: O
+
+macro typedBug(expr: typed) =
+  doAssert expr[1] != nil
+  doAssert not expr[1].isNil
+
+typedBug(o.fn)
\ No newline at end of file