-
Notifications
You must be signed in to change notification settings - Fork 187
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
Scala 3: semantic info for Infix arguments cannot be looked up #1594
Comments
Good catch! Did you report it in the Scala 3 compiler? |
@tgodzik to be honest, I wasn't sure what was at fault here. Is there any spec or tests in the reference implementation I could link to if I create a ticket on dotty? |
I checked how the Scala3 compiler generates the SemanticDB for infix argument tanishiking/scala3@5781617 (though the latest Scala3 generates it in |
I got it, for the following code trait SymbolTest {
def shouldBe(right: Any): Unit
def arg = 1
this shouldBe (arg)
} Scala2 (semanticdb-scalac) generates: trait SymbolTest/*<=_empty_.SymbolTest#*/ {
...
this shouldBe/*=>_empty_.SymbolTest#shouldBe().*/ (arg)/*=>_empty_.SymbolTest#arg().*/
}
and Scala3 generates: trait SymbolTest/*<=_empty_.SymbolTest#*/ {
...
this shouldBe/*=>_empty_.SymbolTest#shouldBe().*/ (arg/*=>_empty_.SymbolTest#arg().*/)
}
|
I personally see the Scala3 generated symbol occurrence for |
Hmm... having just |
The parenthesis inclusion is done only by scalameta parser. Both scala2 and scala3 trees at compilation exclude them and properly show position for arg ( excluding the parenthesis ). Scala3 semantic db position is thou different because its based on trees from compiler. |
I think scalameta parser should exclude The parentheses (if there're no special reasons), that should fix both scala2 and scala3? |
Looks like it! We should use the Positions suite for that, are you able to take a look in scalameta @tanishiking ? |
Thanks @tanishiking & @tgodzik ! |
scalafix/scalafix-tests/shared/src/main/scala/test/SymbolTest.scala
Lines 10 to 14 in 7cfbad5
Symbol lookup for
arg
fails against Scala 3.1.1 SemanticDB as the position there excludes surrounding parentheses while 2.x (scalac-semanticdb) and the parser include themhttps://github.com/scalacenter/scalafix/pull/1528/files#r846793225
The text was updated successfully, but these errors were encountered: