From ac978b32031414e64ec2a148bcc1ff42287e534e Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 19 Oct 2012 21:43:18 +0200 Subject: [PATCH] bugfix: tcan_inherit_generic works again --- compiler/types.nim | 2 +- tests/compile/tmacroaspragma.nim | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/compile/tmacroaspragma.nim diff --git a/compiler/types.nim b/compiler/types.nim index 90fffff40c..7b7078e207 100755 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -92,7 +92,7 @@ proc InvalidGenericInst(f: PType): bool = proc isPureObject(typ: PType): bool = var t = typ - while t.sons[0] != nil: t = t.sons[0] + while t.kind == tyObject and t.sons[0] != nil: t = t.sons[0] result = t.sym != nil and sfPure in t.sym.flags proc getOrdValue(n: PNode): biggestInt = diff --git a/tests/compile/tmacroaspragma.nim b/tests/compile/tmacroaspragma.nim new file mode 100644 index 0000000000..0e5c352b37 --- /dev/null +++ b/tests/compile/tmacroaspragma.nim @@ -0,0 +1,8 @@ +import macros + +macro foo(x: stmt): stmt = + echo treerepr(callsite()) + result = newNimNode(nnkStmtList) + +proc zoo() {.foo.} = echo "hi" +