diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2012-06-13 19:17:42 +0200 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2012-06-13 19:17:42 +0200 |
commit | 120766fa33adbbb13bc21d5622a6a30ed6b2b230 (patch) | |
tree | b5b936d16e5c70cfb2cdc7ca24b30a24f17291e5 | |
parent | 87e23f5f523fc1c5b6ece12f6a812f26820e4da7 (diff) | |
download | scala-120766fa33adbbb13bc21d5622a6a30ed6b2b230.tar.gz scala-120766fa33adbbb13bc21d5622a6a30ed6b2b230.tar.bz2 scala-120766fa33adbbb13bc21d5622a6a30ed6b2b230.zip |
Don't crash if cpsParam is not on the classpath.
When checking if a piece of code needs the continuations plugin, the cpsParam classes may not be on the class path. Assume it does not need it in that case.
-rw-r--r-- | src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala b/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala index 862b19d0a4..a20ff1667b 100644 --- a/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala +++ b/src/continuations/plugin/scala/tools/selectivecps/CPSAnnotationChecker.scala @@ -4,6 +4,7 @@ package scala.tools.selectivecps import scala.tools.nsc.Global import scala.tools.nsc.typechecker.Modes +import scala.tools.nsc.MissingRequirementError abstract class CPSAnnotationChecker extends CPSUtils with Modes { val global: Global @@ -356,8 +357,9 @@ abstract class CPSAnnotationChecker extends CPSUtils with Modes { * for a tree. All this should do is add annotations. */ override def addAnnotations(tree: Tree, tpe: Type): Type = { + import scala.util.control._ if (!cpsEnabled) { - if (hasCpsParamTypes(tpe)) + if (Exception.failAsValue(classOf[MissingRequirementError])(false)(hasCpsParamTypes(tpe))) global.reporter.error(tree.pos, "this code must be compiled with the Scala continuations plugin enabled") return tpe } |