Skip to content

Commit

Permalink
fix #30048, lowering gc_preserve of closure variables (#30051)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8a4f20b)
  • Loading branch information
JeffBezanson authored and KristofferC committed Feb 20, 2020
1 parent 4db023a commit 88d95cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3870,8 +3870,9 @@ f(x) = yt(x)
'(null))

((gc_preserve_begin)
(let ((s (make-ssavalue)))
(emit `(= ,s ,e))
(let ((s (make-ssavalue))
(args (compile-args (cdr e) break-labels linearize-args)))
(emit `(= ,s ,(cons (car e) args)))
s))

;; metadata expressions
Expand Down
15 changes: 15 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1725,3 +1725,18 @@ end
@test Meta.parse("1..2") == Expr(:call, :.., 1, 2)
# we don't parse chains of these since the associativity and meaning aren't clear
@test_throws ParseError Meta.parse("1..2..3")

# issue #30048
@test Meta.isexpr(Meta.lower(@__MODULE__, :(for a in b
c = try
try
d() do
if GC.@preserve c begin
end
end
end
finally
end
finally
end
end)), :thunk)

0 comments on commit 88d95cd

Please sign in to comment.