Skip to content

Commit

Permalink
fix #24331, regression in try/finally scope (#24334)
Browse files Browse the repository at this point in the history
caused by  #24075
  • Loading branch information
JeffBezanson authored Oct 26, 2017
1 parent deaa2df commit dea765a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1324,8 +1324,8 @@
`(tryfinally
,(if (not (eq? catchb 'false))
`(try ,tryb ,var ,catchb)
tryb)
,finalb))))
`(scope-block ,tryb))
(scope-block ,finalb)))))
((length= e 4)
(expand-forms
(if (and (symbol-like? var) (not (eq? var 'false)))
Expand Down Expand Up @@ -3481,7 +3481,7 @@ f(x) = yt(x)
(convert-for-type-decl y rett)
y))
(if (> handler-level 0)
(let ((tmp (cond ((or (simple-atom? x) (ssavalue? x) (equal? x '(null)))
(let ((tmp (cond ((or (simple-atom? x) (equal? x '(null)))
#f)
(finally-handler (new-mutable-var))
(else (make-ssavalue)))))
Expand Down
14 changes: 14 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,20 @@ function test12806()
end
@test test12806() == (true, true, false, [1])

# issue #24331
try
c24331 = 1
finally
end
@test !isdefined(@__MODULE__, :c24331)
function f24331()
try
x = [2]
finally
end
end
@test f24331() == [2]

# finalizers
let A = [1]
local x = 0
Expand Down

0 comments on commit dea765a

Please sign in to comment.