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 46a788ef52d28..1f623bb9e5213 100644 --- a/test/core.jl +++ b/test/core.jl @@ -3866,3 +3866,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