From f44adfbeb01ba315be53ebbbe4e30007d83ffdce Mon Sep 17 00:00:00 2001 From: kw7oe Date: Sun, 19 May 2019 16:10:11 +0800 Subject: [PATCH] Improve heredoc error message (#9048) --- lib/elixir/src/elixir_tokenizer.erl | 2 +- lib/elixir/test/elixir/kernel/errors_test.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/elixir/src/elixir_tokenizer.erl b/lib/elixir/src/elixir_tokenizer.erl index 3b25341a8c..201d19fd94 100644 --- a/lib/elixir/src/elixir_tokenizer.erl +++ b/lib/elixir/src/elixir_tokenizer.erl @@ -879,7 +879,7 @@ extract_heredoc(Line0, Column0, Rest0, Marker, Scope) -> {error, {ErrorLine, ErrorColumn, Message, Token}} end; error -> - Message = "heredoc start must be followed by a new line after ", + Message = "heredoc allows only zero or more whitespace characters followed by a new line after ", {error, {Line0, Column0, io_lib:format(Message, []), [Marker, Marker, Marker]}} end. diff --git a/lib/elixir/test/elixir/kernel/errors_test.exs b/lib/elixir/test/elixir/kernel/errors_test.exs index aa5233ef12..b786214aa3 100644 --- a/lib/elixir/test/elixir/kernel/errors_test.exs +++ b/lib/elixir/test/elixir/kernel/errors_test.exs @@ -159,7 +159,7 @@ defmodule Kernel.ErrorsTest do test "heredoc start" do assert_eval_raise SyntaxError, - "nofile:1: heredoc start must be followed by a new line after \"\"\"", + "nofile:1: heredoc allows only zero or more whitespace characters followed by a new line after \"\"\"", '"""bar\n"""' end