Skip to content

Settle elixir_errors:parse_error/6 InputString as charlist #11345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 25, 2021
Merged

Settle elixir_errors:parse_error/6 InputString as charlist #11345

merged 3 commits into from
Oct 25, 2021

Conversation

michallepicki
Copy link
Contributor

@michallepicki michallepicki commented Oct 25, 2021

Follow-up to #11343

Alternatively InputString could be a binary and converted from charlist to binary at the one remaining call site in Code module

Or it the InputString type could be widened to chardata as I proposed originally (the code works, just spec is inconsistent with data being passed in)

@michallepicki
Copy link
Contributor Author

Also as a note, the resulting snippet already will always be a binary, thanks to this characters_to_binary call. Personally I would merge #11343 but I don't mind it either way

@@ -89,15 +89,15 @@ snippet(InputString, Location, StartLine, StartColumn) ->
Lines = string:split(InputString, "\n", all),
Snippet = elixir_utils:characters_to_binary(lists:nth(Line - StartLine + 1, Lines)),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Snippet = elixir_utils:characters_to_binary(lists:nth(Line - StartLine + 1, Lines)),
Snippet = lists:nth(Line - StartLine + 1, Lines),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I missed it.

@josevalim josevalim merged commit 58e7c6a into elixir-lang:master Oct 25, 2021
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@michallepicki michallepicki deleted the fix-elixir-errors-parse-error-spec-take-2 branch October 25, 2021 21:28
@v0idpwn
Copy link
Contributor

v0idpwn commented Oct 26, 2021

Thanks a lot, @michallepicki!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants