From 14114f1bbb718c44071f329670fa17ad2775469c Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 28 Apr 2016 13:50:58 -0400 Subject: [PATCH] fix #16096, incorrect var renaming inside macrocall exprs in macroexpand --- src/macroexpand.scm | 2 +- test/core.jl | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/macroexpand.scm b/src/macroexpand.scm index a02d985a8cdcb..8fe352869976d 100644 --- a/src/macroexpand.scm +++ b/src/macroexpand.scm @@ -230,7 +230,7 @@ ((macrocall) (if (or (eq? (cadr e) '@label) (eq? (cadr e) '@goto)) e `(macrocall ,.(map (lambda (x) - (resolve-expansion-vars- x env m inarg)) + (resolve-expansion-vars-with-new-env x env m inarg)) (cdr e))))) ((symboliclabel) e) ((symbolicgoto) e) diff --git a/test/core.jl b/test/core.jl index b31a028725aca..a88a7411fdc17 100644 --- a/test/core.jl +++ b/test/core.jl @@ -3864,3 +3864,17 @@ function f16023() x = 1 end @test_throws UndefVarError f16023() + +# issue #16096 +module M16096 +macro iter() + quote + @inline function foo(sub) + it = 1 + end + end +end +end +let ex = expand(:(@M16096.iter)) + @test !(isa(ex,Expr) && ex.head === :error) +end