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 position for parens wrapped identifier #1083
Comments
Just hit again on a similar problem @ """
List(builder) map (_.result)
""".parse[Stat].get.collect {
case t @ q"_.result" => t.syntax
}
res1: List[String] = List("(_.result)") // obtained
res1: List[String] = List("_.result") // expected The example works as expected if it's not an ApplyInfix |
Reported by @MasseGuillaume in #1444 def structure(source: String): String =
source.parse[Stat].get.asInstanceOf[Term.ApplyInfix].args.head.tokens.structure
// This is what I get
structure("a op (f)") == "Tokens(( [5..6), f [6..7), ) [7..8))"
// This is what I expect
structure("a op (f)") == "Tokens(f [6..7))"
// With multiple args I get what I expect
structure("a op (f, g)") == "Tokens(f [6..7))" |
A good place to look into this would be scalameta/scalameta/parsers/shared/src/main/scala/scala/meta/internal/parsers/ScalametaParser.scala Lines 1163 to 1164 in 97e1e8a
where Term.Name nodes are created. |
I'm on this. |
…plyInfix which have parens around ref scalameta/scalameta#1083
…plyInfix which have parens around ref scalameta/scalameta#1083
and scalacenter/scalafix#1104 Given ``` trait Test { def shouldBe(r: Any) = ??? def arg() = "" this shouldBe (arg) } ``` Without changes in this commit then `this shouldBe (arg)` + will not be rewritten if scalacenter/scalafix#1104 is not fixed + will be rewritten to invalid code `this shouldBe (arg)()` if scalacenter/scalafix#1104 is fixed but scalameta/scalameta#1083 is not fixed
and scalacenter/scalafix#1104 Given ``` trait Test { def shouldBe(r: Any) = ??? def arg() = "" this shouldBe (arg) } ``` Without changes in this commit then `this shouldBe (arg)` + will not be rewritten if scalacenter/scalafix#1104 is not fixed + will be rewritten to invalid code `this shouldBe (arg)()` if scalacenter/scalafix#1104 is fixed but scalameta/scalameta#1083 is not fixed
still relevant? i can't repro. |
Closing as fixed then :) |
This causes problems when looking up symbols of names by their positions.
The text was updated successfully, but these errors were encountered: