Skip to content

Commit dedcc75

Browse files
authoredFeb 1, 2018
fix #25724, overly-aggressive removal of Newvar nodes with x = x in try block (#25838)
1 parent ab74971 commit dedcc75

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
 

Diff for: ‎src/julia-syntax.scm

+1-1
Original file line numberDiff line numberDiff line change
@@ -4005,7 +4005,7 @@ f(x) = yt(x)
40054005
(if (has? vars (cadr e))
40064006
(begin (del! vars (cadr e))
40074007
(put! di (cadr e) #t))))
4008-
((and (pair? e) (memq (car e) '(goto gotoifnot)))
4008+
((and (pair? e) (memq (car e) '(goto gotoifnot enter)))
40094009
(set! vars (table)))))
40104010
(loop (cdr stmts)))))))
40114011

Diff for: ‎test/core.jl

+17
Original file line numberDiff line numberDiff line change
@@ -3185,6 +3185,23 @@ function f11065()
31853185
end
31863186
@test_throws UndefVarError f11065()
31873187

3188+
# issue #25724
3189+
a25724 = Any[]
3190+
for i = 1:3
3191+
needX = false
3192+
try
3193+
X = X
3194+
X[1] = X[1] + 1
3195+
catch err
3196+
needX = true
3197+
end
3198+
if needX
3199+
X = [0]
3200+
end
3201+
push!(a25724, copy(X))
3202+
end
3203+
@test a25724 == [[0], [0], [0]]
3204+
31883205
# for loop iterator expression should be evaluated in outer scope
31893206
let
31903207
for i in (local a = 1:2)

0 commit comments

Comments
 (0)
Please sign in to comment.