From af511469a6c4323488e1e263cc2f45786f276672 Mon Sep 17 00:00:00 2001 From: michelou Date: Fri, 13 Oct 2006 19:06:41 +0000 Subject: changed "All/AllRef" to "Nothing/Null" in test/... changed "All/AllRef" to "Nothing/Null" in test/library/compiler --- test/files/pos/infer.scala | 14 +++++++------- test/files/pos/patterns.scala | 18 ++++++++++-------- test/files/pos/patterns1.scala | 16 +++++++++------- test/files/pos/simplelists.scala | 29 ++++++++++++++--------------- test/files/pos/viewtest1.scala | 2 +- test/files/pos/viewtest2.scala | 6 +++--- 6 files changed, 44 insertions(+), 41 deletions(-) (limited to 'test/files/pos') 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] { -- cgit v1.2.3