augustjune / context-applied

Compiler plugin for intuitive tagless final
MIT License
128 stars 8 forks source link

Breaks macros with higher-kinded implicits #15

Open steinybot opened 1 year ago

steinybot commented 1 year ago

When context-applied is enabled it breaks the following:

import scala.language.experimental.macros
import scala.reflect.macros.blackbox

trait F[A]

object MacroImpl {

  def myMacroImpl(c: blackbox.Context)()(bob: c.Expr[F[_]]): c.Expr[Unit] = {
    import c.universe._
    c.Expr[Unit](q"""()""")
  }
}

object Macro {

  def myMacro[B]()(implicit bob: F[B]): Unit = macro MacroImpl.myMacroImpl
}

It fails to compile with:

[error] /Users/jason/src/bug-reports/src/main/scala/Macro.scala:16:64: missing argument list for method myMacroImpl in object MacroImpl
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `myMacroImpl _` or `myMacroImpl(_)()(_)` instead of `myMacroImpl`.
[error]   def myMacro[B]()(implicit bob: F[B]): Unit = macro MacroImpl.myMacroImpl
[error]                                                                ^
[error] one error found

👉 Reproduction