Skip to content

Commit

Permalink
fix #47410, syntax error with anonfn inside elseif and short-circui…
Browse files Browse the repository at this point in the history
…t op (#47499)
  • Loading branch information
JeffBezanson authored Nov 16, 2022
1 parent ee0f3fc commit 5f256e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4404,6 +4404,9 @@ f(x) = yt(x)
cnd)))
(define (emit-cond cnd break-labels endl)
(let* ((cnd (if (and (pair? cnd) (eq? (car cnd) 'block))
(flatten-ex 'block cnd)
cnd))
(cnd (if (and (pair? cnd) (eq? (car cnd) 'block))
(begin (if (length> cnd 2) (compile (butlast cnd) break-labels #f #f))
(last cnd))
cnd))
Expand Down
7 changes: 7 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3422,3 +3422,10 @@ end
# issue #46251
@test begin; global value = 1; (value, value += 1) end == (1, 2)
@test begin; global value = 1; "($(value), $(value += 1))" end == "(1, 2)"

# issue #47410
# note `eval` is needed since this needs to be at the top level
@test eval(:(if false
elseif false || (()->true)()
42
end)) == 42

1 comment on commit 5f256e7

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true, configuration=(rr=true,))

Please sign in to comment.