From cf354f7f39fb7db599eb7ff4aad3f504e9108d37 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 20 Jul 2017 17:41:12 -0400 Subject: [PATCH] better syntax error for `&&&`, fixes #7479 --- src/julia-syntax.scm | 3 ++- test/parse.jl | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index b77fdb6ed096d..973874d4a864e 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -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) diff --git a/test/parse.jl b/test/parse.jl index 5bd36147945b4..67731babea643 100644 --- a/test/parse.jl +++ b/test/parse.jl @@ -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")