Skip to content
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

Correctly translate constant write nodes' location #396

Merged
merged 1 commit into from
Jan 6, 2025
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jan 6, 2025

Motivation

This is not covered in parse tree location tests, but reflected in symbol table tests: when we write FOO = 1 (or other constant write nodes), the location of FOO should just be the name, not the entire assignment.

In those cases, we should use name_loc instead of base.location.

Fixes #342, #391, and some items in #388

Test plan

See included automated tests.

This is not covered in parse tree location tests, but reflected in symbol
table tests: when we write `FOO = 1` (or other constant write nodes), the
location of `FOO` should just be the name, not the entire assignment.

In those cases, we should use `name_loc` instead of `base.location`.
@@ -295,8 +295,6 @@ pipeline_tests(
"testdata/lsp/completion/self_receiver.rb",

# Desugar tests having to do with tree differences; will address later
"testdata/desugar/constant_error.rb",
"testdata/desugar/for.rb",
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in #390

@st0012 st0012 requested review from amomchilov and egiurleo January 6, 2025 22:14
@st0012 st0012 merged commit 1c1fa84 into prism Jan 6, 2025
1 check passed
@st0012 st0012 deleted the fix-#342 branch January 6, 2025 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

//test:test_PosTests/testdata/desugar/constant_error
2 participants