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

Can't get symbol from TextDocument for arg of ApplyInfix which have parens around #1104

Closed
ohze opened this issue Apr 24, 2020 · 0 comments · Fixed by #1105
Closed

Can't get symbol from TextDocument for arg of ApplyInfix which have parens around #1104

ohze opened this issue Apr 24, 2020 · 0 comments · Fixed by #1105

Comments

@ohze
Copy link

ohze commented Apr 24, 2020

trait SymbolTest {
  def shouldBe(right: Any)
  def arg = 1
  this shouldBe (arg)
}
val arg :: Nil = doc.tree.collect {
  case Term.ApplyInfix(_, Term.Name("shouldBe"), _, arg :: Nil) => arg
}
assertNotEquals(arg.symbol, Symbol.None)

assertNotEquals fail

giabao added a commit to giabao/scalafix that referenced this issue Apr 24, 2020
giabao added a commit to giabao/scalafix that referenced this issue Apr 24, 2020
giabao added a commit to giabao/scalafix that referenced this issue Apr 24, 2020
@giabao giabao mentioned this issue Apr 26, 2020
giabao added a commit to ohze/scala-rewrites that referenced this issue Apr 27, 2020
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
giabao added a commit to ohze/scala-rewrites that referenced this issue Apr 27, 2020
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
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 a pull request may close this issue.

1 participant