Skip to content

Commit 207350f

Browse files
committed
Improve heredoc warning
1 parent 6f7a68c commit 207350f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,8 @@ extract_heredoc_with_interpolation(Line, Column, Scope, Interpol, T, H) ->
10301030
end;
10311031

10321032
error ->
1033-
Message = "heredoc allows only zero or more whitespace characters followed by a new line after ",
1034-
{error, {Line, Column, io_lib:format(Message, []), [H, H, H]}}
1033+
Message = "heredoc allows only whitespace characters followed by a new line after opening ",
1034+
{error, {Line, Column + 3, io_lib:format(Message, []), [H, H, H]}}
10351035
end.
10361036

10371037
extract_heredoc_header("\r\n" ++ Rest) ->

lib/elixir/test/elixir/kernel/parser_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ defmodule Kernel.ParserTest do
538538
describe "syntax errors" do
539539
test "invalid heredoc start" do
540540
assert_syntax_error(
541-
~r/nofile:1:1: heredoc allows only zero or more whitespace characters followed by a new line after \"\"\"/,
541+
~r/nofile:1:4: heredoc allows only whitespace characters followed by a new line after opening \"\"\"/,
542542
~c"\"\"\"bar\n\"\"\""
543543
)
544544
end

0 commit comments

Comments
 (0)