summaryrefslogtreecommitdiff
path: root/test
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
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')
-rw-r--r--test/disabled/continuations-neg/infer0.check (renamed from test/files/continuations-neg/infer0.check)0
-rw-r--r--test/disabled/continuations-neg/infer0.scala (renamed from test/files/continuations-neg/infer0.scala)8
-rw-r--r--test/files/continuations-run/shift-pct.check25
-rw-r--r--test/files/continuations-run/shift-pct.scala30
4 files changed, 58 insertions, 5 deletions
diff --git a/test/files/continuations-neg/infer0.check b/test/disabled/continuations-neg/infer0.check
index 1dd072ef09..1dd072ef09 100644
--- a/test/files/continuations-neg/infer0.check
+++ b/test/disabled/continuations-neg/infer0.check
diff --git a/test/files/continuations-neg/infer0.scala b/test/disabled/continuations-neg/infer0.scala
index 9cf69c5d35..6d97d7504d 100644
--- a/test/files/continuations-neg/infer0.scala
+++ b/test/disabled/continuations-neg/infer0.scala
@@ -4,11 +4,9 @@ import scala.util.continuations._
object Test {
-
def test(x: => Int @cpsParam[String,Int]) = 7
-
- def main(args: Array[String]): Any = {
+
+ def main(args: Array[String]) {
test(8)
}
-
-} \ No newline at end of file
+}
diff --git a/test/files/continuations-run/shift-pct.check b/test/files/continuations-run/shift-pct.check
new file mode 100644
index 0000000000..fb190e770a
--- /dev/null
+++ b/test/files/continuations-run/shift-pct.check
@@ -0,0 +1,25 @@
+d = 1, d2 = 1.0, pct = 1.000
+d = 2, d2 = 4.0, pct = 0.500
+d = 3, d2 = 9.0, pct = 0.333
+d = 4, d2 = 16.0, pct = 0.250
+d = 5, d2 = 25.0, pct = 0.200
+d = 6, d2 = 36.0, pct = 0.167
+d = 7, d2 = 49.0, pct = 0.143
+d = 8, d2 = 64.0, pct = 0.125
+d = 9, d2 = 81.0, pct = 0.111
+d = 10, d2 = 100.0, pct = 0.100
+d = 11, d2 = 121.0, pct = 0.091
+d = 12, d2 = 144.0, pct = 0.083
+d = 13, d2 = 169.0, pct = 0.077
+d = 14, d2 = 196.0, pct = 0.071
+d = 15, d2 = 225.0, pct = 0.067
+d = 16, d2 = 256.0, pct = 0.063
+d = 17, d2 = 289.0, pct = 0.059
+d = 18, d2 = 324.0, pct = 0.056
+d = 19, d2 = 361.0, pct = 0.053
+d = 20, d2 = 400.0, pct = 0.050
+d = 21, d2 = 441.0, pct = 0.048
+d = 22, d2 = 484.0, pct = 0.045
+d = 23, d2 = 529.0, pct = 0.043
+d = 24, d2 = 576.0, pct = 0.042
+d = 25, d2 = 625.0, pct = 0.040
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)
+ }
+ }
+}