diff options
Diffstat (limited to 'library/src/dotty/DottyPredef.scala')
-rw-r--r-- | library/src/dotty/DottyPredef.scala | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/library/src/dotty/DottyPredef.scala b/library/src/dotty/DottyPredef.scala new file mode 100644 index 000000000..cd90c4882 --- /dev/null +++ b/library/src/dotty/DottyPredef.scala @@ -0,0 +1,45 @@ +package dotty + +import scala.reflect.runtime.universe.TypeTag +import scala.reflect.ClassTag +import scala.Predef.??? +import scala.collection.Seq + +/** unimplemented implicit for TypeTag */ +object DottyPredef { + implicit def typeTag[T]: TypeTag[T] = ??? + + implicit def arrayTag[T](implicit ctag: ClassTag[T]): ClassTag[Array[T]] = + ctag.wrap + + /** A fall-back implicit to compare values of any types. + * The compiler will restrict implicit instances of `eqAny`. An instance + * `eqAny[T, U]` is _valid_ if `T <: U` or `U <: T` or both `T` and `U` are + * Eq-free. A type `S` is Eq-free if there is no implicit instance of `Eq[S, S]`. + * An implicit search will fail instead of returning an invalid `eqAny` instance. + */ + implicit def eqAny[L, R]: Eq[L, R] = Eq + + implicit def eqNumber : Eq[Number, Number] = Eq + implicit def eqString : Eq[String, String] = Eq + + // true asymmetry, modeling the (somewhat problematic) nature of equals on Proxies + implicit def eqProxy : Eq[Proxy, Any] = Eq + + implicit def eqSeq[T, U](implicit eq: Eq[T, U]): Eq[Seq[T], Seq[U]] = Eq + + implicit def eqByteNum : Eq[Byte, Number] = Eq + implicit def eqNumByte : Eq[Number, Byte] = Eq + implicit def eqCharNum : Eq[Char, Number] = Eq + implicit def eqNumChar : Eq[Number, Char] = Eq + implicit def eqShortNum : Eq[Short, Number] = Eq + implicit def eqNumShort : Eq[Number, Short] = Eq + implicit def eqIntNum : Eq[Int, Number] = Eq + implicit def eqNumInt : Eq[Number, Int] = Eq + implicit def eqLongNum : Eq[Long, Number] = Eq + implicit def eqNumLong : Eq[Number, Long] = Eq + implicit def eqFloatNum : Eq[Float, Number] = Eq + implicit def eqNumFloat : Eq[Number, Float] = Eq + implicit def eqDoubleNum: Eq[Double, Number] = Eq + implicit def eqNumDouble: Eq[Number, Double] = Eq +} |