diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index 30ecfea009d2..357d6a60b2be 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -683,7 +683,7 @@ class Definitions { def Unpickler_unpickleType = ctx.requiredMethod("scala.runtime.quoted.Unpickler.unpickleType") lazy val TastyTopLevelSpliceModule = ctx.requiredModule("scala.tasty.TopLevelSplice") - lazy val TastyTopLevelSplice_compilationTopLevelSplice = TastyTopLevelSpliceModule.requiredMethod("tastyContext") + lazy val TastyTopLevelSplice_tastyContext = TastyTopLevelSpliceModule.requiredMethod("tastyContext") lazy val EqType = ctx.requiredClassRef("scala.Eq") def EqClass(implicit ctx: Context) = EqType.symbol.asClass diff --git a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala index 76f9c4db865a..e70a2985f5ff 100644 --- a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala +++ b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala @@ -146,10 +146,10 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer { } /** We are in a `~(...)` context that is not shadowed by a nested `'(...)` */ - def inSplice = outer != null && !inQuote + def inSplice: Boolean = outer != null && !inQuote /** We are not in a `~(...)` or a `'(...)` */ - def isRoot = outer == null + def isRoot: Boolean = outer == null /** A map from type ref T to expressions of type `quoted.Type[T]`". * These will be turned into splices using `addTags` and represent type variables @@ -516,9 +516,9 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer { outer.enteredSyms.foreach(registerCapturer) if (ctx.owner.owner.is(Macro)) { - registerCapturer(defn.TastyTopLevelSplice_compilationTopLevelSplice) + registerCapturer(defn.TastyTopLevelSplice_tastyContext) // Force a macro to have the context in first position - forceCapture(defn.TastyTopLevelSplice_compilationTopLevelSplice) + forceCapture(defn.TastyTopLevelSplice_tastyContext) // Force all parameters of the macro to be created in the definition order outer.enteredSyms.reverse.foreach(forceCapture) } @@ -652,7 +652,7 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer { private def isStage0Value(sym: Symbol)(implicit ctx: Context): Boolean = (sym.is(Inline) && sym.owner.is(Macro) && !defn.isFunctionType(sym.info)) || - sym == defn.TastyTopLevelSplice_compilationTopLevelSplice // intrinsic value at stage 0 + sym == defn.TastyTopLevelSplice_tastyContext // intrinsic value at stage 0 private def liftList(list: List[Tree], tpe: Type)(implicit ctx: Context): Tree = { list.foldRight[Tree](ref(defn.NilModule)) { (x, acc) => diff --git a/compiler/src/dotty/tools/dotc/transform/Splicer.scala b/compiler/src/dotty/tools/dotc/transform/Splicer.scala index e12090a62fcd..98f8949bb2ad 100644 --- a/compiler/src/dotty/tools/dotc/transform/Splicer.scala +++ b/compiler/src/dotty/tools/dotc/transform/Splicer.scala @@ -92,7 +92,7 @@ object Splicer { s"""Failed to evaluate inlined quote. | Caused by ${ex.getClass}: ${if (ex.getMessage == null) "" else ex.getMessage} | ${ex.getStackTrace.takeWhile(_.getClassName != "dotty.tools.dotc.transform.Splicer$").init.mkString("\n ")} - """.stripMargin + """.stripMargin ctx.error(msg, pos) EmptyTree } diff --git a/library/src/scala/quoted/Type.scala b/library/src/scala/quoted/Type.scala index c340b3207e03..9eeed775ad69 100644 --- a/library/src/scala/quoted/Type.scala +++ b/library/src/scala/quoted/Type.scala @@ -31,7 +31,7 @@ object Type { object Types { /** A Type backed by a pickled TASTY tree */ final class TastyType[T](val tasty: Pickled, val args: Seq[Any]) extends Type[T] { - override def toString(): String = s"Type()" + override def toString(): String = s"Type()" } /** An Type backed by a value */ @@ -41,6 +41,6 @@ object Types { /** An Type backed by a tree */ final class TreeType[Tree](val typeTree: Tree) extends quoted.Type[Any] { - override def toString: String = s"Type()" + override def toString: String = s"Type()" } } diff --git a/tests/pos/quote-0.scala b/tests/pos/quote-0.scala index ae517ec575b2..ad413acba29a 100644 --- a/tests/pos/quote-0.scala +++ b/tests/pos/quote-0.scala @@ -2,11 +2,10 @@ import scala.quoted._ import dotty.tools.dotc.quoted.Toolbox._ - object Macros { inline def assert(expr: => Boolean): Unit = - ~ assertImpl('(expr)) + ~assertImpl('(expr)) def assertImpl(expr: Expr[Boolean]) = '{ if !(~expr) then throw new AssertionError(s"failed assertion: ${~showExpr(expr)}") } diff --git a/tests/run/tasty-custom-show/quoted_1.scala b/tests/run/tasty-custom-show/quoted_1.scala index 9da881da6666..59ee8806a5e5 100644 --- a/tests/run/tasty-custom-show/quoted_1.scala +++ b/tests/run/tasty-custom-show/quoted_1.scala @@ -1,5 +1,4 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ import scala.tasty.TopLevelSplice import scala.tasty.Tasty diff --git a/tests/run/tasty-extractors-1/quoted_1.scala b/tests/run/tasty-extractors-1/quoted_1.scala index 92d24faccb33..3bbf1d01924e 100644 --- a/tests/run/tasty-extractors-1/quoted_1.scala +++ b/tests/run/tasty-extractors-1/quoted_1.scala @@ -1,5 +1,4 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ import scala.tasty._ diff --git a/tests/run/tasty-extractors-2/quoted_1.scala b/tests/run/tasty-extractors-2/quoted_1.scala index ba196f206048..49d6c5493f40 100644 --- a/tests/run/tasty-extractors-2/quoted_1.scala +++ b/tests/run/tasty-extractors-2/quoted_1.scala @@ -1,5 +1,4 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ import scala.tasty._ diff --git a/tests/run/tasty-extractors-3/quoted_1.scala b/tests/run/tasty-extractors-3/quoted_1.scala index 26094c7a78c0..e49d7b603158 100644 --- a/tests/run/tasty-extractors-3/quoted_1.scala +++ b/tests/run/tasty-extractors-3/quoted_1.scala @@ -1,5 +1,4 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ import scala.tasty.TopLevelSplice import scala.tasty.Tasty diff --git a/tests/run/tasty-extractors-constants-1/quoted_1.scala b/tests/run/tasty-extractors-constants-1/quoted_1.scala index 803f39332d54..e26eee497303 100644 --- a/tests/run/tasty-extractors-constants-1/quoted_1.scala +++ b/tests/run/tasty-extractors-constants-1/quoted_1.scala @@ -1,5 +1,4 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ import scala.tasty._ import scala.tasty.util._ diff --git a/tests/run/tasty-extractors-owners/quoted_1.scala b/tests/run/tasty-extractors-owners/quoted_1.scala index 23fc9bf21e4c..5afeb121c448 100644 --- a/tests/run/tasty-extractors-owners/quoted_1.scala +++ b/tests/run/tasty-extractors-owners/quoted_1.scala @@ -1,5 +1,4 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ import scala.tasty._ import scala.tasty.util.TreeTraverser diff --git a/tests/run/tasty-extractors-types/quoted_1.scala b/tests/run/tasty-extractors-types/quoted_1.scala index f9af3e59be8e..3d8f4cfe553e 100644 --- a/tests/run/tasty-extractors-types/quoted_1.scala +++ b/tests/run/tasty-extractors-types/quoted_1.scala @@ -1,5 +1,4 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ import scala.tasty._ import scala.tasty.util.TreeTraverser diff --git a/tests/run/tasty-linenumber/quoted_1.scala b/tests/run/tasty-linenumber/quoted_1.scala index 5f73bb0f2910..01cb1e7efb5f 100644 --- a/tests/run/tasty-linenumber/quoted_1.scala +++ b/tests/run/tasty-linenumber/quoted_1.scala @@ -1,7 +1,5 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ - import scala.tasty._ class LineNumber(val value: Int) { diff --git a/tests/run/tasty-location/quoted_1.scala b/tests/run/tasty-location/quoted_1.scala index 4c61b34e1983..96bdc2439944 100644 --- a/tests/run/tasty-location/quoted_1.scala +++ b/tests/run/tasty-location/quoted_1.scala @@ -1,7 +1,5 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ - import scala.tasty._ case class Location(owners: List[String]) diff --git a/tests/run/tasty-positioned/quoted_1.scala b/tests/run/tasty-positioned/quoted_1.scala index 0e8af98b87af..b1536bc1fae2 100644 --- a/tests/run/tasty-positioned/quoted_1.scala +++ b/tests/run/tasty-positioned/quoted_1.scala @@ -1,7 +1,5 @@ import scala.quoted._ -import dotty.tools.dotc.quoted.Toolbox._ - import scala.tasty._ case class Position(path: String, start: Int, end: Int,