File tree Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -4,18 +4,11 @@ scalaVersion := version.value
4
4
5
5
libraryDependencies += " org.scala-lang" % " scala-dist" % version.value
6
6
7
- // TODO: find out how to enable continuations plugin. also un-comment ContinuationsTest afterwards!
7
+ // funky way to enable the continuations plugin.
8
8
// http://stackoverflow.com/questions/24755254/how-to-enable-compiler-plugin-from-librarydependencies
9
-
10
- // autoCompilerPlugins := true
11
-
12
- // val addContinuationsPlugin = taskKey[Unit]("Add continuations plugin")
13
-
14
- // addContinuationsPlugin := {
15
- // println(update.value.allModules.find(_.name contains "continuations-plugin"))
16
- // compilerPlugin(update.value.allModules.find(_.name contains "continuations-plugin").get)
17
- // }
18
-
19
- // libraryDependencies += compilerPlugin(update.value.allModules.find(_.name contains "continuations-plugin").get)
20
-
21
- // scalacOptions += "-P:continuations:enable"
9
+ scalacOptions ++= {
10
+ val compileConfig = update.value.configurations.find(_.configuration == " compile" ).get
11
+ val pluginModule = compileConfig.modules.find(_.module.name contains " continuations-plugin" ).get
12
+ val pluginFile = pluginModule.artifacts.head._2
13
+ Seq (s " -Xplugin: ${pluginFile.getCanonicalPath}" , " -P:continuations:enable" )
14
+ }
Original file line number Diff line number Diff line change @@ -3,14 +3,12 @@ package scaladist
3
3
import scala .util .continuations ._
4
4
5
5
object ContinuationsTest {
6
- /*
7
- def foo(): Int @cps[Int] = { // could leave out return type
6
+ def foo (): Int @ cps[Int ] = {
8
7
shift { k : (Int => Int ) =>
9
8
k(7 )
10
9
} + 1
11
10
}
12
- */
13
11
def test (): Unit = {
14
- // assert(reset(2 * foo()) == 16)
12
+ assert(reset(2 * foo()) == 16 )
15
13
}
16
14
}
You can’t perform that action at this time.
0 commit comments