diff options
author | Saem Ghani <saemghani+github@gmail.com> | 2021-04-25 01:30:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-25 10:30:52 +0200 |
commit | 17db15f9b1a03ac93cb6c5c0264f2b534ab8b2ab (patch) | |
tree | 6340814c50483c36b4e6905f8ac9d4b00123951e /tests/macros/t17836.nim | |
parent | ffe4328b3513617be0d27c773d59bea441ec1c65 (diff) | |
download | Nim-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.nim | 15 |
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 |