diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 9436198701036..e7b7a78459a04 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -1094,6 +1094,9 @@ ,body))) ((if) + (if (newline? (peek-token s)) + (error (string "missing condition in \"if\" at " current-filename + ":" (- (input-port-line (ts:port s)) 1)))) (let* ((test (parse-cond s)) (then (if (memq (require-token s) '(else elseif)) '(block) diff --git a/test/parse.jl b/test/parse.jl index d4fef884a393e..74d9e2b4cd710 100644 --- a/test/parse.jl +++ b/test/parse.jl @@ -401,3 +401,7 @@ test_parseerror("0x1.0p", "invalid numeric constant \"0x1.0\"") @test expand(Base.parse_input_line(""" try = "No" """)) == Expr(:error, "unexpected \"=\"") + +# issue #15763 +test_parseerror("if\nfalse\nend", "missing condition in \"if\" at none:1") +test_parseerror("if false\nelseif\nend", "missing condition in \"elseif\" at none:2")