diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index d418cd1e75..94453be150 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1290,6 +1290,7 @@ proc newAnonSym(kind: TSymKind, info: TLineInfo, proc semExpandToAst(c: PContext, n: PNode): PNode = var macroCall = n[1] var expandedSym = expectMacroOrTemplateCall(c, macroCall) + if expandedSym.kind == skError: return n macroCall.sons[0] = newSymNode(expandedSym, macroCall.info) markUsed(n, expandedSym) diff --git a/tests/compile/tmacrostmt.nim b/tests/compile/tmacrostmt.nim index 69b49f692c..d9c70197dc 100644 --- a/tests/compile/tmacrostmt.nim +++ b/tests/compile/tmacrostmt.nim @@ -15,3 +15,12 @@ else: return tkUnknown case_token: inc i + +#bug #488 + +macro foo: stmt = + var exp = newCall("whatwhat", newIntLitNode(1)) + if compiles(getAst(exp)): return exp + else: echo "Does not compute!" + +foo()