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 we remove scala-reflect requirement in XtensionTokenName? #502

Closed
olafurpg opened this issue Oct 6, 2016 · 0 comments
Closed

Can we remove scala-reflect requirement in XtensionTokenName? #502

olafurpg opened this issue Oct 6, 2016 · 0 comments

Comments

@olafurpg
Copy link
Member

olafurpg commented Oct 6, 2016

See https://github.com/olafurpg/scalafmt/issues/492

For some reason, parsing this invalid source requires scala-reflect.

object A {
  <.section(render(props)
}

The root cause is XtensionTokenName:

implicit class XtensionTokenName(token: Token) {
def name: String = {
import scala.reflect.runtime.{universe => ru}
object TokenReflection extends {
val u: ru.type = ru
val mirror: u.Mirror = u.runtimeMirror(classOf[Token].getClassLoader)
} with scala.meta.internal.tokens.Reflection
import TokenReflection._
val mirror = ru.runtimeMirror(classOf[Token].getClassLoader)
mirror.classSymbol(token.getClass).asLeaf.tokenName
}

It would be fantastic if I could drop the dependency on scala-reflect in scalafmt ^^

olafurpg added a commit to scalameta/scalafmt that referenced this issue Oct 6, 2016
Once scalameta/scalameta#502 is fixed, we can
remove scala-reflect.

Crazy enough, I wasn't able to reproduce the error via SBT so now I have
a bash script to ensure the same doesn't happen again.
olafurpg added a commit to scalameta/scalafmt that referenced this issue Oct 6, 2016
Once scalameta/scalameta#502 is fixed, we can
remove scala-reflect.

Crazy enough, I wasn't able to reproduce the error via SBT so now I have
a bash script to ensure the same doesn't happen again.
olafurpg added a commit to scalameta/scalafmt that referenced this issue Oct 6, 2016
Once scalameta/scalameta#502 is fixed, we can
remove scala-reflect.

Crazy enough, I wasn't able to reproduce the error via SBT so now I have
a bash script to ensure the same doesn't happen again.
olafurpg added a commit to scalameta/scalafmt that referenced this issue Oct 7, 2016
Once scalameta/scalameta#502 is fixed, we can
remove scala-reflect.

Crazy enough, I wasn't able to reproduce the error via SBT so now I have
a bash script to ensure the same doesn't happen again.
olafurpg added a commit to scalameta/scalafmt that referenced this issue Oct 7, 2016
Once scalameta/scalameta#502 is fixed, we can
remove scala-reflect.

Crazy enough, I wasn't able to reproduce the error via SBT so now I have
a bash script to ensure the same doesn't happen again.
@xeno-by xeno-by mentioned this issue Oct 10, 2016
@xeno-by xeno-by closed this as completed Oct 10, 2016
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

No branches or pull requests

2 participants