diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index c422642879af..2cbccdd32e61 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -1379,11 +1379,11 @@ object Trees { // Ties the knot of the traversal: call `foldOver(x, tree))` to dive in the `tree` node. def apply(x: X, tree: Tree)(using Context): X - def apply(x: X, trees: List[Tree])(using Context): X = trees match - case tree :: rest => - apply(apply(x, tree), rest) - case Nil => - x + def apply(x: X, trees: List[Tree])(using Context): X = + def fold(x: X, trees: List[Tree]): X = trees match + case tree :: rest => fold(apply(x, tree), rest) + case Nil => x + fold(x, trees) def foldOver(x: X, tree: Tree)(using Context): X = if (tree.source != ctx.source && tree.source.exists) diff --git a/library/src-non-bootstrapped/scala/Enum.scala b/library/src-non-bootstrapped/scala/Enum.scala index 6b6c2f499ff1..ce21eb12cd08 100644 --- a/library/src-non-bootstrapped/scala/Enum.scala +++ b/library/src-non-bootstrapped/scala/Enum.scala @@ -5,4 +5,3 @@ trait Enum extends Product, Serializable: /** A number uniquely identifying a case of an enum */ def ordinal: Int - protected def $ordinal: Int diff --git a/library/src-non-bootstrapped/scala/implicits/Not.scala b/library/src-non-bootstrapped/scala/implicits/Not.scala deleted file mode 100644 index 5ad640bb9bd9..000000000000 --- a/library/src-non-bootstrapped/scala/implicits/Not.scala +++ /dev/null @@ -1,45 +0,0 @@ -package scala.implicits - -/** A special class used to implement negation in implicit search. - * - * Consider the problem of using implicit `i1` for a query type `D` if an implicit - * for some other class `C` is available, and using an implicit `i2` if no implicit - * value of type `C` is available. If we do not want to prioritize `i1` and `i2` by - * putting them in different traits we can instead define the following: - * - * given i1: D(using ev: C) = ... - * given i2: D(using ev: Not[C]) = ... - * - * `Not` is treated specially in implicit search, similar to the way logical negation - * is treated in Prolog: The implicit search for `Not[C]` succeeds if and only if the implicit - * search for `C` fails. - * - * In Scala 2 this form of negation can be simulated by setting up a conditional - * ambiguous implicit and an unconditional fallback, the way it is done with the - * `default`, `amb1` and `amb2` methods below. Due to the way these two methods are - * defined, `Not` is also usable from Scala 2. - * - * In Dotty, ambiguity is a global error, and therefore cannot be used to implement negation. - * Instead, `Not` is treated natively in implicit search. - */ -final class Not[+T] private () - -trait LowPriorityNot { - - /** A fallback method used to emulate negation in Scala 2 */ - given default[T] as Not[T] = Not.value -} -object Not extends LowPriorityNot { - - /** A value of type `Not` to signal a successful search for `Not[C]` (i.e. a failing - * search for `C`). A reference to this value will be explicitly constructed by Dotty's - * implicit search algorithm - */ - def value: Not[Nothing] = new Not[Nothing]() - - /** One of two ambiguous methods used to emulate negation in Scala 2 */ - given amb1[T](using ev: T) as Not[T] = ??? - - /** One of two ambiguous methods used to emulate negation in Scala 2 */ - given amb2[T](using ev: T) as Not[T] = ??? -} diff --git a/library/src-non-bootstrapped/scala/internal/quoted/CompileTime.scala b/library/src-non-bootstrapped/scala/internal/quoted/CompileTime.scala index 02c03da8d42a..ab08405edc05 100644 --- a/library/src-non-bootstrapped/scala/internal/quoted/CompileTime.scala +++ b/library/src-non-bootstrapped/scala/internal/quoted/CompileTime.scala @@ -15,21 +15,6 @@ object CompileTime { @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.exprNestedSplice`") def exprNestedSplice[T](ctx: QuoteContext)(x: ctx.Nested ?=> Expr[T]): T = ??? - @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.typeQuote`") - def typeQuote[T <: AnyKind]: Type[T] = ??? - - @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.patternHole`") - def patternHole[T]: T = ??? - - @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.patternBindHole`") - class patternBindHole extends Annotation - - @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.patternType`") - class patternType extends Annotation - - @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.fromAbove`") - class fromAbove extends Annotation - @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.quoteTypeTag`") class quoteTypeTag extends Annotation diff --git a/library/src-non-bootstrapped/scala/internal/quoted/Expr.scala b/library/src-non-bootstrapped/scala/internal/quoted/Expr.scala index 7d841156396d..ea2794e3e30d 100644 --- a/library/src-non-bootstrapped/scala/internal/quoted/Expr.scala +++ b/library/src-non-bootstrapped/scala/internal/quoted/Expr.scala @@ -33,4 +33,10 @@ object Expr { hasTypeSplices: Boolean, qctx: QuoteContext): Option[Tup] = throw new Exception("Non bootstrapped lib") + def `null`: QuoteContext ?=> quoted.Expr[Null] = + throw new Exception("Non bootstrapped lib") + + def Unit: QuoteContext ?=> quoted.Expr[Unit] = + throw new Exception("Non bootstrapped lib") + } diff --git a/library/src-non-bootstrapped/scala/quoted/Type.scala b/library/src-non-bootstrapped/scala/quoted/Type.scala index 01f8e917fa06..ff4135e5b2fa 100644 --- a/library/src-non-bootstrapped/scala/quoted/Type.scala +++ b/library/src-non-bootstrapped/scala/quoted/Type.scala @@ -1,5 +1,11 @@ package scala.quoted -abstract class Type[T <: AnyKind] private[scala]: - type `$splice` = T +import scala.annotation.compileTimeOnly + +abstract class Type[X <: AnyKind] private[scala]: + type T = X def unseal(using qctx: QuoteContext): qctx.tasty.TypeTree + +object Type: + @compileTimeOnly("Reference to `scala.quoted.Type.apply` was not handled by ReifyQuotes") + given apply[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ??? diff --git a/library/src-bootstrapped/scala/implicits/package.scala b/library/src/scala/implicits/package.scala similarity index 100% rename from library/src-bootstrapped/scala/implicits/package.scala rename to library/src/scala/implicits/package.scala diff --git a/library/src-bootstrapped/scala/util/Not.scala b/library/src/scala/util/Not.scala similarity index 100% rename from library/src-bootstrapped/scala/util/Not.scala rename to library/src/scala/util/Not.scala diff --git a/project/Build.scala b/project/Build.scala index a23eece75c75..6a40197cbb4f 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -62,7 +62,7 @@ object MyScalaJSPlugin extends AutoPlugin { } object Build { - val referenceVersion = "0.26.0-RC1" + val referenceVersion = "0.27.0-bin-20200819-6e6f67b-NIGHTLY" val baseVersion = "0.27.0" val baseSbtDottyVersion = "0.4.2"