summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-03-20 12:03:12 +0000
committerMartin Odersky <odersky@gmail.com>2006-03-20 12:03:12 +0000
commit5459db1226b86027e0817acb0a2f41e0c12b28ed (patch)
tree2662cea2c40283eadcdccb5d53d58f769a825601 /test
parent4ddf81c21818dadb435a4a43b91ae69688d8bc1d (diff)
downloadscala-5459db1226b86027e0817acb0a2f41e0c12b28ed.tar.gz
scala-5459db1226b86027e0817acb0a2f41e0c12b28ed.tar.bz2
scala-5459db1226b86027e0817acb0a2f41e0c12b28ed.zip
1.
2. Changed method compareTo in class Ordered to compare. 3. Moved retsynch to pending 4. Fixed bug 550
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/bug550.check10
-rwxr-xr-xtest/files/neg/bug550.scala9
-rw-r--r--test/files/pos/orderedpoints.scala6
-rw-r--r--test/files/pos/viewtest3.scala6
-rw-r--r--test/files/run/retsynch.check1
-rw-r--r--test/files/run/retsynch.scala11
6 files changed, 25 insertions, 18 deletions
diff --git a/test/files/neg/bug550.check b/test/files/neg/bug550.check
new file mode 100644
index 0000000000..becafc8768
--- /dev/null
+++ b/test/files/neg/bug550.check
@@ -0,0 +1,10 @@
+bug550.scala:6 error: class List takes type parameters
+ def sum[a](xs: List)(implicit m: Monoid[a]): a =
+ ^
+bug550.scala:6 error: class List takes type parameters
+ def sum[a](xs: List)(implicit m: Monoid[a]): a =
+ ^
+bug550.scala:8 error: no implicit argument matching parameter type Monoid[scala.All] was found.
+ sum(List(1,2,3))
+ ^
+three errors found
diff --git a/test/files/neg/bug550.scala b/test/files/neg/bug550.scala
new file mode 100755
index 0000000000..5212a2658d
--- /dev/null
+++ b/test/files/neg/bug550.scala
@@ -0,0 +1,9 @@
+abstract class Monoid[a] {
+ def unit: a
+}
+
+object test {
+ def sum[a](xs: List)(implicit m: Monoid[a]): a =
+ if (xs.isEmpty) m.unit else xs.head
+ sum(List(1,2,3))
+}
diff --git a/test/files/pos/orderedpoints.scala b/test/files/pos/orderedpoints.scala
index 7e56a663fe..f972028bce 100644
--- a/test/files/pos/orderedpoints.scala
+++ b/test/files/pos/orderedpoints.scala
@@ -2,9 +2,9 @@ package test;
class Point1(x: int) extends Object with Ordered[Point1] {
val xCoord = x;
- def compareTo [b >: Point1 <% Ordered[b]](that: b): int = that match {
- case that1: Point1 => this.xCoord.compareTo(that1.xCoord)
- case _ => -that.compareTo(this)
+ def compare [b >: Point1 <% Ordered[b]](that: b): int = that match {
+ case that1: Point1 => this.xCoord.compare(that1.xCoord)
+ case _ => -that.compare(this)
}
}
class Point2(x: int, y: int) extends Point1(x) with Ordered[Point2] {}
diff --git a/test/files/pos/viewtest3.scala b/test/files/pos/viewtest3.scala
index 89e32e48a8..68277a7a47 100644
--- a/test/files/pos/viewtest3.scala
+++ b/test/files/pos/viewtest3.scala
@@ -20,9 +20,9 @@ class Node[a <% Ordered[a]](elem: a, l: Tree[a], r: Tree[a]) extends Tree[a] {
}
case class Str(elem: String) extends Ordered[Str] {
- def compareTo[b >: Str <% Ordered[b]](that: b): int = that match {
- case that1: Str => this.elem compareTo that1.elem
- case _ => -(that compareTo this)
+ def compare[b >: Str <% Ordered[b]](that: b): int = that match {
+ case that1: Str => this.elem compare that1.elem
+ case _ => -(that compare this)
}
}
diff --git a/test/files/run/retsynch.check b/test/files/run/retsynch.check
deleted file mode 100644
index 8c40598f93..0000000000
--- a/test/files/run/retsynch.check
+++ /dev/null
@@ -1 +0,0 @@
-abs(-5) = 5
diff --git a/test/files/run/retsynch.scala b/test/files/run/retsynch.scala
deleted file mode 100644
index d6398cf28e..0000000000
--- a/test/files/run/retsynch.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-object Test {
- def abs(x:int): int = synchronized {
- if(x > 0)
- return x
- return -x
- }
-
- def main(args: Array[String]) = {
- Console.println("abs(-5) = " + abs(-5))
- }
-}