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

Wrong nameSpan in Select when using parentheses #16771

Closed
jkciesluk opened this issue Jan 26, 2023 · 0 comments · Fixed by #18576
Closed

Wrong nameSpan in Select when using parentheses #16771

jkciesluk opened this issue Jan 26, 2023 · 0 comments · Fixed by #18576

Comments

@jkciesluk
Copy link
Collaborator

Compiler version

3.2.2

Minimized code

val a = (1 + 2 + 3).toString

Output

Select(
  qualifier = Apply(
    fun = Select(
      qualifier = Apply(
        fun = Select(qualifier = Literal(const = ( = 1)), name = +),
        args = List(Literal(const = ( = 2)))
      ),
      name = +
    ),
    args = List(Literal(const = ( = 3)))
  ),
  name = toString
)
// select span
[8..20..28]
// qualifier span
<9..18>
// nameSpan (toString span)
[8..20..16]

Because qualifier.span.start > select.span.start, this is treated as right associative operator

Expectation

toString span would be correct, i.e. [20..20..28]

@jkciesluk jkciesluk added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 26, 2023
@anatoliykmetyuk anatoliykmetyuk added area:parser and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 30, 2023
bishabosha added a commit that referenced this issue Sep 21, 2023
Semanticdb range on selectDynamic in `foo.bar` previously contained
`.bar` instead of `bar`

Connected to scalameta/metals#5621
Also closes #16771 by porting
scalameta/metals#4907
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants