Skip to content

Symbol.fullName is inconsistent with JVM class name for nested objects #13321

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

Closed
scf37 opened this issue Aug 17, 2021 · 1 comment
Closed

Symbol.fullName is inconsistent with JVM class name for nested objects #13321

scf37 opened this issue Aug 17, 2021 · 1 comment

Comments

@scf37
Copy link

scf37 commented Aug 17, 2021

Compiler version

3.0.1

Minimized code

import scala.quoted._
object Macro:
  inline def apply[A]: Unit = ${impl[A]}

  private def impl[A: Type](using Quotes): Expr[String] =
    import quotes.reflect._
    val t = TypeRepr.of[A]
    println(t.classSymbol.get.fullName)
    Expr("")
object Foo:
  object Boo

object Main:
  def main(args: Array[String]) =
    Macro[Foo.Boo.type]

Output

Foo$.Boo$

Expectation

Correct runtime name for Foo.Boo:

Foo$Boo$
@dwijnand
Copy link
Member

I don't see how the expectation is justified. Here's the docs for fullName:

https://github.com/lampepfl/dotty/blob/3be078dfd06d0438cfaea44632947b7ec3b676ac/library/src/scala/quoted/Quotes.scala#L3485-L3486

Which gives no guarantees in regards to the runtime names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants