Skip to content

Commit 54e8ea1

Browse files
author
José Valim
committed
Ensure heredocs are allowed in calls, closes #1998
1 parent 3110be1 commit 54e8ea1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,9 @@ remove_heredoc_spaces([], Buffer, _Spaces, _Original) ->
626626
%% Extract the heredoc header.
627627

628628
extract_heredoc_header("\r\n" ++ Rest, Buffer, _Scope) ->
629-
{ ok, [$\n|Buffer], Rest };
629+
{ ok, Buffer, Rest };
630630
extract_heredoc_header("\n" ++ Rest, Buffer, _Scope) ->
631-
{ ok, [$\n|Buffer], Rest };
631+
{ ok, Buffer, Rest };
632632
extract_heredoc_header([H|T], Buffer, {Line,File}) when not ?is_horizontal_space(H) ->
633633
elixir_errors:deprecation([{line,Line}], File, "continuable heredocs are deprecated, parsing will no longer continue on the same line as the heredoc starts"),
634634
extract_heredoc_header(T, [H|Buffer], nil);

lib/elixir/test/elixir/kernel/binary_test.exs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ bar """
3535
"""
3636
end
3737

38+
test :heredoc_in_call do
39+
assert "foo\nbar" == Kernel.<>("""
40+
foo
41+
""", "bar")
42+
end
43+
3844
test :utf8 do
3945
assert size(" ゆんゆん") == 13
4046
end

0 commit comments

Comments
 (0)