1
나는 2.11.0-M7에 포트에 스칼라 2.10에서 매크로를 시도하고있다 :Scala 2.11의 매크로 API는 어떻게 되었습니까?
import scala.reflect.macros.Context
object Format {
def apply[A]: Unit = macro applyImpl[A]
def applyImpl[A: c.WeakTypeTag](c: Context): c.Expr[Unit] = ???
}
뭔가를 변경해야합니다 컴파일러는 scala.reflect.macros.Context
이 존재하지 않는다고 말했습니다 때문이다.
내 빌드 파일은 다음과 같습니다
scalaVersion := "2.11.0-M7"
resolvers += Resolver.sonatypeRepo("snapshots")
addCompilerPlugin("org.scala-lang.plugins" % "macro-paradise" % "2.0.0-SNAPSHOT"
cross CrossVersion.full)
모든 단서?
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
Context
이되지 않습니다,하지만 컴파일 :
저는 항상 scala-reflect에 명시 적으로 의존해야한다고 생각합니다. –
@EugeneBurmako - 사실, 아니요, 제 도서관은 2.10에서 [명시 적으로 반영하지 않고] (https://github.com/Sciss/play-json-sealed/blob/master/project/Build.scala)를 컴파일 중이었습니다. 어쨌든 큰 문제는, 그것은 지금 작동합니다 :) –
흠 그 이상하다. –