Skip to content

Code.Normalizer: Use correct meta fields in normalize_call/2 #12389

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 1 commit into from
Feb 9, 2023

Conversation

zachallaun
Copy link
Contributor

normalize_call/2 was passing the old state.parent_meta when normalizing call arguments, which prevented :line meta from being correctly applied to unwrapped literals. This had the effect of causing comment collapses in certain cases:

# This would fail
assert_same """
            block do
              # before 1
              1 + 1

              # before 2
              2 + 2
            end
            """,
            literal_encoder: fn literal, _ -> {:ok, literal} end

# The newline would collapse, resulting in
"""
block do
  # before 1
  1 + 1
  # before 2
  2 + 2
end
"""

@josevalim josevalim merged commit 95e112c into elixir-lang:main Feb 9, 2023
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@zachallaun zachallaun deleted the code-normalizer branch February 10, 2023 14:27
@zachallaun
Copy link
Contributor Author

Thank you for merging!

I'm not sure if there's a policy for this, but is it possible to have this PR backported to the v1.14 branch to be included in the next patch release?

@josevalim
Copy link
Member

Backported.

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.

2 participants