fix #17836 (typed macro isNil for proc params) (#17841)

thanks @alaviss for the test
This commit is contained in:
Saem Ghani 2021-04-25 01:30:52 -07:00 • committed by GitHub
commit 17db15f9b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

15
tests/macros/t17836.nim Normal file
View file

@ -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)