scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Span includes trailing comma

Open tgodzik opened this issue 3 years ago • 4 comments

Compiler version

3.3.0-RC2

Minimized code

  for {
    a <- List(1)
    b <- List(a)
    if (
      a,
      b,
    ) == (1, 2)
 } yield b

Output

second b's span will include the trailing coma. This shows up both when using Interactive as well in semanticdb

Expectation

Trailing coma is excluded from span

tgodzik avatar Feb 09 '23 21:02 tgodzik

@bishabosha @anatoliykmetyuk didn't one of you spend some time looking at this last week...?

SethTisue avatar Jun 15 '23 02:06 SethTisue

I had a look with someone at the Scala Spree in San Francisco but no results :)

bishabosha avatar Jun 19 '23 12:06 bishabosha

This issue is still present as of 3.5.0 at 8563571e5af.

def Test =
 for {
    a <- List(1)
    b <- List(a)
    if (
      a,
      b,
    ) == (1, 2)
 } yield b
scalac -Xprint:typer -Yprint-pos -Ydebug-pos test.scala
...
                    test.scala<67..67>([email protected]<67..68>,
                    [email protected]<76..78>)@test.scala<59..84>.==@
...

mbovel avatar May 20 '24 20:05 mbovel

This issue was picked for the Scala Issue Spree of tomorrow, May 21st. @dwijnand, @rochala, @jan-pieter, @nmcb will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here.

mbovel avatar May 20 '24 20:05 mbovel