diff --git a/library/src-2.x/dotty/DottyPredef.scala b/library/src-2.x/dotty/DottyPredef.scala deleted file mode 100644 index 0350629a759b..000000000000 --- a/library/src-2.x/dotty/DottyPredef.scala +++ /dev/null @@ -1,38 +0,0 @@ -package dotty - -import scala.forceInline - -object DottyPredef { - - @forceInline final def assert(assertion: => Boolean, message: => Any): Unit = { - if (!assertion) - assertFail(message) - } - - @forceInline final def assert(assertion: => Boolean): Unit = { - if (!assertion) - assertFail() - } - - def assertFail(): Unit = throw new java.lang.AssertionError("assertion failed") - def assertFail(message: => Any): Unit = throw new java.lang.AssertionError("assertion failed: " + message) - - @forceInline final def implicitly[T](implicit ev: T): T = ev - - @forceInline def locally[T](body: => T): T = body - - /** - * Retrieve the single value of a type with a unique inhabitant. - * - * @example {{{ - * object Foo - * val foo = valueOf[Foo.type] - * // foo is Foo.type = Foo - * - * val bar = valueOf[23] - * // bar is 23.type = 23 - * }}} - * @group utilities - */ - @forceInline def valueOf[T](implicit vt: ValueOf[T]): T = vt.value -} diff --git a/library/src-2.x/dotty/internal/StringContextMacro.scala b/library/src-2.x/dotty/internal/StringContextMacro.scala deleted file mode 100644 index 0d1184941740..000000000000 --- a/library/src-2.x/dotty/internal/StringContextMacro.scala +++ /dev/null @@ -1,8 +0,0 @@ -package dotty.internal - -object StringContextMacro { - - @forceInline def f(sc: => scala.StringContext)(args: Any*): String = - throw new Exception("non-boostrapped library") - -} diff --git a/library/src-2.x/scala/Tuple.scala b/library/src-2.x/scala/Tuple.scala deleted file mode 100644 index 7c981cc592ea..000000000000 --- a/library/src-2.x/scala/Tuple.scala +++ /dev/null @@ -1,10 +0,0 @@ -package scala -import annotation.showAsInfix - -sealed trait Tuple extends Any -object Tuple - -@showAsInfix -sealed class *:[+H, +T <: Tuple] extends Tuple - -object *: \ No newline at end of file diff --git a/library/src-2.x/scala/deriving.scala b/library/src-2.x/scala/deriving.scala deleted file mode 100644 index 34b96598ff3d..000000000000 --- a/library/src-2.x/scala/deriving.scala +++ /dev/null @@ -1,76 +0,0 @@ -/* -package scala - -object deriving { - - /** Mirrors allows typelevel access to enums, case classes and objects, and their sealed parents. - */ - sealed trait Mirror { - - /** The mirrored *-type */ - type MirroredMonoType - - /** The name of the type */ - type MirroredLabel <: String - - /** The names of the product elements */ - type MirroredElemLabels // <: Tuple // Bound removed to allow this to compile with - // Scala 2. The full version of this file is in - // library/src-3.x/scala/deriving.scala - } - - object Mirror { - - /** The Mirror for a sum type */ - trait Sum extends Mirror { self => - /** The ordinal number of the case class of `x`. For enums, `ordinal(x) == x.ordinal` */ - def ordinal(x: MirroredMonoType): Int - } - - /** The Mirror for a product type */ - trait Product extends Mirror { - - /** Create a new instance of type `T` with elements taken from product `p`. */ - def fromProduct(p: scala.Product): MirroredMonoType - } - - trait Singleton extends Product { - type MirroredMonoType = this.type - type MirroredType = this.type - type MirroredElemTypes = Unit - type MirroredElemLabels = Unit - def fromProduct(p: scala.Product) = this - } - - /** A proxy for Scala 2 singletons, which do not inherit `Singleton` directly */ - class SingletonProxy(val value: AnyRef) extends Product { - type MirroredMonoType = value.type - type MirroredType = value.type - type MirroredElemTypes = Unit - type MirroredElemLabels = Unit - def fromProduct(p: scala.Product) = value - } - - type Of[T] = Mirror { type MirroredType = T; type MirroredMonoType = T ; type MirroredElemTypes <: Tuple } - type ProductOf[T] = Mirror.Product { type MirroredType = T; type MirroredMonoType = T ; type MirroredElemTypes <: Tuple } - type SumOf[T] = Mirror.Sum { type MirroredType = T; type MirroredMonoType = T; type MirroredElemTypes <: Tuple } - } - - /** Helper class to turn arrays into products */ - class ArrayProduct(val elems: Array[AnyRef]) extends Product { - def this(size: Int) = this(new Array[AnyRef](size)) - def canEqual(that: Any): Boolean = true - def productElement(n: Int) = elems(n) - def productArity = elems.length - override def productIterator: Iterator[Any] = elems.iterator - def update(n: Int, x: Any) = elems(n) = x.asInstanceOf[AnyRef] - } - - /** The empty product */ - object EmptyProduct extends ArrayProduct(Array[AnyRef]()) - - /** Helper method to select a product element */ - def productElement[T](x: Any, idx: Int) = - x.asInstanceOf[Product].productElement(idx).asInstanceOf[T] -} -*/ diff --git a/library/src-2.x/scala/internal/Quoted.scala b/library/src-2.x/scala/internal/Quoted.scala deleted file mode 100644 index 8255b7463ab0..000000000000 --- a/library/src-2.x/scala/internal/Quoted.scala +++ /dev/null @@ -1,27 +0,0 @@ -package scala.internal - -import scala.annotation.Annotation -import scala.quoted._ - -object Quoted { - - /** A term quote is desugared by the compiler into a call to this method */ - def exprQuote[T](x: T): Expr[T] = - throw new Error("Internal error: this method call should have been replaced by the compiler") - - /** A term splice is desugared by the compiler into a call to this method */ - def exprSplice[T](x: Expr[T]): T = - throw new Error("Internal error: this method call should have been replaced by the compiler") - - /** A type quote is desugared by the compiler into a call to this method */ - def typeQuote[T/* <: AnyKind */]: Type[T] = - throw new Error("Internal error: this method call should have been replaced by the compiler") - - /** A splice in a quoted pattern is desugared by the compiler into a call to this method */ - def patternHole[T]: T = - throw new Error("Internal error: this method call should have been replaced by the compiler") - - /** A splice of a name in a quoted pattern is desugared by wrapping getting this annotation */ - class patternBindHole extends Annotation - -} diff --git a/library/src-2.x/scala/internal/quoted/Matcher.scala b/library/src-2.x/scala/internal/quoted/Matcher.scala deleted file mode 100644 index 1e80a2a69fdf..000000000000 --- a/library/src-2.x/scala/internal/quoted/Matcher.scala +++ /dev/null @@ -1,11 +0,0 @@ -package scala.internal.quoted - -import scala.quoted.Expr -import scala.tasty.Reflection - -object Matcher { - - def unapply[Tup <: Tuple](scrutineeExpr: Expr[_])(implicit patternExpr: Expr[_], reflection: Reflection): Option[Tup] = - throw new Exception("running on non bootstrapped library") - -} diff --git a/library/src-2.x/scala/quoted/Expr.scala b/library/src-2.x/scala/quoted/Expr.scala deleted file mode 100644 index ae026993939b..000000000000 --- a/library/src-2.x/scala/quoted/Expr.scala +++ /dev/null @@ -1,53 +0,0 @@ -package scala - -package quoted { - - sealed abstract class Expr[+T] { - - /** Evaluate the contents of this expression and return the result. - * - * May throw a FreeVariableError on expressions that came from a macro. - */ - @deprecated("Use scala.quoted.run", "") - final def run(implicit toolbox: Toolbox): T = toolbox.run(this) - - } - -} - -package internal { - package quoted { - - /** An Expr backed by a pickled TASTY tree */ - final class TastyExpr[+T](val tasty: scala.runtime.quoted.Unpickler.Pickled, val args: Seq[Any]) extends scala.quoted.Expr[T] { - override def toString: String = s"Expr()" - } - - /** An Expr backed by a lifted value. - * Values can only be of type Boolean, Byte, Short, Char, Int, Long, Float, Double, Unit, String or Null. - */ - final class LiftedExpr[+T](val value: T) extends scala.quoted.Expr[T] { - override def toString: String = s"Expr($value)" - } - - /** An Expr backed by a tree. Only the current compiler trees are allowed. - * - * These expressions are used for arguments of macros. They contain and actual tree - * from the program that is being expanded by the macro. - * - * May contain references to code defined outside this TastyTreeExpr instance. - */ - final class TastyTreeExpr[Tree](val tree: Tree) extends scala.quoted.Expr[Any] { - override def toString: String = s"Expr()" - } - - // TODO Use a List in FunctionAppliedTo(val f: Expr[_], val args: List[Expr[_]]) - // FIXME: Having the List in the code above trigers an assertion error while testing dotty.tools.dotc.reporting.ErrorMessagesTests.i3187 - // This test does redefine `scala.collection`. Further investigation is needed. - /** An Expr representing `'{($f).apply($x1, ..., $xn)}` but it is beta-reduced when the closure is known */ - final class FunctionAppliedTo[+R](val f: scala.quoted.Expr[_], val args: Array[scala.quoted.Expr[_]]) extends scala.quoted.Expr[R] { - override def toString: String = s"Expr($f ${args.toList})" - } - - } -} diff --git a/library/src-2.x/scala/quoted/Type.scala b/library/src-2.x/scala/quoted/Type.scala deleted file mode 100644 index d775652f2276..000000000000 --- a/library/src-2.x/scala/quoted/Type.scala +++ /dev/null @@ -1,52 +0,0 @@ -package scala - -package quoted { - import scala.internal.quoted.TaggedType - - sealed abstract class Type[T] { - type `$splice` = T - } - - /** Some basic type tags, currently incomplete */ - object Type { - - implicit class TypeOps[T](tpe: Type[T]) { - /** Show a source code like representation of this type */ - def show(implicit toolbox: Toolbox): String = toolbox.show(tpe.asInstanceOf[Type[Any]]) - } - - implicit def UnitTag: Type[Unit] = new scala.internal.quoted.TaggedType[Unit] - implicit def BooleanTag: Type[Boolean] = new scala.internal.quoted.TaggedType[Boolean] - implicit def ByteTag: Type[Byte] = new scala.internal.quoted.TaggedType[Byte] - implicit def CharTag: Type[Char] = new scala.internal.quoted.TaggedType[Char] - implicit def ShortTag: Type[Short] = new scala.internal.quoted.TaggedType[Short] - implicit def IntTag: Type[Int] = new scala.internal.quoted.TaggedType[Int] - implicit def LongTag: Type[Long] = new scala.internal.quoted.TaggedType[Long] - implicit def FloatTag: Type[Float] = new scala.internal.quoted.TaggedType[Float] - implicit def DoubleTag: Type[Double] = new scala.internal.quoted.TaggedType[Double] - } - -} - -package internal { - package quoted { - import scala.reflect.ClassTag - import scala.runtime.quoted.Unpickler.Pickled - - /** A Type backed by a pickled TASTY tree */ - final class TastyType[T](val tasty: Pickled, val args: Seq[Any]) extends scala.quoted.Type[T] { - override def toString(): String = s"Type()" - } - - /** An Type backed by a value */ - final class TaggedType[T](implicit val ct: ClassTag[T]) extends scala.quoted.Type[T] { - override def toString: String = s"Type($ct)" - } - - /** An Type backed by a tree */ - final class TreeType[Tree](val typeTree: Tree) extends scala.quoted.Type[Any] { - override def toString: String = s"Type()" - } - - } -} diff --git a/library/src-2.x/scala/quoted/matching/Bind.scala b/library/src-2.x/scala/quoted/matching/Bind.scala deleted file mode 100644 index 9a81ac587c95..000000000000 --- a/library/src-2.x/scala/quoted/matching/Bind.scala +++ /dev/null @@ -1,34 +0,0 @@ -package scala.quoted -package matching - -import scala.tasty.Reflection // TODO do not depend on reflection directly - -/** Bind of an Expr[T] used to know if some Expr[T] is a reference to the binding - * - * @param name string name of this binding - * @param id unique id used for equality - */ -class Bind[T /*<: AnyKind*/] private[scala](val name: String, private[Bind] val id: Object) { self => - - override def equals(obj: Any): Boolean = obj match { - case obj: Bind[_] => obj.id == id - case _ => false - } - - override def hashCode(): Int = id.hashCode() - -} - -object Bind { - - def unapply[T](expr: Expr[T])(implicit reflect: Reflection): Option[Bind[T]] = { - import reflect.{Bind => BindPattern, _} - expr.unseal match { - case IsIdent(ref) => - val sym = ref.symbol - Some(new Bind[T](sym.name, sym)) - case _ => None - } - } - -} diff --git a/library/src-2.x/scala/tasty/reflect/QuotedOps.scala b/library/src-2.x/scala/tasty/reflect/QuotedOps.scala deleted file mode 100644 index c3fa8502315d..000000000000 --- a/library/src-2.x/scala/tasty/reflect/QuotedOps.scala +++ /dev/null @@ -1,43 +0,0 @@ -package scala.tasty.reflect - -/** Extension methods on scala.quoted.{Expr|Type} to convert to scala.tasty.Tasty objects */ -trait QuotedOps extends Core { self: Printers => - - implicit class QuotedExprAPI[T](expr: scala.quoted.Expr[T]) { - /** View this expression `quoted.Expr[T]` as a `Term` */ - def unseal(implicit ctx: Context): Term = - kernel.QuotedExpr_unseal(expr) - - /** Checked cast to a `quoted.Expr[U]` */ - def cast[U: scala.quoted.Type](implicit ctx: Context): scala.quoted.Expr[U] = - kernel.QuotedExpr_cast[U](expr) - - /** Show a source code like representation of this expression. - * Will print Ansi colors if ctx.printColors is enabled. - */ - def show(implicit ctx: Context): String = unseal.show - } - - implicit class QuotedTypeAPI[T](tpe: scala.quoted.Type[T]) { - /** View this expression `quoted.Type[T]` as a `TypeTree` */ - def unseal(implicit ctx: Context): TypeTree = - kernel.QuotedType_unseal(tpe) - - /** Show a source code like representation of this type - * Will print Ansi colors if ctx.printColors is enabled. - */ - def show(implicit ctx: Context): String = unseal.show - } - - implicit class TermToQuotedAPI(term: Term) { - /** Convert `Term` to an `quoted.Expr[Any]` */ - def seal(implicit ctx: Context): scala.quoted.Expr[Any] = - kernel.QuotedExpr_seal(term) - } - - implicit class TypeToQuotedAPI(tpe: Type) { - /** Convert `Type` to an `quoted.Type[_]` */ - def seal(implicit ctx: Context): scala.quoted.Type[_] = - kernel.QuotedType_seal(tpe) - } -} diff --git a/library/src-2.x/scala/tasty/reflect/utils/TreeUtils.scala b/library/src-2.x/scala/tasty/reflect/utils/TreeUtils.scala deleted file mode 100644 index b1843b7c77fe..000000000000 --- a/library/src-2.x/scala/tasty/reflect/utils/TreeUtils.scala +++ /dev/null @@ -1,13 +0,0 @@ -package scala.tasty -package reflect.utils - -trait TreeUtils { - - val reflect: Reflection - import reflect._ - - /** Bind the `rhs` to a `val` and use it in `body` */ - def let(rhs: Term)(bodyType: Type)(body: Ident => Term): Term = - throw new Exception("non bootstrpped lib") - -} diff --git a/project/Build.scala b/project/Build.scala index 3722dcdac24a..277c57e2aef4 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -215,8 +215,6 @@ object Build { lazy val commonJavaSettings = commonSettings ++ Seq( version := dottyVersion, scalaVersion := referenceVersion, - // To be removed once we stop cross-compiling with Scala 2 - crossScalaVersions := Seq(referenceVersion, scalacVersion), // Do not append Scala versions to the generated artifacts crossPaths := false, // Do not depend on the Scala library @@ -234,8 +232,6 @@ object Build { lazy val commonNonBootstrappedSettings = commonDottySettings ++ Seq( version := dottyNonBootstrappedVersion, scalaVersion := referenceVersion, - // To be removed once we stop cross-compiling with Scala 2 - crossScalaVersions := Seq(referenceVersion, scalacVersion), excludeFromIDE := true )