summaryrefslogtreecommitdiff
path: root/test/files/continuations-run/shift-pct.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-04-05 10:31:22 -0700
committerPaul Phillips <paulp@improving.org>2012-04-05 11:23:37 -0700
commit37eabf615afe3de9733ea41cc9c522df3e2a6b87 (patch)
tree459ff741c38fc98a60ccbce028aa944259ae06d3 /test/files/continuations-run/shift-pct.scala
parentbb4935e92c26778a1d1096cd5cd66812a9122f66 (diff)
downloadscala-37eabf615afe3de9733ea41cc9c522df3e2a6b87.tar.gz
scala-37eabf615afe3de9733ea41cc9c522df3e2a6b87.tar.bz2
scala-37eabf615afe3de9733ea41cc9c522df3e2a6b87.zip
Fix for continuations issue.
Avoid explicit type arguments which don't conform to bounds where they could be successfully inferred. I had to disable one "neg" test which is no longer neg. Can anyone clue me in as to whether it is important?
Diffstat (limited to 'test/files/continuations-run/shift-pct.scala')
-rw-r--r--test/files/continuations-run/shift-pct.scala30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/files/continuations-run/shift-pct.scala b/test/files/continuations-run/shift-pct.scala
new file mode 100644
index 0000000000..7ef9922168
--- /dev/null
+++ b/test/files/continuations-run/shift-pct.scala
@@ -0,0 +1,30 @@
+import scala.util.continuations._
+
+object Test {
+ abstract class IfReturnRepro {
+ def s1: Double @cpsParam[Any, Unit]
+ def s2: Double @cpsParam[Any, Unit]
+
+ def p(i: Int): Double @cpsParam[Unit, Any] = {
+ val px = s1
+ val pct = if (px > 100) px else px / s2
+ println("pct = %.3f".format(pct))
+ pct
+ }
+ }
+
+ def main(args: Array[String]) : Unit = {
+ var d: Double = 0d
+ def d2 = d * d
+
+ val irr = new IfReturnRepro {
+ def s1 = shift(f => f(d))
+ def s2 = shift(f => f(d2))
+ }
+ 1 to 25 foreach { i =>
+ d = i
+ print("d = " + i + ", d2 = " + d2 + ", ")
+ run(irr p i)
+ }
+ }
+}