Question

I am trying to port a macro from Scala 2.10 to 2.11.0-M7:

import scala.reflect.macros.Context

object Format {
  def apply[A]: Unit = macro applyImpl[A]

  def applyImpl[A: c.WeakTypeTag](c: Context): c.Expr[Unit] = ???
}

Something must have changed, because the compiler says scala.reflect.macros.Context doesn't exist.

My build file looks like this:

scalaVersion := "2.11.0-M7"

resolvers += Resolver.sonatypeRepo("snapshots")

addCompilerPlugin("org.scala-lang.plugins" % "macro-paradise" % "2.0.0-SNAPSHOT"
  cross CrossVersion.full)

Any clues?

Was it helpful?

Solution

One needs to explicitly add scala-reflect now:

libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value

Context is deprecated, but it compiles.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top