From 8256be444d4420b485893993cd3f391be397ad1b Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 8 Apr 2020 13:29:39 -0400 Subject: [PATCH] fix #35391, macro hygiene bug in gc_preserve (#35394) --- src/macroexpand.scm | 2 +- test/syntax.jl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/macroexpand.scm b/src/macroexpand.scm index 12b1399bf1a22..13d8cf4104e86 100644 --- a/src/macroexpand.scm +++ b/src/macroexpand.scm @@ -340,7 +340,7 @@ ,(resolve-expansion-vars-with-new-env (caddr arg) env m parent-scope inarg)))) (else `(global ,(resolve-expansion-vars-with-new-env arg env m parent-scope inarg)))))) - ((using import export meta line inbounds boundscheck loopinfo gc_preserve gc_preserve_end) (map unescape e)) + ((using import export meta line inbounds boundscheck loopinfo) (map unescape e)) ((macrocall) e) ; invalid syntax anyways, so just act like it's quoted. ((symboliclabel) e) ((symbolicgoto) e) diff --git a/test/syntax.jl b/test/syntax.jl index e36b195fa1354..59df08b08a9a6 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -2223,3 +2223,9 @@ end h35201(x; k=1) = (x, k) f35201(c) = h35201((;c...), k=true) @test f35201(Dict(:a=>1,:b=>3)) === ((a=1,b=3), true) + +# issue #35391 +macro a35391(b) + :(GC.@preserve ($(esc(b)),) ) +end +@test @a35391(0) === (0,)