Skip to content

Wrong signature for Scala 2 macro bundle selection #8947

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
bishabosha opened this issue May 11, 2020 · 1 comment
Closed

Wrong signature for Scala 2 macro bundle selection #8947

bishabosha opened this issue May 11, 2020 · 1 comment

Comments

@bishabosha
Copy link
Member

Minimized code

compile src-2/MacroImpl.scala with scala 2.13.2 then compile src-3/Macros.scala with the previous output on classpath

// src-2/MacroImpl.scala
class MacroImpl(val c: scala.reflect.macros.blackbox.Context) {
  import c.universe._
  def poly[T: c.WeakTypeTag]: Tree = q"${c.weakTypeOf[T].toString}"
}
// src-3/Macros.scala
import scala.language.experimental.macros

object Macros {

  object Bundles {
    def poly[T]: String = macro (new MacroImpl(null)).poly[T]
    inline def poly[T]: String = ${ Macros3.polyImpl[T] }
  }

  object Macros3 {
    def polyImpl[T: Type](using QuoteContext) = Expr(summon[Type[T]].show)
  }

}

Output

Tasty for the macro definition

def poly[T]: String = macro (new MacroImpl(null)).poly[T]

has the following signature for selecting the poly method from MacroImpl:

poly[Signed Signature(List(1, scala.Nothing),scala.reflect.api.Trees.TreeApi)]

I believe it should be:

poly[Signed Signature(List(1, scala.reflect.api.TypeTags.WeakTypeTag),scala.reflect.api.Trees.TreeApi)]

Expectation

@bishabosha
Copy link
Member Author

After investigation, there is nothing here in particular to do with macros, see #8991

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