summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala5
-rw-r--r--test/files/continuations-run/t3199.check1
-rw-r--r--test/files/continuations-run/t3199.scala20
-rw-r--r--test/files/continuations-run/t3199b.check1
-rw-r--r--test/files/continuations-run/t3199b.scala11
5 files changed, 37 insertions, 1 deletions
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
index a09772d236..5bad9e960c 100644
--- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
+++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
@@ -234,8 +234,11 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with
case Typed(expr0, tpt) =>
// TODO: should x: A @cps[B,C] have a special meaning?
+ // type casts used in different ways (see match2.scala, #3199)
val (stms, expr, spc) = transInlineValue(expr0, cpsA)
- val tpt1 = treeCopy.TypeTree(tpt).setType(removeAllCPSAnnotations(tpt.tpe))
+ val tpt1 = if (treeInfo.isWildcardStarArg(tree)) tpt else
+ treeCopy.TypeTree(tpt).setType(removeAllCPSAnnotations(tpt.tpe))
+// (stms, updateSynthFlag(treeCopy.Typed(tree, expr, tpt1)), spc)
(stms, treeCopy.Typed(tree, expr, tpt1).setType(removeAllCPSAnnotations(tree.tpe)), spc)
case TypeApply(fun, args) =>
diff --git a/test/files/continuations-run/t3199.check b/test/files/continuations-run/t3199.check
new file mode 100644
index 0000000000..a065247b8c
--- /dev/null
+++ b/test/files/continuations-run/t3199.check
@@ -0,0 +1 @@
+Right(7)
diff --git a/test/files/continuations-run/t3199.scala b/test/files/continuations-run/t3199.scala
new file mode 100644
index 0000000000..3fd2f1959a
--- /dev/null
+++ b/test/files/continuations-run/t3199.scala
@@ -0,0 +1,20 @@
+import _root_.scala.collection.Seq
+import _root_.scala.util.control.Exception
+import _root_.scala.util.continuations._
+
+object Test {
+
+ trait AbstractResource[+R <: AnyRef] {
+ def reflect[B] : R @cpsParam[B,Either[Throwable, B]] = shift(acquireFor)
+ def acquireFor[B](f : R => B) : Either[Throwable, B] = {
+ import Exception._
+ catching(List(classOf[Throwable]) : _*) either (f(null.asInstanceOf[R]))
+ }
+ }
+
+ def main(args: Array[String]) : Unit = {
+ val x = new AbstractResource[String] { }
+ val result = x.acquireFor( x => 7 )
+ println(result)
+ }
+ }
diff --git a/test/files/continuations-run/t3199b.check b/test/files/continuations-run/t3199b.check
new file mode 100644
index 0000000000..b5d8bb58d9
--- /dev/null
+++ b/test/files/continuations-run/t3199b.check
@@ -0,0 +1 @@
+[1, 2, 3]
diff --git a/test/files/continuations-run/t3199b.scala b/test/files/continuations-run/t3199b.scala
new file mode 100644
index 0000000000..950c584153
--- /dev/null
+++ b/test/files/continuations-run/t3199b.scala
@@ -0,0 +1,11 @@
+object Test {
+
+ def test() = {
+ java.util.Arrays.asList(Array(1,2,3):_*)
+ }
+
+ def main(args: Array[String]) = {
+ println(test())
+ }
+
+} \ No newline at end of file