aboutsummaryrefslogtreecommitdiff
path: root/src/scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-05-07 13:04:22 +0200
committerMartin Odersky <odersky@gmail.com>2016-05-23 16:11:45 +0200
commit2ffecb841b078e2952b200ece21d1c2cdad52f9a (patch)
treec44b44417d564447b69f35d38925856ba141391f /src/scala
parent22d1ad46f77bfe89e901a5576bc722f748bd7e19 (diff)
downloaddotty-2ffecb841b078e2952b200ece21d1c2cdad52f9a.tar.gz
dotty-2ffecb841b078e2952b200ece21d1c2cdad52f9a.tar.bz2
dotty-2ffecb841b078e2952b200ece21d1c2cdad52f9a.zip
Fix comments in Eq class and make it a trait.
Diffstat (limited to 'src/scala')
-rw-r--r--src/scala/Eq.scala11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/scala/Eq.scala b/src/scala/Eq.scala
index 6d993ac39..1ac6e55d2 100644
--- a/src/scala/Eq.scala
+++ b/src/scala/Eq.scala
@@ -2,9 +2,9 @@ package scala
import annotation.implicitNotFound
-/** A marker class indicating that values of kind `T` can be compared. */
+/** A marker trait indicating that values of kind `T` can be compared to values of type `U`. */
@implicitNotFound("Values of types ${L} and ${R} cannot be compared with == or !=")
-class Eq[-L, -R]
+trait Eq[-L, -R]
/** Besides being a companion object, this object
* can also be used as a value that's compatible with
@@ -12,8 +12,11 @@ class Eq[-L, -R]
*/
object Eq extends Eq[Any, Any] {
- /** An implicit that provides an `Eq` instance for all types `T`
- * such that `T <: EqClass[T]`.
+ /** A fall-back implicit to compare values of any types.
+ * The compiler will restrict implicit instances of `eqAny`. An instance
+ * `eqAny[T, U]` is _invalid_ if `T` or `U` is a non-bottom type that
+ * has an implicit `Eq[T, T]` (respectively `Eq[U, U]`) instance.
+ * An implicit search will fail instead of returning an invalid `eqAny` instance,
*/
implicit def eqAny[L, R]: Eq[L, R] = Eq
}