From 1face3f96d9320775a2b455a4e21038e865d8d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Doeraene?= Date: Thu, 19 Nov 2020 17:45:42 +0100 Subject: [PATCH] Remove scala.Product0. The addition of that trait is not essential to Scala 3. While it can be argued that it should exist, there is nothing special in Scala 3 compared to Scala 2 that makes it necessary. In the spirit of reusing the Scala 2.13 standard library with as few deviations as possible, we therefore remove it. It could be added back when we revise the standard library on its own. --- library/src/scala/Product0.scala | 23 ----------------------- library/src/scala/Tuple.scala | 11 +++++++++-- 2 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 library/src/scala/Product0.scala diff --git a/library/src/scala/Product0.scala b/library/src/scala/Product0.scala deleted file mode 100644 index d50721d02da7..000000000000 --- a/library/src/scala/Product0.scala +++ /dev/null @@ -1,23 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2013, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ -package scala - -/** A class for Product0 which was missing from the scala distribution. */ -object Product0 { - def unapply(x: Product0): Option[Product0] = - Some(x) -} - -trait Product0 extends Any with Product { - - override def productArity = 0 - - @throws(classOf[IndexOutOfBoundsException]) - override def productElement(n: Int) = - throw new IndexOutOfBoundsException(n.toString()) -} diff --git a/library/src/scala/Tuple.scala b/library/src/scala/Tuple.scala index a17e73c509be..851facda3533 100644 --- a/library/src/scala/Tuple.scala +++ b/library/src/scala/Tuple.scala @@ -248,9 +248,16 @@ object Tuple { /** A tuple of 0 elements */ type EmptyTuple = EmptyTuple.type -/** A tuple of 0 elements; the canonical representation of a [[scala.Product0]]. */ -object EmptyTuple extends Tuple with Product0 { +/** A tuple of 0 elements. */ +object EmptyTuple extends Tuple { + override def productArity: Int = 0 + + @throws(classOf[IndexOutOfBoundsException]) + override def productElement(n: Int): Any = + throw new IndexOutOfBoundsException(n.toString()) + def canEqual(that: Any): Boolean = this == that + override def toString(): String = "()" }