diff options
-rw-r--r-- | sources/scala/Ord.scala | 4 | ||||
-rw-r--r-- | sources/scala/Symbol.scala | 8 | ||||
-rw-r--r-- | test/files/run/overloads.scala | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/sources/scala/Ord.scala b/sources/scala/Ord.scala index 911d58d29f..07619d552e 100644 --- a/sources/scala/Ord.scala +++ b/sources/scala/Ord.scala @@ -20,11 +20,13 @@ trait Ord[t <: Ord[t]]: t { */ -trait Ord[+T <: Ord[T]] { +trait Ord[+T <: Ord[T]]: T { def < [S >: T <: Ord[S]](that: S): Boolean; def <=[S >: T <: Ord[S]](that: S): Boolean = this < that || this == that; def > [S >: T <: Ord[S]](that: S): Boolean = that < this; def >=[S >: T <: Ord[S]](that: S): Boolean = that <= this; + def min[S >: T <: Ord[S]](that: S): S = if (this < that) this else that; + def max[S >: T <: Ord[S]](that: S): S = if (this < that) that else this; } /* diff --git a/sources/scala/Symbol.scala b/sources/scala/Symbol.scala index 1d6bfe6fbb..832b9721ed 100644 --- a/sources/scala/Symbol.scala +++ b/sources/scala/Symbol.scala @@ -9,6 +9,7 @@ package scala; + /** Instances of <code>Symbol</code> can be created easily with * Scala's built-in quote mechanism. For instance, the Scala term * <code>'mysym</code> will invoke the constructor of the @@ -18,14 +19,11 @@ package scala; * @author Martin Odersky * @version 1.7, 08/12/2003 */ -case class Symbol( name: String ) { +final case class Symbol(name: String) { - /** Converts this symbol to a string + /** Converts this symbol to a string. */ override def toString(): String = { "'" + name } - - final def <=(value: String) = new Pair(name, value); - } diff --git a/test/files/run/overloads.scala b/test/files/run/overloads.scala index e9b9433962..c23ca23bef 100644 --- a/test/files/run/overloads.scala +++ b/test/files/run/overloads.scala @@ -26,11 +26,11 @@ object Funcs { object M1 { def f[A](x: A) = 11; - def f[A <: StructuralEquality[A]](x: A) = 12; + def f[A <: Ord[A]](x: A) = 12; } object M2 { - def f[A <: StructuralEquality[A]](x: A) = 21; + def f[A <: Ord[A]](x: A) = 21; def f[A](x: A) = 22; } |