Skip to content

Commit ca3270b

Browse files
authored
lowering: apply let hygiene in let environment (JuliaLang#49999)
Not just a regression, since this test also fails on old versions, but JuliaLang#49897 applied the wrong environment to make this hygiene correct which broke it worse. Fix JuliaLang#49984
1 parent 7e25ebf commit ca3270b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/macroexpand.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
447447
newenv m parent-scope inarg))
448448
;; expand initial values in old env
449449
(resolve-expansion-vars- (caddr bind) env m parent-scope inarg))
450-
(resolve-expansion-vars- bind env m parent-scope inarg)))
450+
(resolve-expansion-vars- bind newenv m parent-scope inarg)))
451451
binds))
452452
,body)))
453453
((hygienic-scope) ; TODO: move this lowering to resolve-scopes, instead of reimplementing it here badly

test/syntax.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3479,3 +3479,7 @@ end
34793479
@test @_macroexpand(global (; x::S, $(esc(:y))::$(esc(:T))) = a) ==
34803480
:(global (; x::$(GlobalRef(m, :S)), y::T) = $(GlobalRef(m, :a)))
34813481
end
3482+
3483+
# issue #49984
3484+
macro z49984(s); :(let a; $(esc(s)); end); end
3485+
@test let a = 1; @z49984(a) === 1; end

0 commit comments

Comments
 (0)