Skip to content

Commit

Permalink
better syntax error for &&&, fixes #7479
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jul 20, 2017
1 parent 3e8b32d commit cf354f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3599,7 +3599,8 @@ f(x) = yt(x)
(emit temp))))

((&)
(assert (and value (not tail)))
(if (or (not value) tail)
(error "misplaced \"&\" expression"))
`(& ,(compile (cadr e) break-labels value tail)))

((newvar)
Expand Down
3 changes: 3 additions & 0 deletions test/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1251,3 +1251,6 @@ end === (3, String)
# issue #22868
@test_throws ParseError parse("x@time 2")
@test_throws ParseError parse("@ time")

# issue #7479
@test expand(Main, parse("(true &&& false)")) == Expr(:error, "misplaced \"&\" expression")

0 comments on commit cf354f7

Please sign in to comment.