summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2006-10-13 19:06:41 +0000
committermichelou <michelou@epfl.ch>2006-10-13 19:06:41 +0000
commitaf511469a6c4323488e1e263cc2f45786f276672 (patch)
tree507ccb0fee6fe1c1b7ef9ea2955c8b3d4d7bbbbe /test/files
parentec04190880e49b0d32651fe04e27a67bd952bcdd (diff)
downloadscala-af511469a6c4323488e1e263cc2f45786f276672.tar.gz
scala-af511469a6c4323488e1e263cc2f45786f276672.tar.bz2
scala-af511469a6c4323488e1e263cc2f45786f276672.zip
changed "All/AllRef" to "Nothing/Null" in test/...
changed "All/AllRef" to "Nothing/Null" in test/library/compiler
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/viewtest.check2
-rw-r--r--test/files/neg/viewtest.scala64
-rw-r--r--test/files/pos/infer.scala14
-rw-r--r--test/files/pos/patterns.scala18
-rw-r--r--test/files/pos/patterns1.scala16
-rw-r--r--test/files/pos/simplelists.scala29
-rw-r--r--test/files/pos/viewtest1.scala2
-rw-r--r--test/files/pos/viewtest2.scala6
8 files changed, 77 insertions, 74 deletions
diff --git a/test/files/neg/viewtest.check b/test/files/neg/viewtest.check
index f7920de368..b98b56bce5 100644
--- a/test/files/neg/viewtest.check
+++ b/test/files/neg/viewtest.check
@@ -2,6 +2,6 @@ viewtest.scala:104 error: ambiguous implicit value:
both method view4 in object O of type [a](a)a
and method identity in object Predef of type [a](a)a
match expected type (test.Str) => test.Ordered[test.Str]
- t = t insert Str(s)
+ t = t insert Str(s)
^
one error found
diff --git a/test/files/neg/viewtest.scala b/test/files/neg/viewtest.scala
index deb6480983..5a8abdccfd 100644
--- a/test/files/neg/viewtest.scala
+++ b/test/files/neg/viewtest.scala
@@ -1,4 +1,4 @@
-package test;
+package test
/** A trait for totally ordered data.
*/
@@ -10,15 +10,15 @@ 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
}
@@ -26,13 +26,13 @@ object O {
implicit def view1(x: String): Ordered[String] = new Ordered[String] {
def compareTo [b >: String <% Ordered[b]](y: b): int = y match {
- case y1: String => x compareTo y1;
+ 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;
+ case y1: char => x - y1
case _ => -(y compareTo x)
}
}
@@ -40,38 +40,38 @@ object O {
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 {
- case y1: List[a] => compareLists(x, y1);
- case _ => -(y compareTo x)
+ case y1: List[a] => compareLists(x, y1)
+ case _ => -(y compareTo x)
}
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
- else {
- val s = xs.head compareTo ys.head;
- if (s != 0) s
- else compareLists(xs.tail, ys.tail)
- }
+ if (xs.isEmpty && ys.isEmpty) 0
+ else if (xs.isEmpty) -1
+ else if (ys.isEmpty) 1
+ else {
+ val s = xs.head compareTo ys.head
+ if (s != 0) s
+ else compareLists(xs.tail, ys.tail)
+ }
}
}
- implicit def view4[a](x: a): a = x;
+ implicit def view4[a](x: a): a = x
}
trait Tree[+a <% Ordered[a]] {
- def insert[b >: a <% Ordered[b]](x: b): Tree[b];
+ def insert[b >: a <% Ordered[b]](x: b): Tree[b]
def elements: List[a]
}
-object Empty extends Tree[All] {
- def insert[b >: All <% Ordered[b]](x: b): Tree[b] = new Node(x, Empty, Empty);
- def elements: List[All] = List();
+object Empty extends Tree[Nothing] {
+ def insert[b >: Nothing <% Ordered[b]](x: b): Tree[b] = new Node(x, Empty, Empty)
+ def elements: List[Nothing] = List()
}
class Node[a <% Ordered[a]](elem: a, l: Tree[a], r: Tree[a]) extends Tree[a] {
def insert[b >: a <% Ordered[b]](x: b): Tree[b] =
if (x == elem) this
else if (x < elem) new Node(elem, l insert x, r)
- else new Node(elem, l, r insert x);
+ else new Node(elem, l, r insert x)
def elements: List[a] =
l.elements ::: List(elem) ::: r.elements
}
@@ -84,31 +84,31 @@ case class Str(elem: String) extends Ordered[Str] {
}
object Test {
- import O._;
+ import O._
private def toCharList(s: String): List[Char] =
if (s.length() == 0) List()
- else s.charAt(0) :: toCharList(s.substring(1));
+ else s.charAt(0) :: toCharList(s.substring(1))
def main(args: Array[String]) = {
{
- var t: Tree[String] = Empty;
+ var t: Tree[String] = Empty
for (val s <- args) {
- t = t insert s
+ t = t insert s
}
System.out.println(t.elements)
}
{
- var t: Tree[Str] = Empty;
+ var t: Tree[Str] = Empty
for (val s <- args) {
- t = t insert Str(s)
+ t = t insert Str(s)
}
System.out.println(t.elements)
}
{
- var t: Tree[List[char]] = Empty;
+ var t: Tree[List[char]] = Empty
for (val s <- args) {
- t = t insert toCharList(s)
+ t = t insert toCharList(s)
}
System.out.println(t.elements)
}
diff --git a/test/files/pos/infer.scala b/test/files/pos/infer.scala
index 24871458b3..6aeed40491 100644
--- a/test/files/pos/infer.scala
+++ b/test/files/pos/infer.scala
@@ -1,11 +1,11 @@
object test {
class List[+a] {
- def ::[b >: a](x: b): List[b] = new Cons(x, this);
+ def ::[b >: a](x: b): List[b] = new Cons(x, this)
}
- case class Cons[a, b <: a](x: a, xs: List[b]) extends List[a];
- case object Nil extends List[All];
- def nil[n]: List[n] = Nil;
- def cons[a](x: a, xs: List[a]): List[a] = null;
- val x: List[Int] = Nil.::(1);
- val y: List[Int] = nil.::(1);
+ case class Cons[a, b <: a](x: a, xs: List[b]) extends List[a]
+ case object Nil extends List[Nothing]
+ def nil[n]: List[n] = Nil
+ def cons[a](x: a, xs: List[a]): List[a] = null
+ val x: List[Int] = Nil.::(1)
+ val y: List[Int] = nil.::(1)
}
diff --git a/test/files/pos/patterns.scala b/test/files/pos/patterns.scala
index 93907e7d52..85d8a1b7da 100644
--- a/test/files/pos/patterns.scala
+++ b/test/files/pos/patterns.scala
@@ -1,27 +1,29 @@
trait Option[+a] {}
+
case class Some[a](x: a) extends Option[a] {
- override def toString(): String = "Some(" + x + ")";
+ override def toString(): String = "Some(" + x + ")"
override def equals(that: Any): Boolean = that match {
case Some(x) => this.x == x
case _ => false
}
- override def hashCode(): scala.Int = getClass().hashCode() * 41 + x.hashCode();
+ override def hashCode(): Int = getClass().hashCode() * 41 + x.hashCode()
}
-case object None extends Option[All] {
- override def toString(): String = "None";
+
+case object None extends Option[Nothing] {
+ override def toString(): String = "None"
override def equals(that: Any) = that match {
case None => true
case _ => false
}
- override def hashCode(): scala.Int = getClass().hashCode();
+ override def hashCode(): Int = getClass().hashCode()
}
object test {
- def println(str: String): Unit = java.lang.System.out.println(str);
+ def println(str: String): Unit = java.lang.System.out.println(str)
def print(opt: Option[String]) = opt match {
- case Some(x) => println(x);
- case None => println("nothing");
+ case Some(x) => println(x)
+ case None => println("nothing")
}
}
diff --git a/test/files/pos/patterns1.scala b/test/files/pos/patterns1.scala
index fa542e7b06..f660ea0543 100644
--- a/test/files/pos/patterns1.scala
+++ b/test/files/pos/patterns1.scala
@@ -1,13 +1,15 @@
-trait Option[+a] {}
-case class Some[a](x: a) extends Option[a];
-case object None extends Option[All];
+trait Option[+a]
+
+case class Some[a](x: a) extends Option[a]
+
+case object None extends Option[Nothing]
object test {
- def println(str: String): Unit = java.lang.System.out.println(str);
+ def println(str: String): Unit = java.lang.System.out.println(str)
def print(opt: Option[String]) = opt match {
- case Some(x) => println(x);
- case None => println("nothing");
+ case Some(x) => println(x)
+ case None => println("nothing")
}
-} \ No newline at end of file
+}
diff --git a/test/files/pos/simplelists.scala b/test/files/pos/simplelists.scala
index 73b04a8762..ed3d5d2c38 100644
--- a/test/files/pos/simplelists.scala
+++ b/test/files/pos/simplelists.scala
@@ -1,17 +1,16 @@
- abstract class List[+a] {
- def head: a;
- def tail: List[a];
- def cons[b >: a](x: b): List[b] = new Cons[b, a](x, this);
- }
+abstract class List[+a] {
+ def head: a
+ def tail: List[a]
+ def cons[b >: a](x: b): List[b] = new Cons[b, a](x, this)
+}
- object Nil extends List[All] {
- def error(msg: String): All = throw new java.lang.Error(msg);
- def head: All = error("Nil.head");
- def tail: List[All] = error("Nil.tail");
- }
-
- class Cons[c, d <: c](x: c, xs: List[d]) extends List[c] {
- def head: c = x;
- def tail: List[c] = xs;
- }
+object Nil extends List[Nothing] {
+ def error(msg: String): Nothing = throw new java.lang.Error(msg)
+ def head: Nothing = error("Nil.head")
+ def tail: List[Nothing] = error("Nil.tail")
+}
+class Cons[c, d <: c](x: c, xs: List[d]) extends List[c] {
+ def head: c = x
+ def tail: List[c] = xs
+}
diff --git a/test/files/pos/viewtest1.scala b/test/files/pos/viewtest1.scala
index 46acefa32e..4019690961 100644
--- a/test/files/pos/viewtest1.scala
+++ b/test/files/pos/viewtest1.scala
@@ -10,7 +10,7 @@ object O {
}
}
-object Empty extends Tree[All]
+object Empty extends Tree[Nothing]
case class Node[c <% Ordered[c]](elem: c, l: Tree[c], r: Tree[c]) extends Tree[c]
trait Tree[+a <% Ordered[a]] {
diff --git a/test/files/pos/viewtest2.scala b/test/files/pos/viewtest2.scala
index 70257baa29..66cd1aa1bd 100644
--- a/test/files/pos/viewtest2.scala
+++ b/test/files/pos/viewtest2.scala
@@ -61,9 +61,9 @@ trait Tree[+a <% Ordered[a]] {
def elements: List[a]
}
-object Empty extends Tree[All] {
- def insert[b >: All <% Ordered[b]](x: b): Tree[b] = new Node(x, Empty, Empty)
- def elements: List[All] = List()
+object Empty extends Tree[Nothing] {
+ def insert[b >: Nothing <% Ordered[b]](x: b): Tree[b] = new Node(x, Empty, Empty)
+ def elements: List[Nothing] = List()
}
class Node[a <% Ordered[a]](elem: a, l: Tree[a], r: Tree[a]) extends Tree[a] {