[error] /Users/Neo/Documents/masteryScala/masterywebscala/src/main/scala/macroTest/DebugMacros.scala:14: object blackbox is not a member of package scala.reflect.macros
[error] import scala.reflect.macros.blackboxeven though in Eclipse this produces no errors.
2) If I include whitebox macros, the compiler tells me the same thing.
3) If I include import scala.reflect.macros
I get a deprecation warning in Eclipse and it still fails to build.
4) If I attempt the q"def x = 5" statement I get told that value q is "Not a member of string context."
I've been through the source of uTest and a few other projects, and have no idea what voodoo you are using to get this stuff to compile. Any help is greatly appreciated. Thanks!
Travis
package macroTest
import scala.annotation.StaticAnnotation
import scala.language.experimental.macros
import scala.reflect.ClassTag
import scala.util.{Failure, Success}
import scala.collection.SortedSet
import scala.concurrent.duration.{FiniteDuration, Duration}
//import scala.reflect.macros.blackbox.Context
import scala.language.higherKinds
import scala.language.experimental.macros
//import scala.reflect.macros.whitebox.Context
//import scala.reflect.macros.blackbox
//import scala.reflect.macros.Context
object DebugMacros {
def tester(): Unit = {
q"def x = 5"
}
}
"org.scala-lang" % "scala-reflect" % "2.11.5"
to SBT project, along with variations. None of them seem to work.
lazy val root = project.in(file(".")).
enablePlugins(ScalaJSPlugin)
import com.lihaoyi.workbench.Plugin._
import com.typesafe.sbteclipse.core.EclipsePlugin.EclipseKeys
EclipseKeys.withSource := true
workbenchSettings
name := "masteryWebScala"
version := "1"
scalaVersion := "2.11.5"
resolvers += Resolver.url("scala-js-releases",
url("http://dl.bintray.com/scala-js/scala-js-releases/"))(
Resolver.ivyStylePatterns)
persistLauncher := true
persistLauncher in Test := false
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature")
libraryDependencies ++= Seq(
"be.doeraene" %%% "scalajs-jquery" % "0.7.0",
"org.scala-js" %%% "scalajs-dom" % "0.7.0",
"org.monifu" %%% "minitest" % "0.11" % "test",
"com.lihaoyi" %% "upickle" % "0.2.6"
)
libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _)
testFrameworks += new TestFramework("minitest.runner.Framework")
jsDependencies +=
"org.webjars" % "jquery" % "2.1.3" / "jquery.js"
jsDependencies += ProvidedJS / "sha3.js"
jsDependencies += ProvidedJS / "travisObject.js"
bootSnippet := "ScalaJS.modules.tmw_Masterywebscala().main();"
def impl(c: Context)(f: c.Expr[Any]) = { import c.universe._
val q"(..$args) => $body" = f.tree
println(s"args = $args, body = $body")
c.Expr(q"()")
}
def straightTestImpl(c: Context)(a: c.Expr[String]) = {
import c.universe._
val r = "Hello World"
c.Expr(q"val x = 4")
c.Expr(q"()")
}
name := "tgmacrosproj"
organization := "travisgood"
"travisgood" %%% "tgmacrosproj" % "0.1-SNAPSHOT"
object DebugMacros {
def testV(a: String): Unit = macro straightTestImpl
DebugMacros.testV(myStr)
"org.scala-js" %%% "scalajs-dom" % "0.8.0",Which is incompatible with what I believe is actually the current version, .7. This broke my build in very confusing ways when including the external project.