Skip to content

Commit

Permalink
enable continuations plugin and test
Browse files Browse the repository at this point in the history
  • Loading branch information
lrytz committed Jul 15, 2014
1 parent a1847e1 commit b4a342a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
21 changes: 7 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@ scalaVersion := version.value

libraryDependencies += "org.scala-lang" % "scala-dist" % version.value

// TODO: find out how to enable continuations plugin. also un-comment ContinuationsTest afterwards!
// funky way to enable the continuations plugin.
// http://stackoverflow.com/questions/24755254/how-to-enable-compiler-plugin-from-librarydependencies

//autoCompilerPlugins := true

//val addContinuationsPlugin = taskKey[Unit]("Add continuations plugin")

//addContinuationsPlugin := {
// println(update.value.allModules.find(_.name contains "continuations-plugin"))
// compilerPlugin(update.value.allModules.find(_.name contains "continuations-plugin").get)
//}

//libraryDependencies += compilerPlugin(update.value.allModules.find(_.name contains "continuations-plugin").get)

//scalacOptions += "-P:continuations:enable"
scalacOptions ++= {
val compileConfig = update.value.configurations.find(_.configuration == "compile").get
val pluginModule = compileConfig.modules.find(_.module.name contains "continuations-plugin").get
val pluginFile = pluginModule.artifacts.head._2
Seq(s"-Xplugin:${pluginFile.getCanonicalPath}", "-P:continuations:enable")
}
6 changes: 2 additions & 4 deletions src/main/scala/scaladist/ContinuationsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ package scaladist
import scala.util.continuations._

object ContinuationsTest {
/*
def foo(): Int @cps[Int] = { // could leave out return type
def foo(): Int @cps[Int] = {
shift { k: (Int=>Int) =>
k(7)
} + 1
}
*/
def test(): Unit = {
// assert(reset(2 * foo()) == 16)
assert(reset(2 * foo()) == 16)
}
}

0 comments on commit b4a342a

Please sign in to comment.