summaryrefslogtreecommitdiff
path: root/test/files/pos/viewtest2.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2008-05-20 13:29:39 +0000
committermichelou <michelou@epfl.ch>2008-05-20 13:29:39 +0000
commitc1f07338ed21e551446a5c98d262d738a9b7b0ce (patch)
tree8143f69f0b97ff8bb02600991476b104afa652dc /test/files/pos/viewtest2.scala
parent7d71e4cf09074f3d1cf7539d28bba64a976524d6 (diff)
downloadscala-c1f07338ed21e551446a5c98d262d738a9b7b0ce.tar.gz
scala-c1f07338ed21e551446a5c98d262d738a9b7b0ce.tar.bz2
scala-c1f07338ed21e551446a5c98d262d738a9b7b0ce.zip
int -> Int, etc..
Diffstat (limited to 'test/files/pos/viewtest2.scala')
-rw-r--r--test/files/pos/viewtest2.scala34
1 files changed, 17 insertions, 17 deletions
diff --git a/test/files/pos/viewtest2.scala b/test/files/pos/viewtest2.scala
index 321f5d7712..5c8678099d 100644
--- a/test/files/pos/viewtest2.scala
+++ b/test/files/pos/viewtest2.scala
@@ -10,40 +10,40 @@ trait Ordered[+a] {
* x == 0 iff this == that
* x > 0 iff this > that
*/
- def compareTo [b >: a <% Ordered[b]](that: b): int
+ def compareTo [b >: a <% Ordered[b]](that: b): Int
- def < [b >: a <% Ordered[b]](that: b): boolean = (this compareTo that) < 0
+ def < [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) < 0
- def > [b >: a <% Ordered[b]](that: b): boolean = (this compareTo that) > 0
+ def > [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) > 0
- def <= [b >: a <% Ordered[b]](that: b): boolean = (this compareTo that) <= 0
+ def <= [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) <= 0
- def >= [b >: a <% Ordered[b]](that: b): boolean = (this compareTo that) >= 0
+ def >= [b >: a <% Ordered[b]](that: b): Boolean = (this compareTo that) >= 0
}
object O {
implicit def view1(x: String): Ordered[String] = new Ordered[String] {
- def compareTo [b >: String <% Ordered[b]](y: b): int = y match {
+ def compareTo [b >: String <% Ordered[b]](y: b): Int = y match {
case y1: String => x compareTo y1
case _ => -(y compareTo x)
}
}
- implicit def view2(x: char): Ordered[char] = new Ordered[char] {
- def compareTo [b >: char <% Ordered[b]](y: b): int = y match {
- case y1: char => x - y1
+ implicit def view2(x: Char): Ordered[Char] = new Ordered[Char] {
+ def compareTo [b >: Char <% Ordered[b]](y: b): Int = y match {
+ case y1: Char => x - y1
case _ => -(y compareTo x)
}
}
implicit def view3[a <% Ordered[a]](x: List[a]): Ordered[List[a]] =
new Ordered[List[a]] {
- def compareTo [b >: List[a] <% Ordered[b]](y: b): int = y match {
+ def compareTo [b >: List[a] <% Ordered[b]](y: b): Int = y match {
case y1: List[a1] => compareLists(x, y1.asInstanceOf[List[a]])
case _ => -(y compareTo x)
}
- private def compareLists(xs: List[a], ys: List[a]): int = {
+ private def compareLists(xs: List[a], ys: List[a]): Int = {
if (xs.isEmpty && ys.isEmpty) 0
else if (xs.isEmpty) -1
else if (ys.isEmpty) 1
@@ -76,7 +76,7 @@ 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 {
+ def compareTo[b >: Str <% Ordered[b]](that: b): Int = that match {
case that1: Str => this.elem compareTo that1.elem
case _ => -(that compareTo this)
}
@@ -89,24 +89,24 @@ object Test {
if (s.length() == 0) List()
else s.charAt(0) :: toCharList(s.substring(1))
- def main(args: Array[String]) = {
+ def main(args: Array[String]) {
{
var t: Tree[String] = Empty
- for (val s <- args) {
+ for (s <- args) {
t = t insert s
}
Console.println(t.elements)
}
{
var t: Tree[Str] = Empty
- for (val s <- args) {
+ for (s <- args) {
t = t insert Str(s)
}
Console.println(t.elements)
}
{
- var t: Tree[List[char]] = Empty
- for (val s <- args) {
+ var t: Tree[List[Char]] = Empty
+ for (s <- args) {
t = t insert toCharList(s)
}
Console.println(t.elements)