You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice that any comment after the end, gets a previous_eol_count higher than 2, when there is at most 2 newlines after any of the comments in the snippet.
Inspecting the eol tokens in the Code.previous_eol_count/1 private function I see this:
Where the last element of the three tuple is the count of newlines before the token. Only the :"," tokens show the wrong numbers, and I can reproduce the issue with a simple block with a ; after each line
Expected behavior
EOL counts for the :"," and :";" tokens should match the eol count behavior of the :eol token.
In the above example, the following counts are expected:
After looking at this, it seems that we are not considering that a comment itselt does not reset the previous_eol_count. Although that is obviously a bug, because we are considering comments for next_eol_count.
Elixir and Erlang/OTP versions
Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.19.0-dev (3a2ce69) (compiled with Erlang/OTP 26)
Operating system
Any
Current behavior
There is a bug in the way the tokenizer counts end of lines after a
,
or a;
that is noticeable when retrieving commentsGiven this code string:
Running
Code.string_to_quoted_with_comments!/1
on it produces this list of comments:Notice that any comment after the
end,
gets aprevious_eol_count
higher than 2, when there is at most 2 newlines after any of the comments in the snippet.Inspecting the eol tokens in the
Code.previous_eol_count/1
private function I see this:Where the last element of the three tuple is the count of newlines before the token. Only the
:","
tokens show the wrong numbers, and I can reproduce the issue with a simple block with a;
after each lineExpected behavior
EOL counts for the
:","
and:";"
tokens should match the eol count behavior of the:eol
token.In the above example, the following counts are expected:
The text was updated successfully, but these errors were encountered: