Accessing delimited continuations

I was under the impression that there is a delimited continuations library for scala. It seem to be discussed in Scala for the Impatient in Chapter 22, But my physical copy of that book only has 21 chapters.

I’ve followed the instructions found on stack overflow, How do I enable continuations in Scala?, and I get the following error when I try to build my project.

Does anyone have a suggestion of what is happening here?

Error:scalac: Error: org.jetbrains.jps.incremental.scala.remote.ServerException
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at scala.tools.nsc.plugins.Plugin$.instantiate(Plugin.scala:210)
	at scala.tools.nsc.plugins.Plugins.$anonfun$loadRoughPluginsList$9(Plugins.scala:53)
	at scala.tools.nsc.plugins.Plugins.loadRoughPluginsList(Plugins.scala:53)
	at scala.tools.nsc.plugins.Plugins.loadRoughPluginsList$(Plugins.scala:33)
	at scala.tools.nsc.Global.loadRoughPluginsList(Global.scala:44)
	at scala.tools.nsc.plugins.Plugins.roughPluginsList(Plugins.scala:56)
	at scala.tools.nsc.plugins.Plugins.roughPluginsList$(Plugins.scala:56)
	at scala.tools.nsc.Global.roughPluginsList$lzycompute(Global.scala:44)
	at scala.tools.nsc.Global.roughPluginsList(Global.scala:44)
	at scala.tools.nsc.plugins.Plugins.loadPlugins(Plugins.scala:92)
	at scala.tools.nsc.plugins.Plugins.loadPlugins$(Plugins.scala:62)
	at scala.tools.nsc.Global.loadPlugins(Global.scala:44)
	at scala.tools.nsc.plugins.Plugins.plugins(Plugins.scala:108)
	at scala.tools.nsc.plugins.Plugins.plugins$(Plugins.scala:108)
	at scala.tools.nsc.Global.plugins$lzycompute(Global.scala:44)
	at scala.tools.nsc.Global.plugins(Global.scala:44)
	at scala.tools.nsc.plugins.Plugins.computePluginPhases(Plugins.scala:119)
	at scala.tools.nsc.plugins.Plugins.computePluginPhases$(Plugins.scala:118)
	at scala.tools.nsc.Global.computePluginPhases(Global.scala:44)
	at scala.tools.nsc.Global.computePhaseDescriptors(Global.scala:709)
	at xsbt.ZincCompiler.phaseDescriptors$lzycompute(CallbackGlobal.scala:125)
	at xsbt.ZincCompiler.phaseDescriptors(CallbackGlobal.scala:119)
	at scala.tools.nsc.Global$Run.<init>(Global.scala:1216)
	at xsbt.ZincCompiler$ZincRun.<init>(CallbackGlobal.scala:63)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:128)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:105)
	at xsbt.CompilerInterface.run(CompilerInterface.scala:31)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
	at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:40)
	at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:35)
	at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:83)
	at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:26)
	at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
Caused by: java.lang.NoClassDefFoundError: scala/tools/nsc/transform/Transform$class
	at scala.tools.selectivecps.SelectiveANFTransform.<init>(SelectiveANFTransform.scala:12)
	at scala.tools.selectivecps.SelectiveCPSPlugin$$anon$2.<init>(SelectiveCPSPlugin.scala:20)
	at scala.tools.selectivecps.SelectiveCPSPlugin.<init>(SelectiveCPSPlugin.scala:16)
	... 48 more
