diff options
author | Martin Odersky <odersky@gmail.com> | 2006-03-31 10:36:49 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-03-31 10:36:49 +0000 |
commit | 3049afc7ec7ca038dd8d68d26803c0733df01ee1 (patch) | |
tree | 0a41f798b75b4aef55ab00e645cc77b6cdb0be69 /src/library | |
parent | 7ff239d7a998fb0ef7443e6c2020b6dcb64dabdd (diff) | |
download | scala-3049afc7ec7ca038dd8d68d26803c0733df01ee1.tar.gz scala-3049afc7ec7ca038dd8d68d26803c0733df01ee1.tar.bz2 scala-3049afc7ec7ca038dd8d68d26803c0733df01ee1.zip |
fixed several old bugs
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Predef.scala | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index ab3bfc7650..3e3bca2ea8 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -207,6 +207,36 @@ object Predef { } } + implicit def byte2ordered(x: byte): Ordered[byte] = new Ordered[byte] with Proxy { + def self: Any = x; + def compare [b >: byte <% Ordered[b]](y: b): int = y match { + case y1: byte => + if (x < y1) -1 + else if (x > y1) 1 + else 0 + case _ => -(y compare x) + } + } + + implicit def short2ordered(x: short): Ordered[short] = new Ordered[short] with Proxy { + def self: Any = x; + def compare [b >: short <% Ordered[b]](y: b): int = y match { + case y1: short => + if (x < y1) -1 + else if (x > y1) 1 + else 0 + case _ => -(y compare x) + } + } + + implicit def unit2ordered(x: unit): Ordered[unit] = new Ordered[unit] with Proxy { + def self: Any = x; + def compare [b >: unit <% Ordered[b]](y: b): int = y match { + case y1: unit => 0 + case _ => -(y compare x) + } + } + implicit def long2ordered(x: long): Ordered[long] = new Ordered[long] with Proxy { def self: Any = x; def compare [b >: long <% Ordered[b]](y: b): int = y match { |