Skip to content

Commit

Permalink
fix bug in lowering if with certain block exprs as the condition (J…
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Oct 30, 2020
1 parent 52ff1f0 commit 280b9ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4082,7 +4082,7 @@ f(x) = yt(x)
((if elseif)
(let ((tests (let* ((cond (cadr e))
(cond (if (and (pair? cond) (eq? (car cond) 'block))
(begin (compile (butlast cond) break-labels #f #f)
(begin (if (length> cond 2) (compile (butlast cond) break-labels #f #f))
(last cond))
cond)))
(map (lambda (clause)
Expand Down
2 changes: 2 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2601,3 +2601,5 @@ end
@test b === (y = 1, z = 3.0)
end
end

@test eval(Expr(:if, Expr(:block, Expr(:&&, true, Expr(:call, :(===), 1, 1))), 1, 2)) == 1

0 comments on commit 280b9ea

Please sign in to comment.