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

Multivar definitions get transparent positions [ci: last-only] #10991

Open
wants to merge 6 commits into
base: 2.13.x
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Feb 5, 2025

Fixes scala/bug#13067

In var x, y: Int = 42, the trees span the text, with point at the name. The symbol pos is the name pos.

In patDefOrDecl, mkDefs is refactored for clarity; the recursion in expandPatDefs is easier to read.

NamePos handling is pushed into makePatDef, resulting in better positions, reflected in updated check files. (A few warnings are now hidden by errors at the same position.)

In the multivar def, only y: Int may be an opaque position. (That nuance is probably not relevant.) Otherwise, the spans of the trees are transparent.

The test shows the valdef.namePos and valdef.pos for various single and multi defs.

@scala-jenkins scala-jenkins added this to the 2.13.17 milestone Feb 5, 2025
@som-snytt som-snytt force-pushed the issue/13067-multidef-pos branch from c2b6ba8 to 7e8fd1e Compare February 6, 2025 20:54
@som-snytt som-snytt marked this pull request as ready for review February 7, 2025 19:32
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.

Incorrect position on first definition in multiple variable declaration
2 participants