Skip to content

Commit b342739

Browse files
author
José Valim
committed
Tag wrong heredoc start as SyntaxError instead of TokenMissingError
1 parent b570850 commit b342739

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,8 @@ extract_heredoc(Line0, Rest0, Marker) ->
627627
{error, {ErrorLine, io_lib:format(Message, [Terminator, Line0]), []}}
628628
end;
629629
error ->
630-
Terminator = [Marker, Marker, Marker],
631-
Message = "heredoc start ~ts must be followed by a new line",
632-
{error, {Line0, io_lib:format(Message, [Terminator]), []}}
630+
Message = "heredoc start must be followed by a new line after ",
631+
{error, {Line0, io_lib:format(Message, []), [Marker, Marker, Marker]}}
633632
end.
634633

635634
%% Remove spaces from heredoc based on the position of the final quotes.

lib/elixir/test/elixir/kernel/errors_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ defmodule Kernel.ErrorsTest do
5454
end
5555

5656
test :heredoc_start do
57-
assert_compile_fail TokenMissingError,
58-
"nofile:1: heredoc start \"\"\" must be followed by a new line",
57+
assert_compile_fail SyntaxError,
58+
"nofile:1: heredoc start must be followed by a new line after \"\"\"",
5959
'"""bar\n"""'
6060
end
6161

0 commit comments

Comments
 (0)