Caused by: java.lang.ClassNotFoundException: scala.tools.nsc.transform.Transform$class
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 51 more```

After reading this, I updated the build.sbt to include the following

addCompilerPlugin("org.scala-lang.plugins" % "continuations" % "2.9.1")

Now, the project builds without that crazy stack trace, but I see the following error message

Error:scalac: bad option: -P:continuations:enable

I also get the following information

Information:scalac: Error: class not found: scala/ScalaObject required by scala.tools.selectivecps.SelectiveCPSPlugin

I tried removing the lines from build.sbt, and now the code compiles, but dies with a java.lang.NoSuchMethodError exception at run-time.

  def reduceWithEscape[A](objects:TraversableOnce[A], init:A, nullify:A, f:(A,A)=>A):A = {
    import scala.util.continuations._

    reset {
      shift { cc: (A => A) =>
        objects.fold(init) { (acc: A, obj: A) =>
          if (acc == nullify)
            cc(nullify)
          else
            f(acc, obj)
        }
      }
    }
  }
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=51542:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/lib/tools.jar:/Users/jnewton/sw/regular-type-expression/cl-robdd/src/cl-robdd-scala/target/scala-2.12/classes:/Users/jnewton/.ivy2/cache/com.itextpdf/itextpdf/jars/itextpdf-5.1.2.jar:/Users/jnewton/.ivy2/cache/org.scalactic/scalactic_2.12/bundles/scalactic_2.12-3.0.5.jar:/Users/jnewton/.ivy2/cache/org.scala-lang.plugins/scala-continuations-library_2.12/bundles/scala-continuations-library_2.12-1.0.3.jar:/Users/jnewton/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.12.8.jar:/Users/jnewton/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.8.jar:/Users/jnewton/.ivy2/cache/org.sameersingh.scalaplot/scalaplot/jars/scalaplot-0.0.4.jar:/Users/jnewton/.ivy2/cache/org.jboss.logging/jboss-logging-spi/jars/jboss-logging-spi-2.1.2.GA.jar:/Users/jnewton/.ivy2/cache/org.jboss/jboss-common-core/jars/jboss-common-core-2.5.0.Final.jar:/Users/jnewton/.ivy2/cache/jfree/jfreechart/jars/jfreechart-1.0.13.jar:/Users/jnewton/.ivy2/cache/jfree/jcommon/jars/jcommon-1.0.16.jar:/Users/jnewton/.ivy2/cache/com.itextpdf.tool/xmlworker/jars/xmlworker-1.1.0.jar bdd.BddTest
objc[28440]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Exception in thread "main" java.lang.NoSuchMethodError: scala.util.continuations.package$.shift(Lscala/Function1;)Ljava/lang/Object;
	at bdd.Aux$.$anonfun$reduceWithEscape$1(Bdd.scala:416)
	at scala.util.continuations.package$.reifyR(package.scala:184)
	at scala.util.continuations.package$.reset(package.scala:133)
	at bdd.Aux$.reduceWithEscape(Bdd.scala:416)
	at bdd.BddTest$.main(Bdd.scala:548)
	at bdd.BddTest.main(Bdd.scala)

Same problem is reproducible using Scastie.

scastie: Sending task to the server.
scastie: Connected. Waiting for sbt
sbt: [info] Compiling 1 Scala source to /tmp/scastie4895855177958235662/target/scala-2.12/classes ...
sbt: [info] Done compiling.
sbt: [info] Running Main
sbt: [error] (run-main-32) java.lang.NoSuchMethodError: scala.util.continuations.package$.shift(Lscala/Function1;)Ljava/lang/Object;
sbt: [error] java.lang.NoSuchMethodError: scala.util.continuations.package$.shift(Lscala/Function1;)Ljava/lang/Object;
sbt: [error] 	at Playground.$anonfun$reduceWithEscape$1(main.scala:7)
sbt: [error] 	at scala.util.continuations.package$.reifyR(package.scala:184)
sbt: [error] 	at scala.util.continuations.package$.reset(package.scala:133)
sbt: [error] 	at Playground.reduceWithEscape(main.scala:7)
sbt: [error] 	at Playground.<init>(main.scala:24)
sbt: [error] 	at Main$.<init>(main.scala:29)
sbt: [error] 	at Main$.<clinit>(main.scala)
sbt: [error] 	at Main.main(main.scala)
sbt: [error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sbt: [error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sbt: [error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
sbt: [error] 	at java.lang.reflect.Method.invoke(Method.java:498)
sbt: [error] Nonzero exit code: 1
sbt: [error] (Compile / fgRun) Nonzero exit code: 1
scastie: Closed.

The same error seems to be reported here. Although, sadly, it does not seem to have ever been resolved.

I’ve never used that library, but that addCompilerPlugin is pretty weird, and neither the name nor version number match what I expect – I suspect that it’s from before the library switched to community-supported, which I gather was a fairly long time ago.

Here’s the Scaladex page for what looks like the current (minimally supported) version, which more closely matches Seth’s answer from the SO page you linked to. (Seth is actually on the Scala team, and generally knows what he’s talking about.)

The Scaladex page says the library works for scala 2.12. Does that mean it works for 2.12.8?

The page also lists a single line to add to the build.sbt file. does that mean I SHOULD NOT update the compiler flags and compiler plugin?

libraryDependencies += "org.scala-lang.plugins" % "scala-continuations-plugin" % "1.0.3" cross CrossVersion.full

BTW following the instructions on the Scaladex page results in the following error in IntelliJ

Error while importing sbt project:

[info] Updating ...
[warn] 	module not found: org.scala-lang.plugins#scala-continuations-plugin_2.12.8;1.0.3
[warn] ==== local: tried
[warn]   /Users/jnewton/.ivy2/local/org.scala-lang.plugins/scala-continuations-plugin_2.12.8/1.0.3/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/scala-lang/plugins/scala-continuations-plugin_2.12.8/1.0.3/scala-continuations-plugin_2.12.8-1.0.3.pom
[warn] ==== local-preloaded-ivy: tried
[warn]   /Users/jnewton/.sbt/preloaded/org.scala-lang.plugins/scala-continuations-plugin_2.12.8/1.0.3/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn]   file:////Users/jnewton/.sbt/preloaded/org/scala-lang/plugins/scala-continuations-plugin_2.12.8/1.0.3/scala-continuations-plugin_2.12.8-1.0.3.pom
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::          UNRESOLVED DEPENDENCIES         ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: org.scala-lang.plugins#scala-continuations-plugin_2.12.8;1.0.3: not found
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] 	Note: Unresolved dependencies path:
[warn] 		org.scala-lang.plugins:scala-continuations-plugin_2.12.8:1.0.3 (/Users/jnewton/sw/regular-type-expression/cl-robdd/src/cl-robdd-scala/build.sbt#L17-18)
[warn] 		  +- default:cl-robdd-scala_2.12:0.1
[error] sbt.librarymanagement.ResolveException: unresolved dependency: org.scala-lang.plugins#scala-continuations-plugin_2.12.8;1.0.3: not found
[error] 	at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:332)
[error] 	at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither$1(IvyActions.scala:208)
[error] 	at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:239)
[error] 	at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)
[error] 	at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
[error] 	at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)

I suspect that Scaladex just isn’t set up properly for compiler plugins, so it’s mis-reporting the formula. Have you tried it the way Seth recommended?

the CrossVersion.full suffix means that the artifact’s version suffix in the name must match the current scala version exactly. According to Scaladex, there’s also a version which is compatible with all 2.12 Scala compiler versions (name has a binary Scala version suffix).

addCompilerPlugin("org.scala-lang.plugins" %% "scala-continuations-library" % "1.0.3")
1 Like

@cbley, thanks for the help. I’m trying to implement what you suggest, but I haven’t been able to make it work.

Here is what I have in my build.sbt file

name := "cl-robdd-scala"

version := "0.1"

scalaVersion := "2.12.8"
scalacOptions ++=
  Seq(
    "-P:continuations:enable"
    )

libraryDependencies += "junit" % "junit" % "4.10" % "test"
libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.5"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test"
libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.14.0" % "test"
libraryDependencies += "org.jboss" % "jboss-common-core" % "2.5.0.Final"
libraryDependencies += "org.sameersingh.scalaplot" % "scalaplot" % "0.0.4"
libraryDependencies += "org.scala-lang.plugins" % "scala-continuations-plugin" % "1.0.3" cross CrossVersion.full

autoCompilerPlugins := true
addCompilerPlugin("org.scala-lang.plugins" %% "scala-continuations-library" % "1.0.3")

However, there are errors importing the sbt project. Does that mean there is no scala-continuations-plugin for 1.12.8 ?

Error while importing sbt project:

[info] Loading settings from idea.sbt ...
[info] Loading global plugins from /Users/jimka/.sbt/1.0/plugins
[info] Loading project definition from /Users/jimka/sw/common-lisp/regular-type-expression/cl-robdd/src/cl-robdd-scala/project
[info] Loading settings from build.sbt ...
[info] Set current project to cl-robdd-scala (in build file:/Users/jimka/sw/common-lisp/regular-type-expression/cl-robdd/src/cl-robdd-scala/)
[info] sbt server started at local:///Users/jimka/.sbt/1.0/server/e7d830c283f84bac56f3/sock
sbt:cl-robdd-scala>
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile and 1 others.
[info] The new values will be used by cleanKeepFiles
[info] 	Run `last` for details.
[info] Reapplying settings...
[info] Set current project to cl-robdd-scala (in build file:/Users/jimka/sw/common-lisp/regular-type-expression/cl-robdd/src/cl-robdd-scala/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from /Users/jimka/Library/Application Support/IntelliJIdea2019.1/Scala/repo/org.jetbrains/sbt-structure-extractor/scala_2.12/sbt_1.0/2018.2.1+4-88400d3f/jars/sbt-structure-extractor.jar
[info] Reapplying settings...
[info] Set current project to cl-robdd-scala (in build file:/Users/jimka/sw/common-lisp/regular-type-expression/cl-robdd/src/cl-robdd-scala/)
[info] Updating ...
[warn] 	module not found: org.scala-lang.plugins#scala-continuations-plugin_2.12.8;1.0.3
[warn] ==== local: tried
[warn]   /Users/jimka/.ivy2/local/org.scala-lang.plugins/scala-continuations-plugin_2.12.8/1.0.3/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/scala-lang/plugins/scala-continuations-plugin_2.12.8/1.0.3/scala-continuations-plugin_2.12.8-1.0.3.pom
[warn] ==== local-preloaded-ivy: tried
[warn]   /Users/jimka/.sbt/preloaded/org.scala-lang.plugins/scala-continuations-plugin_2.12.8/1.0.3/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn]   file:////Users/jimka/.sbt/preloaded/org/scala-lang/plugins/scala-continuations-plugin_2.12.8/1.0.3/scala-continuations-plugin_2.12.8-1.0.3.pom
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::          UNRESOLVED DEPENDENCIES         ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: org.scala-lang.plugins#scala-continuations-plugin_2.12.8;1.0.3: not found
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] 	Note: Unresolved dependencies path:
[warn] 		org.scala-lang.plugins:scala-continuations-plugin_2.12.8:1.0.3 (/Users/jimka/sw/common-lisp/regular-type-expression/cl-robdd/src/cl-robdd-scala/build.sbt#L19-20)
[warn] 		  +- default:cl-robdd-scala_2.12:0.1
[error] sbt.librarymanagement.ResolveException: unresolved dependency: org.scala-lang.plugins#scala-continuations-plugin_2.12.8;1.0.3: not found
[error] 	at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:334)
[error] 	at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither$1(IvyActions.scala:208)
[error] 	at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:243)
[error] 	at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)
[error] 	at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
[error] 	at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)
[error] 	at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] 	at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] 	at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] 	at xsbt.boot.Using$.withResource(Using.scala:10)

Hmm. That appears to be reversed from what the StackOverflow answer says. You have the plugin as a libraryDependency, and the library as a plugin – that seems unlikely to be right…

You have to remove this line.

There does seem to be lots of contradictory information indeed.

Someone on Scala Contributors recommended I watch his video on youtube where he references this GitHub implementation

I’ve tried many different combinations of what’s in that GitHub link.

OK, so do I need an addCompilerPlugin line? and if so, is this the one?

libraryDependencies += "org.scala-lang.plugins" % "scala-continuations-library" % "1.0.3"

or rather this one?

libraryDependencies += "org.scala-lang.plugins" % "scala-continuations-library_2.12.8" % "1.0.3"

It seems the repo1.maven.org plugins repository stops at 1.12.2, and skips to 1.13.0-M1

When I try to hard code the version name, I get the following error, with 2.12.2 repeated.

module not found: org.scala-lang.plugins#scala-continuations-plugin_2.12.2_2.12;1.0.3

However, if I omit the version number, i get the following error

module not found: org.scala-lang.plugins#scala-continuations-plugin_2.12;1.0.3

Yes, you’re right. It seems the plugin was not yet published for Scala versions > 2.12.2. https://mvnrepository.com/artifact/org.scala-lang.plugins/scala-continuations-plugin_2.12.2/1.0.3

The Scaladex page does provide the 2.12 entry in the version list, but that is misleading since it switches to the library, not the plugin.

Seems you’re out of luck in this case, only thing you can do is downgrade your project to 2.12.2, which probably has other downsides.

Of course, you could open an issue and ask for someone to publish for 2.12.8.

Yes, I’d like to file an issue. They can of course refuse. But how would I file an issue anyway? I can try this on the GitHub page of scala-continuations.

new issue

Here’s a similar issue, that took quite some time: https://github.com/scala/scala-continuations/issues/28