Skip to content

Commit

Permalink
fix #33227, lowering of empty goto loop at top level (#33230)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5fe17cd)
  • Loading branch information
JeffBezanson authored and Kristoffer Carlsson committed Sep 22, 2019
1 parent 7861a35 commit c494d50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/jlfrontend.scm
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
file line)))
(if (and (null? (cdadr (caddr th)))
(and (length= (lam:body th) 2)
;; 1-element body might be `return` or `goto` (issue #33227)
(return? (cadr (lam:body th)))
(let ((retval (cadadr (lam:body th))))
(or (and (pair? retval) (eq? (car retval) 'lambda))
(simple-atom? retval)))))
Expand Down
3 changes: 3 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1935,3 +1935,6 @@ function f33135(x::T) where {C1, T}
end
end
@test f33135(0) == 1

# issue #33227
@test Meta.isexpr(Meta.lower(Main, :((@label a; @goto a))), :thunk)

0 comments on commit c494d50

Please sign in to comment.