Created
May 7, 2014 14:59
-
-
Save sam/2e673d79a7562105d163 to your computer and use it in GitHub Desktop.
I keep getting the errors in `errors.sh` when I try to compile or run my Quasiquotes example main class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "examples" | |
organization := "com.github.sam" | |
version := "1.0-SNAPSHOT" | |
scalaVersion := "2.11.0" | |
parallelExecution in ThisBuild := false | |
resolvers += "Maven Central" at "http://repo1.maven.org/maven2" | |
libraryDependencies ++= Seq( | |
"org.scala-lang" % "scala-reflect" % scalaVersion.value, | |
"joda-time" % "joda-time" % "2.2", | |
"org.joda" % "joda-convert" % "1.2", | |
"org.scalatest" %% "scalatest" % "2.1.5" % "test") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
→ sbt | |
[info] Loading global plugins from /Users/sam/.sbt/0.13/plugins | |
[info] Loading project definition from /Users/sam/src/scala-examples/project | |
[info] Set current project to examples (in build file:/Users/sam/src/scala-examples/) | |
> compile | |
[info] Updating {file:/Users/sam/src/scala-examples/}scala-examples... | |
[info] Resolving jline#jline;2.11 ... | |
[info] Done updating. | |
[info] Compiling 5 Scala sources to /Users/sam/src/scala-examples/target/scala-2.11/classes... | |
[error] /Users/sam/src/scala-examples/src/main/scala/Quasiquotes.scala:9: object tools is not a member of package scala | |
[error] import scala.tools.reflect.ToolBox | |
[error] ^ | |
[error] /Users/sam/src/scala-examples/src/main/scala/Quasiquotes.scala:11: value mkToolBox is not a member of reflect.runtime.universe.Mirror | |
[error] val toolbox = currentMirror.mkToolBox() | |
[error] ^ | |
[error] two errors found | |
[error] (compile:compile) Compilation failed | |
[error] Total time: 4 s, completed May 7, 2014 9:50:47 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.sam.examples | |
object Quasiquotes extends App { | |
val universe = reflect.runtime.universe | |
import universe._ | |
import reflect.runtime.currentMirror | |
import scala.tools.reflect.ToolBox | |
val toolbox = currentMirror.mkToolBox() | |
import toolbox.u._ | |
val code = q"""1 to 10 foreach(println)""" | |
val compiledCode = toolbox.compile(code) | |
compiledCode() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment