summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-02-03 11:12:17 +0000
committerBurak Emir <emir@epfl.ch>2007-02-03 11:12:17 +0000
commite92807e3128c0299798eedef18436596bdab2f56 (patch)
tree542b802c18509c62941781cdf676d810a490577d
parent3eae42f4cc89fde2fffe2861c024341cf1ce700b (diff)
downloadscala-e92807e3128c0299798eedef18436596bdab2f56.tar.gz
scala-e92807e3128c0299798eedef18436596bdab2f56.tar.bz2
scala-e92807e3128c0299798eedef18436596bdab2f56.zip
rewrote list patterns to avoid exhaustivity war...
rewrote list patterns to avoid exhaustivity warnings
-rw-r--r--src/library/scala/List.scala18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala
index e03f39bc63..1d4716d4a4 100644
--- a/src/library/scala/List.scala
+++ b/src/library/scala/List.scala
@@ -787,11 +787,14 @@ sealed abstract class List[+a] extends Seq[a] {
smaller match {
case Nil =>
acc
- case List(x) =>
+ //case List(x) =>
+ case x :: Nil =>
x::acc
- case List(x, y) =>
+ //case List(x, y) =>
+ case x :: y :: Nil =>
if (lt(x, y)) x::(y::acc) else y::x::acc
- case List(x, y, z) =>
+ //case List(x, y, z) =>
+ case x :: y :: z :: Nil =>
if (lt(x, y)) {
if (lt(y, z)) x::y::z::acc
else if (lt(x, z)) x::z::y::acc
@@ -808,11 +811,14 @@ sealed abstract class List[+a] extends Seq[a] {
this match {
case Nil =>
this
- case List(x) =>
+// case List(x) =>
+ case x :: Nil =>
this
- case List(x, y) =>
+// case List(x, y) =>
+ case x::y::Nil =>
if (lt(x, y)) this else y::x::Nil
- case List(x, y, z) =>
+// case List(x, y, z) =>
+ case x::y::z::Nil =>
if (lt(x, y)) {
if (lt(y, z)) this
else if (lt(x, z)) x::z::y::Nil