diff --git a/src/macroexpand.scm b/src/macroexpand.scm index bbf72338d2a98..b5b4197601554 100644 --- a/src/macroexpand.scm +++ b/src/macroexpand.scm @@ -304,9 +304,9 @@ ((assignment? arg) `(global (= ,(unescape (cadr arg)) - ,(resolve-expansion-vars-with-new-env (caddr arg) env m inarg)))) + ,(resolve-expansion-vars-with-new-env (caddr arg) env m parent-scope inarg)))) (else - `(global ,(resolve-expansion-vars-with-new-env arg env m inarg)))))) + `(global ,(resolve-expansion-vars-with-new-env arg env m parent-scope inarg)))))) ((using import importall export meta line inbounds boundscheck simdloop gc_preserve gc_preserve_end) (map unescape e)) ((macrocall) e) ; invalid syntax anyways, so just act like it's quoted. ((symboliclabel) e) diff --git a/test/parse.jl b/test/parse.jl index 91cb09af425b7..d262f2b47c100 100644 --- a/test/parse.jl +++ b/test/parse.jl @@ -1376,3 +1376,9 @@ end @test parse("@foo [1] + [2]") == parse("@foo([1] + [2])") @test parse("@Mdl.foo[1] + [2]") == parse("@Mdl.foo([1]) + [2]") @test parse("@Mdl.foo [1] + [2]") == parse("@Mdl.foo([1] + [2])") + +# issue #24289 +macro m24289() + :(global $(esc(:x24289)) = 1) +end +@test (@macroexpand @m24289) == :(global x24289 = 1)