diff --git a/community-build/community-projects/sourcecode b/community-build/community-projects/sourcecode index f8a839871c02..b9bfe02c73a7 160000 --- a/community-build/community-projects/sourcecode +++ b/community-build/community-projects/sourcecode @@ -1 +1 @@ -Subproject commit f8a839871c02a7ef45afc4bfa6ed2688e7e67aa1 +Subproject commit b9bfe02c73a754bf1a63cf3ae993db2cb651883c diff --git a/compiler/src/dotty/tools/dotc/consumetasty/ConsumeTasty.scala b/compiler/src/dotty/tools/dotc/consumetasty/ConsumeTasty.scala index cd8946ea8cfe..58a495cf98f0 100644 --- a/compiler/src/dotty/tools/dotc/consumetasty/ConsumeTasty.scala +++ b/compiler/src/dotty/tools/dotc/consumetasty/ConsumeTasty.scala @@ -16,7 +16,7 @@ object ConsumeTasty { new TastyFromClass(tastyConsumer) } - val currentClasspath = QuoteDriver.currentClasspath + val currentClasspath = QuoteDriver.currentClasspath(getClass.getClassLoader) import java.io.File.{ pathSeparator => sep } val args = "-from-tasty" :: "-Yretain-trees" :: "-classpath" :: s"$classpath$sep$currentClasspath" :: classes (new Consume).process(args.toArray) diff --git a/compiler/src/dotty/tools/dotc/quoted/QuoteCompiler.scala b/compiler/src/dotty/tools/dotc/quoted/QuoteCompiler.scala index 7d2650c5e0a6..490b11f683ad 100644 --- a/compiler/src/dotty/tools/dotc/quoted/QuoteCompiler.scala +++ b/compiler/src/dotty/tools/dotc/quoted/QuoteCompiler.scala @@ -37,7 +37,7 @@ class QuoteCompiler extends Compiler { new ExprRun(this, ctx.addMode(Mode.ReadPositions)) } - def outputClassName: TypeName = "Quoted".toTypeName + def outputClassName: TypeName = "Generated$Code$From$Quoted".toTypeName /** Frontend that receives a scala.quoted.Expr or scala.quoted.Type as input */ class QuotedFrontend(putInClass: Boolean) extends Phase { diff --git a/compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala b/compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala index e3b5a98cc884..943386b031ba 100644 --- a/compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala +++ b/compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala @@ -11,7 +11,11 @@ import scala.quoted.{Expr, Type} import scala.quoted.Toolbox import java.net.URLClassLoader -class QuoteDriver extends Driver { +/** Driver to compile quoted code + * + * @param appClassloader classloader of the application that generated the quotes + */ +class QuoteDriver(appClassloader: ClassLoader) extends Driver { import tpd._ private[this] val contextBase: ContextBase = new ContextBase @@ -32,7 +36,9 @@ class QuoteDriver extends Driver { val driver = new QuoteCompiler driver.newRun(ctx).compileExpr(expr) - val classLoader = new AbstractFileClassLoader(outDir, this.getClass.getClassLoader) + assert(!ctx.reporter.hasErrors) + + val classLoader = new AbstractFileClassLoader(outDir, appClassloader) val clazz = classLoader.loadClass(driver.outputClassName.toString) val method = clazz.getMethod("apply") @@ -82,7 +88,7 @@ class QuoteDriver extends Driver { override def initCtx: Context = { val ictx = contextBase.initialCtx - ictx.settings.classpath.update(QuoteDriver.currentClasspath)(ictx) + ictx.settings.classpath.update(QuoteDriver.currentClasspath(appClassloader))(ictx) ictx } @@ -94,9 +100,9 @@ class QuoteDriver extends Driver { object QuoteDriver { - def currentClasspath: String = { + def currentClasspath(cl: ClassLoader): String = { val classpath0 = System.getProperty("java.class.path") - this.getClass.getClassLoader match { + cl match { case cl: URLClassLoader => // Loads the classes loaded by this class loader // When executing `run` or `test` in sbt the classpath is not in the property java.class.path diff --git a/compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala b/compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala index 3e48fd0bd649..77a1e26b8db1 100644 --- a/compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala +++ b/compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala @@ -9,9 +9,15 @@ import scala.quoted.Exprs.{LiftedExpr, TastyTreeExpr} object ToolboxImpl { import tpd._ - def make(settings: scala.quoted.Toolbox.Settings): scala.quoted.Toolbox = new scala.quoted.Toolbox { + /** Create a new instance of the toolbox using the the classloader of the application. + * + * @param appClassloader classloader of the application that generated the quotes + * @param settings toolbox settings + * @return A new instance of the toolbox + */ + def make(settings: scala.quoted.Toolbox.Settings, appClassloader: ClassLoader): scala.quoted.Toolbox = new scala.quoted.Toolbox { - private[this] val driver: QuoteDriver = new QuoteDriver() + private[this] val driver: QuoteDriver = new QuoteDriver(appClassloader) def run[T](expr: Expr[T]): T = expr match { case expr: LiftedExpr[T] => @@ -26,4 +32,5 @@ object ToolboxImpl { def show[T](tpe: Type[T]): String = synchronized(driver.show(tpe, settings)) } + } diff --git a/compiler/test-resources/repl/i6007 b/compiler/test-resources/repl/i6007 new file mode 100644 index 000000000000..cea674769f88 --- /dev/null +++ b/compiler/test-resources/repl/i6007 @@ -0,0 +1,8 @@ +scala> implicit def toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) +def toolbox: quoted.Toolbox +scala> val v = '{ (if true then Some(1) else None).map(v => v+1) } +val v: quoted.Expr[Option[Int]] = Expr() +scala> v.show +val res0: String = (if (true) scala.Some.apply[scala.Int](1) else scala.None).map[scala.Int](((v: scala.Int) => v.+(1))) +scala> v.run +val res1: Option[Int] = Some(2) diff --git a/library/src/scala/quoted/Toolbox.scala b/library/src/scala/quoted/Toolbox.scala index b57fee97dad7..ee834bdf236c 100644 --- a/library/src/scala/quoted/Toolbox.scala +++ b/library/src/scala/quoted/Toolbox.scala @@ -2,7 +2,7 @@ package scala.quoted import scala.annotation.implicitNotFound -@implicitNotFound("Could not find implicit quoted.Toolbox.\n\nDefault toolbox can be instantiated with:\n `implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make`\n\nIf only needed once it can also be imported with:\n `import scala.quoted.Toolbox.Default._`") +@implicitNotFound("Could not find implicit quoted.Toolbox.\n\nDefault toolbox can be instantiated with:\n `implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader)`\n\n") trait Toolbox { def run[T](expr: Expr[T]): T def show[T](expr: Expr[T]): String @@ -11,17 +11,22 @@ trait Toolbox { object Toolbox { - object Default { - // TODO remove? It may be better to only have one way to instantiate the toolbox - implicit def make(implicit settings: Settings): Toolbox = Toolbox.make - } - - def make(implicit settings: Settings): Toolbox = { - val cl = getClass.getClassLoader + /** Create a new instance of the toolbox using the the classloader of the application. + * + * Usuage: + * ``` + * implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + * ``` + * + * @param appClassloader classloader of the application that generated the quotes + * @param settings toolbox settings + * @return A new instance of the toolbox + */ + def make(appClassloader: ClassLoader)(implicit settings: Settings): Toolbox = { try { - val toolboxImplCls = cl.loadClass("dotty.tools.dotc.quoted.ToolboxImpl") - val makeMeth = toolboxImplCls.getMethod("make", classOf[Settings]) - makeMeth.invoke(null, settings).asInstanceOf[Toolbox] + val toolboxImplCls = appClassloader.loadClass("dotty.tools.dotc.quoted.ToolboxImpl") + val makeMeth = toolboxImplCls.getMethod("make", classOf[Settings], classOf[ClassLoader]) + makeMeth.invoke(null, settings, appClassloader).asInstanceOf[Toolbox] } catch { case ex: ClassNotFoundException => diff --git a/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/build.sbt b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/build.sbt new file mode 100644 index 000000000000..cbef99eb41ac --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/build.sbt @@ -0,0 +1,7 @@ +scalaVersion := sys.props("plugin.scalaVersion") + +libraryDependencies ++= Seq( + "ch.epfl.lamp" % "dotty_0.14" % scalaVersion.value, + "ch.epfl.lamp" % "dotty_0.14" % scalaVersion.value % "test->runtime", + "com.novocode" % "junit-interface" % "0.11" % "test" + ) \ No newline at end of file diff --git a/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/project/plugins.sbt b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/project/plugins.sbt new file mode 100644 index 000000000000..c17caab2d98c --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version")) diff --git a/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/src/main/scala/hello/Hello.scala b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/src/main/scala/hello/Hello.scala new file mode 100644 index 000000000000..468d0adac1ca --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/src/main/scala/hello/Hello.scala @@ -0,0 +1,51 @@ +package hello + +// Import Expr and some extension methods +import scala.quoted._ + +object Main { + + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + + def main(args: Array[String]): Unit = { + + val square = stagedPower(2) + + assert(Math.pow(3, 2) == square(3)) + + square(3) + square(4) + + assert(Math.pow(4, 2) == square(4)) + + val cube = stagedPower(3) + cube(2) + + + assert(Math.pow(2, 3) == cube(2)) + + + + val toTheFourth = stagedPower(4) + assert(Math.pow(3, 4) == toTheFourth(3)) + } + + def stagedPower(n: Int): Double => Double = { + // Code representing the labmda where the recursion is unrolled based on the value of n + val code = '{ (x: Double) => ${powerCode(n, '{x})}} + + code.show + + // Evaluate the contents of the code and return it's value + code.run + } + + def powerCode(n: Int, x: Expr[Double]): Expr[Double] = + if (n == 0) '{1.0} + else if (n == 1) x + else if (n < 0) throw new Exception("Negative powers not implemented. Left as a small exercise. Dont be shy, try it out.") + else if (n == 2) '{$x * $x} + else if (n % 2 == 1) '{$x * ${powerCode(n - 1, x)}} + else '{ val y = $x * $x; ${powerCode(n / 2, '{y})}} + +} \ No newline at end of file diff --git a/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/test b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/test new file mode 100644 index 000000000000..62ea636c177f --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/test @@ -0,0 +1 @@ +> run diff --git a/tests/neg-with-compiler/i5941/macro_1.scala b/tests/neg-with-compiler/i5941/macro_1.scala index 3fa934ff4e9a..a5d59254b973 100644 --- a/tests/neg-with-compiler/i5941/macro_1.scala +++ b/tests/neg-with-compiler/i5941/macro_1.scala @@ -13,10 +13,9 @@ object Lens { } def impl[S: Type, T: Type](getter: Expr[S => T])(implicit refl: Reflection): Expr[Lens[S, T]] = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader) import refl._ import util._ - import quoted.Toolbox.Default._ - // obj.copy(field = value) def setterBody(obj: Expr[S], value: Expr[T], field: String): Expr[S] = Select.overloaded(obj.unseal, "copy", Nil, NamedArg(field, value.unseal) :: Nil).seal.cast[S] diff --git a/tests/neg-with-compiler/quote-run-in-macro-1/quoted_1.scala b/tests/neg-with-compiler/quote-run-in-macro-1/quoted_1.scala index b0a5929a89b7..27590f387487 100644 --- a/tests/neg-with-compiler/quote-run-in-macro-1/quoted_1.scala +++ b/tests/neg-with-compiler/quote-run-in-macro-1/quoted_1.scala @@ -1,9 +1,9 @@ import scala.quoted._ import scala.quoted.autolift._ -import scala.quoted.Toolbox.Default._ - object Macros { + + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) inline def foo(i: => Int): Int = ${ fooImpl('i) } def fooImpl(i: Expr[Int]): Expr[Int] = { val y: Int = i.run diff --git a/tests/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala b/tests/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala index 1b01a25c6ba7..1f1f38ec20a1 100644 --- a/tests/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala +++ b/tests/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala @@ -1,10 +1,11 @@ import scala.quoted._ import scala.quoted.autolift._ -import scala.quoted.Toolbox.Default._ object Macros { + inline def foo(i: => Int): Int = ${ fooImpl('i) } def fooImpl(i: Expr[Int]): Expr[Int] = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val y: Int = i.run y } diff --git a/tests/neg/tasty-string-interpolator-position-a/Macro_1.scala b/tests/neg/tasty-string-interpolator-position-a/Macro_1.scala index 769d29069f8a..67be3d130aea 100644 --- a/tests/neg/tasty-string-interpolator-position-a/Macro_1.scala +++ b/tests/neg/tasty-string-interpolator-position-a/Macro_1.scala @@ -2,7 +2,6 @@ import scala.quoted._ import scala.tasty.Reflection import scala.language.implicitConversions import scala.quoted.Exprs.LiftedExpr -import scala.quoted.Toolbox.Default._ object Macro { diff --git a/tests/neg/tasty-string-interpolator-position-b/Macro_1.scala b/tests/neg/tasty-string-interpolator-position-b/Macro_1.scala index d4d2466c5168..83f2eb139136 100644 --- a/tests/neg/tasty-string-interpolator-position-b/Macro_1.scala +++ b/tests/neg/tasty-string-interpolator-position-b/Macro_1.scala @@ -2,7 +2,6 @@ import scala.quoted._ import scala.tasty.Reflection import scala.language.implicitConversions import scala.quoted.Exprs.LiftedExpr -import scala.quoted.Toolbox.Default._ object Macro { @@ -11,7 +10,7 @@ object Macro { } object FIntepolator { - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(implicit reflect: Reflection): Expr[String] = { import reflect._ error("there are no args", argsExpr.unseal.underlyingArgument.pos) diff --git a/tests/pos-with-compiler/quote-0.scala b/tests/pos-with-compiler/quote-0.scala index 6b41d10695ef..c0d931d5ee3b 100644 --- a/tests/pos-with-compiler/quote-0.scala +++ b/tests/pos-with-compiler/quote-0.scala @@ -1,8 +1,6 @@ import scala.quoted._ import scala.quoted.autolift._ -import scala.quoted.Toolbox.Default._ - object Macros { @@ -41,5 +39,6 @@ class Test { ${ powerCode(3, '{math.sqrt(2.0)}) } } + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) program.run } diff --git a/tests/pos-with-compiler/quote-assert/quoted_2.scala b/tests/pos-with-compiler/quote-assert/quoted_2.scala index 50d835cace3f..f1db5a7e9b2c 100644 --- a/tests/pos-with-compiler/quote-assert/quoted_2.scala +++ b/tests/pos-with-compiler/quote-assert/quoted_2.scala @@ -1,4 +1,4 @@ -import scala.quoted.Toolbox.Default._ + import scala.quoted._ import Macros._ @@ -15,5 +15,6 @@ object Test { ${ assertImpl('{x != 0}) } } + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) program.run } diff --git a/tests/run-with-compiler-custom-args/staged-streams_1.scala b/tests/run-with-compiler-custom-args/staged-streams_1.scala index dcfc56aa3122..5e0ebc8c4931 100644 --- a/tests/run-with-compiler-custom-args/staged-streams_1.scala +++ b/tests/run-with-compiler-custom-args/staged-streams_1.scala @@ -677,8 +677,7 @@ object Test { .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println(test1().run) println println(test2().run) diff --git a/tests/run-with-compiler/i3823-b.scala b/tests/run-with-compiler/i3823-b.scala index 75e35d6ca619..958ef94e1b56 100644 --- a/tests/run-with-compiler/i3823-b.scala +++ b/tests/run-with-compiler/i3823-b.scala @@ -1,10 +1,10 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { def f[T](x: Expr[T])(implicit t: Type[T]) = '{ val z: $t = $x } + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println(f('{2})(Type.IntTag).show) } } \ No newline at end of file diff --git a/tests/run-with-compiler/i3823-c.scala b/tests/run-with-compiler/i3823-c.scala index bccae95b5278..3efe37610519 100644 --- a/tests/run-with-compiler/i3823-c.scala +++ b/tests/run-with-compiler/i3823-c.scala @@ -1,10 +1,10 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { def f[T](x: Expr[T])(implicit t: Type[T]) = '{ val z = $x } + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println(f('{2})(Type.IntTag).show) } } diff --git a/tests/run-with-compiler/i3823.scala b/tests/run-with-compiler/i3823.scala index ad43cc70e6d5..3e207e307d42 100644 --- a/tests/run-with-compiler/i3823.scala +++ b/tests/run-with-compiler/i3823.scala @@ -1,10 +1,10 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { def f[T: Type](x: Expr[T])(t: Type[T]) = '{ val z: $t = $x } + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println(f('{2})('[Int]).show) } } \ No newline at end of file diff --git a/tests/run-with-compiler/i3847-b.scala b/tests/run-with-compiler/i3847-b.scala index dd7cb855caca..3c76fb547c15 100644 --- a/tests/run-with-compiler/i3847-b.scala +++ b/tests/run-with-compiler/i3847-b.scala @@ -1,4 +1,3 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ import scala.reflect.ClassTag @@ -15,6 +14,7 @@ object Arrays { object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) import Arrays._ implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int} val arr: Expr[Array[List[Int]]] = Array[List[Int]](List(1, 2, 3)).toExpr diff --git a/tests/run-with-compiler/i3847.scala b/tests/run-with-compiler/i3847.scala index 02be34330a9b..a8b071cc7bdb 100644 --- a/tests/run-with-compiler/i3847.scala +++ b/tests/run-with-compiler/i3847.scala @@ -1,4 +1,3 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ import scala.reflect.ClassTag @@ -15,6 +14,7 @@ object Arrays { object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader) import Arrays._ implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int} val arr: Expr[Array[Int]] = Array[Int](1, 2, 3).toExpr diff --git a/tests/run-with-compiler/i3876-b.scala b/tests/run-with-compiler/i3876-b.scala index c252c9d84dfa..b4eda5c9c3a4 100644 --- a/tests/run-with-compiler/i3876-b.scala +++ b/tests/run-with-compiler/i3876-b.scala @@ -1,8 +1,7 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val x: Expr[Int] = '{3} diff --git a/tests/run-with-compiler/i3876-c.scala b/tests/run-with-compiler/i3876-c.scala index 061bf3a985f4..519f8f625892 100644 --- a/tests/run-with-compiler/i3876-c.scala +++ b/tests/run-with-compiler/i3876-c.scala @@ -1,8 +1,7 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val x: Expr[Int] = '{3} diff --git a/tests/run-with-compiler/i3876-d.scala b/tests/run-with-compiler/i3876-d.scala index 7629b6a5c349..24075b701f3f 100644 --- a/tests/run-with-compiler/i3876-d.scala +++ b/tests/run-with-compiler/i3876-d.scala @@ -1,8 +1,7 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val x: Expr[Int] = '{3} diff --git a/tests/run-with-compiler/i3876.scala b/tests/run-with-compiler/i3876.scala index 3f1d5363c718..418bdee7d3f2 100644 --- a/tests/run-with-compiler/i3876.scala +++ b/tests/run-with-compiler/i3876.scala @@ -1,8 +1,7 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val x: Expr[Int] = '{3} diff --git a/tests/run-with-compiler/i3946.scala b/tests/run-with-compiler/i3946.scala index 12e129884a3d..84c31b7b6789 100644 --- a/tests/run-with-compiler/i3946.scala +++ b/tests/run-with-compiler/i3946.scala @@ -1,9 +1,7 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val u: Expr[Unit] = '{} println(u.show) println(u.run) diff --git a/tests/run-with-compiler/i3947.scala b/tests/run-with-compiler/i3947.scala index 45d3971f90b8..5ec35a804fe1 100644 --- a/tests/run-with-compiler/i3947.scala +++ b/tests/run-with-compiler/i3947.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947b.scala b/tests/run-with-compiler/i3947b.scala index 4b4460daf5d4..b623b8f9fc16 100644 --- a/tests/run-with-compiler/i3947b.scala +++ b/tests/run-with-compiler/i3947b.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947b2.scala b/tests/run-with-compiler/i3947b2.scala index 8007f5607f9f..b10a46d97301 100644 --- a/tests/run-with-compiler/i3947b2.scala +++ b/tests/run-with-compiler/i3947b2.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947b3.scala b/tests/run-with-compiler/i3947b3.scala index 4ba6643491d3..15d33d9ae4d2 100644 --- a/tests/run-with-compiler/i3947b3.scala +++ b/tests/run-with-compiler/i3947b3.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947c.scala b/tests/run-with-compiler/i3947c.scala index 1fed62b8832f..1642692145bf 100644 --- a/tests/run-with-compiler/i3947c.scala +++ b/tests/run-with-compiler/i3947c.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947d.scala b/tests/run-with-compiler/i3947d.scala index fa73e2bd217e..11baf2773417 100644 --- a/tests/run-with-compiler/i3947d.scala +++ b/tests/run-with-compiler/i3947d.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947d2.scala b/tests/run-with-compiler/i3947d2.scala index f86a52ad9a37..2969ded0e436 100644 --- a/tests/run-with-compiler/i3947d2.scala +++ b/tests/run-with-compiler/i3947d2.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947e.scala b/tests/run-with-compiler/i3947e.scala index 25f41fe0789a..b0d0706cca30 100644 --- a/tests/run-with-compiler/i3947e.scala +++ b/tests/run-with-compiler/i3947e.scala @@ -1,11 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr diff --git a/tests/run-with-compiler/i3947f.scala b/tests/run-with-compiler/i3947f.scala index 6d1c6239759e..d74159272676 100644 --- a/tests/run-with-compiler/i3947f.scala +++ b/tests/run-with-compiler/i3947f.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947g.scala b/tests/run-with-compiler/i3947g.scala index 0d1fa78978f2..6d9e1ec0524c 100644 --- a/tests/run-with-compiler/i3947g.scala +++ b/tests/run-with-compiler/i3947g.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947i.scala b/tests/run-with-compiler/i3947i.scala index 3c0918392cd1..6f3241ae6be0 100644 --- a/tests/run-with-compiler/i3947i.scala +++ b/tests/run-with-compiler/i3947i.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i3947j.scala b/tests/run-with-compiler/i3947j.scala index c9c2b1dcf6d4..2d14db5bf052 100644 --- a/tests/run-with-compiler/i3947j.scala +++ b/tests/run-with-compiler/i3947j.scala @@ -1,12 +1,10 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def test[T: Type](clazz: java.lang.Class[T]): Unit = { val lclazz = clazz.toExpr val name = '{ ($lclazz).getCanonicalName } diff --git a/tests/run-with-compiler/i4044a.scala b/tests/run-with-compiler/i4044a.scala index e8ff3d67979e..30886ca3dfc7 100644 --- a/tests/run-with-compiler/i4044a.scala +++ b/tests/run-with-compiler/i4044a.scala @@ -1,8 +1,8 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ class Foo { def foo: Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val e: Expr[Int] = '{3} val q = '{ ${ '{ $e } } } println(q.show) diff --git a/tests/run-with-compiler/i4044b.scala b/tests/run-with-compiler/i4044b.scala index e9e474a73934..b70f9882cee1 100644 --- a/tests/run-with-compiler/i4044b.scala +++ b/tests/run-with-compiler/i4044b.scala @@ -1,7 +1,5 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ - sealed abstract class VarRef[T] { def update(expr: Expr[T]): Expr[Unit] def expr: Expr[T] @@ -22,6 +20,7 @@ object VarRef { object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val q = VarRef('{4})(varRef => '{ ${varRef.update('{3})}; ${varRef.expr} }) println(q.show) } diff --git a/tests/run-with-compiler/i4044c.scala b/tests/run-with-compiler/i4044c.scala index 5a38da369e6a..558ec2d1b045 100644 --- a/tests/run-with-compiler/i4044c.scala +++ b/tests/run-with-compiler/i4044c.scala @@ -1,8 +1,8 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ class Foo { def foo: Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val q = '{ ${ '{ ${ '{ 5 } } } } } println(q.show) } diff --git a/tests/run-with-compiler/i4044d.scala b/tests/run-with-compiler/i4044d.scala index 05e177a80f89..512448e49f8d 100644 --- a/tests/run-with-compiler/i4044d.scala +++ b/tests/run-with-compiler/i4044d.scala @@ -1,8 +1,8 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ class Foo { def foo: Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val a: Expr[Int] = '{3} val q: Expr[Int] = '{ val b = 3 diff --git a/tests/run-with-compiler/i4044e.scala b/tests/run-with-compiler/i4044e.scala index 05c82bed26ba..bef7315f5e81 100644 --- a/tests/run-with-compiler/i4044e.scala +++ b/tests/run-with-compiler/i4044e.scala @@ -1,8 +1,8 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ class Foo { def foo: Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val e: Expr[Int] = '{3} val f: Expr[Int] = '{5} val t: Type[Int] = '[Int] diff --git a/tests/run-with-compiler/i4044f.scala b/tests/run-with-compiler/i4044f.scala index 2b63f6d2bd12..bad5c8859a3b 100644 --- a/tests/run-with-compiler/i4044f.scala +++ b/tests/run-with-compiler/i4044f.scala @@ -1,8 +1,8 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ class Foo { def foo: Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val e: Expr[Int] = '{3} val f: Expr[Int] = '{5} def foo(x: Expr[Int], y: Expr[Int]): Expr[Int] = '{ $x + $y } diff --git a/tests/run-with-compiler/i4350.scala b/tests/run-with-compiler/i4350.scala index 1521e1b301ae..c1be9e8570dd 100644 --- a/tests/run-with-compiler/i4350.scala +++ b/tests/run-with-compiler/i4350.scala @@ -1,4 +1,3 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted.Type @@ -8,7 +7,7 @@ class Foo[T: Type] { object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println((new Foo[Object]).q.show) println((new Foo[String]).q.show) } diff --git a/tests/run-with-compiler/i4591.scala b/tests/run-with-compiler/i4591.scala index 6ae5ac944dac..c862e316c96f 100644 --- a/tests/run-with-compiler/i4591.scala +++ b/tests/run-with-compiler/i4591.scala @@ -1,4 +1,3 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ object Test { @@ -9,6 +8,7 @@ object Test { } def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) foo('{Option(9)}).run } diff --git a/tests/run-with-compiler/i5144.scala b/tests/run-with-compiler/i5144.scala index 316e7c6ca055..6f124d2402f9 100644 --- a/tests/run-with-compiler/i5144.scala +++ b/tests/run-with-compiler/i5144.scala @@ -1,8 +1,7 @@ import scala.quoted._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def eval1(ff: Expr[Int => Int]): Expr[Int] = '{$ff(42)} def peval1(): Expr[Unit] = '{ diff --git a/tests/run-with-compiler/i5144b.scala b/tests/run-with-compiler/i5144b.scala index 1ba60137ebd1..ebbc72e5780e 100644 --- a/tests/run-with-compiler/i5144b.scala +++ b/tests/run-with-compiler/i5144b.scala @@ -1,8 +1,7 @@ import scala.quoted._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def eval1(ff: Expr[Int => Int]): Expr[Int] = ff('{42}) def peval1(): Expr[Unit] = '{ diff --git a/tests/run-with-compiler/i5152.scala b/tests/run-with-compiler/i5152.scala index 218ffff8e2ab..be9532ed2c43 100644 --- a/tests/run-with-compiler/i5152.scala +++ b/tests/run-with-compiler/i5152.scala @@ -1,8 +1,7 @@ import scala.quoted._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def eval1(ff: Expr[Int => Int]): Expr[Int => Int] = '{identity} def peval1(): Expr[Unit] = '{ diff --git a/tests/run-with-compiler/i5247.scala b/tests/run-with-compiler/i5247.scala index 38e04d42aa12..1fb8793d6822 100644 --- a/tests/run-with-compiler/i5247.scala +++ b/tests/run-with-compiler/i5247.scala @@ -1,7 +1,7 @@ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println(foo[Object].show) println(bar[Object].show) } diff --git a/tests/run-with-compiler/i5941/macro_1.scala b/tests/run-with-compiler/i5941/macro_1.scala index 4bb15fa25057..f2069d1bff89 100644 --- a/tests/run-with-compiler/i5941/macro_1.scala +++ b/tests/run-with-compiler/i5941/macro_1.scala @@ -15,8 +15,6 @@ object Lens { def impl[S: Type, T: Type](getter: Expr[S => T])(implicit refl: Reflection): Expr[Lens[S, T]] = { import refl._ import util._ - import quoted.Toolbox.Default._ - // obj.copy(a = obj.a.copy(b = a.b.copy(c = v))) def setterBody(obj: Term, value: Term, parts: List[String]): Term = { @@ -95,7 +93,6 @@ object Iso { def impl[S: Type, A: Type](implicit refl: Reflection): Expr[Iso[S, A]] = { import refl._ import util._ - import quoted.Toolbox.Default._ val tpS = typeOf[S] val tpA = typeOf[A] @@ -132,7 +129,6 @@ object Iso { def implUnit[S: Type](implicit refl: Reflection): Expr[Iso[S, 1]] = { import refl._ import util._ - import quoted.Toolbox.Default._ val tpS = typeOf[S] diff --git a/tests/run-with-compiler/i5965.scala b/tests/run-with-compiler/i5965.scala index 7ca1e74aabb4..f1bbb3c6ab05 100644 --- a/tests/run-with-compiler/i5965.scala +++ b/tests/run-with-compiler/i5965.scala @@ -4,8 +4,7 @@ import scala.tasty._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { '[List] val list = bound('{List(1, 2, 3)}) diff --git a/tests/run-with-compiler/i5965b.scala b/tests/run-with-compiler/i5965b.scala index 992fa029c6b7..e9f260958d1b 100644 --- a/tests/run-with-compiler/i5965b.scala +++ b/tests/run-with-compiler/i5965b.scala @@ -4,9 +4,9 @@ import scala.tasty._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + '[List] val list = bound('{List(1, 2, 3)}) println(list.show) diff --git a/tests/run-with-compiler/i5997.scala b/tests/run-with-compiler/i5997.scala index 01d8a70aa47a..84bb27d0e2d5 100644 --- a/tests/run-with-compiler/i5997.scala +++ b/tests/run-with-compiler/i5997.scala @@ -1,6 +1,6 @@ object Test { def main(args: Array[String]): Unit = { - import quoted.Toolbox.Default._ + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val v = '{ (if true then Some(1) else None).map(v => v+1) } println(v.show) } diff --git a/tests/run-with-compiler/i6171/Macro_1.scala b/tests/run-with-compiler/i6171/Macro_1.scala index 1208d6cc767c..1d83825d0f4e 100644 --- a/tests/run-with-compiler/i6171/Macro_1.scala +++ b/tests/run-with-compiler/i6171/Macro_1.scala @@ -8,7 +8,6 @@ object scalatest { def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] = { import refl._ import util._ - import quoted.Toolbox.Default._ def isImplicitMethodType(tp: Type): Boolean = Type.IsMethodType.unapply(tp).flatMap(tp => if tp.isImplicit then Some(true) else None).nonEmpty diff --git a/tests/run-with-compiler/quote-ackermann-1.scala b/tests/run-with-compiler/quote-ackermann-1.scala index e22d07173014..3e9b4c281d01 100644 --- a/tests/run-with-compiler/quote-ackermann-1.scala +++ b/tests/run-with-compiler/quote-ackermann-1.scala @@ -1,10 +1,9 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ - object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val ack3 = ackermann(3).run println(ack3(1)) println(ack3(2)) diff --git a/tests/run-with-compiler/quote-fun-app-1.scala b/tests/run-with-compiler/quote-fun-app-1.scala index 890de0d14987..d99b03cc578a 100644 --- a/tests/run-with-compiler/quote-fun-app-1.scala +++ b/tests/run-with-compiler/quote-fun-app-1.scala @@ -1,10 +1,9 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ - object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val f = f1.run println(f(42)) println(f(43)) diff --git a/tests/run-with-compiler/quote-function-applied-to.scala b/tests/run-with-compiler/quote-function-applied-to.scala index fa381cea8eff..daa9b8f308ee 100644 --- a/tests/run-with-compiler/quote-function-applied-to.scala +++ b/tests/run-with-compiler/quote-function-applied-to.scala @@ -1,8 +1,8 @@ import quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println(('{ () => x(0) }).apply().show) println(('{ (x1: Int) => x1 }).apply('{x(1)}).show) println(('{ (x1: Int, x2: Int) => x1 + x2 }).apply('{x(1)}, '{x(2)}).show) diff --git a/tests/run-with-compiler/quote-impure-by-name/quoted_1.scala b/tests/run-with-compiler/quote-impure-by-name/quoted_1.scala index 21f726abfae1..1b89b45714b4 100644 --- a/tests/run-with-compiler/quote-impure-by-name/quoted_1.scala +++ b/tests/run-with-compiler/quote-impure-by-name/quoted_1.scala @@ -1,8 +1,6 @@ import scala.quoted._ import scala.quoted.autolift._ -import scala.quoted.Toolbox.Default._ - class Index[K, Keys](val index: String) extends AnyVal { override def toString: String = index } @@ -13,7 +11,8 @@ object Index { implicit inline def succ[K, H, T](implicit prev: => Index[K, T]): Index[K, (H, T)] = ${ succImpl('prev)('[K], '[H], '[T]) } def succImpl[K, H, T](prev: Expr[Index[K, T]])(implicit k: Type[K], h: Type[H], t: Type[T]): Expr[Index[K, (H, T)]] = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val value = s"1 + {${prev.show}}" '{new Index(${value})} } -} \ No newline at end of file +} diff --git a/tests/run-with-compiler/quote-inline-function/quoted_1.scala b/tests/run-with-compiler/quote-inline-function/quoted_1.scala index 7871b2348f78..eb9b712dfe21 100644 --- a/tests/run-with-compiler/quote-inline-function/quoted_1.scala +++ b/tests/run-with-compiler/quote-inline-function/quoted_1.scala @@ -1,14 +1,13 @@ import scala.quoted._ import scala.quoted.autolift._ -import scala.quoted.Toolbox.Default._ - object Macros { inline def foreach1(start: Int, end: Int, f: Int => Unit): String = ${impl('start, 'end, 'f)} inline def foreach2(start: Int, end: Int, f: => Int => Unit): String = ${impl('start, 'end, 'f)} def impl(start: Expr[Int], end: Expr[Int], f: Expr[Int => Unit]): Expr[String] = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val res = '{ var i = $start val j = $end diff --git a/tests/run-with-compiler/quote-lib.scala b/tests/run-with-compiler/quote-lib.scala index 3df0d3f94b29..0db100f12028 100644 --- a/tests/run-with-compiler/quote-lib.scala +++ b/tests/run-with-compiler/quote-lib.scala @@ -1,6 +1,5 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ import scala.quoted.autolift._ import liftable.Units._ @@ -12,8 +11,7 @@ import liftable.Exprs._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val liftedUnit: Expr[Unit] = '{} letVal('{1})(a => '{ $a + 1 }).show diff --git a/tests/run-with-compiler/quote-macro-in-splice/quoted_2.scala b/tests/run-with-compiler/quote-macro-in-splice/quoted_2.scala index 9958f623c754..e2625c0a9388 100644 --- a/tests/run-with-compiler/quote-macro-in-splice/quoted_2.scala +++ b/tests/run-with-compiler/quote-macro-in-splice/quoted_2.scala @@ -1,10 +1,9 @@ import scala.quoted._ import Macros._ -import scala.quoted.Toolbox.Default._ - object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val x = '{ val y = 1 ${ diff --git a/tests/run-with-compiler/quote-nested-1.scala b/tests/run-with-compiler/quote-nested-1.scala index 9233eb750db1..78b4c52e7508 100644 --- a/tests/run-with-compiler/quote-nested-1.scala +++ b/tests/run-with-compiler/quote-nested-1.scala @@ -1,8 +1,8 @@ import quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val q = '{ '{3} } println(q.show) } diff --git a/tests/run-with-compiler/quote-nested-2.scala b/tests/run-with-compiler/quote-nested-2.scala index eb141e0025e5..6d5eca0029fd 100644 --- a/tests/run-with-compiler/quote-nested-2.scala +++ b/tests/run-with-compiler/quote-nested-2.scala @@ -1,8 +1,9 @@ import quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + val q = '{ val a = '{4} '{${a}} diff --git a/tests/run-with-compiler/quote-nested-3.scala b/tests/run-with-compiler/quote-nested-3.scala index de5248a669c8..827ce44d5cd2 100644 --- a/tests/run-with-compiler/quote-nested-3.scala +++ b/tests/run-with-compiler/quote-nested-3.scala @@ -1,8 +1,8 @@ import quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val q = '{ type T = String diff --git a/tests/run-with-compiler/quote-nested-4.scala b/tests/run-with-compiler/quote-nested-4.scala index 3642ba4f42a2..850095f2ace3 100644 --- a/tests/run-with-compiler/quote-nested-4.scala +++ b/tests/run-with-compiler/quote-nested-4.scala @@ -1,8 +1,9 @@ import quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + val q = '{ val t = '[String] t diff --git a/tests/run-with-compiler/quote-nested-5.scala b/tests/run-with-compiler/quote-nested-5.scala index 22effdaa9026..3ba3f6a43bd1 100644 --- a/tests/run-with-compiler/quote-nested-5.scala +++ b/tests/run-with-compiler/quote-nested-5.scala @@ -1,8 +1,9 @@ import quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + val q = '{ val a = '{4} ${'{ diff --git a/tests/run-with-compiler/quote-owners-2.scala b/tests/run-with-compiler/quote-owners-2.scala index 94a1857cf617..0b19e8a32b3f 100644 --- a/tests/run-with-compiler/quote-owners-2.scala +++ b/tests/run-with-compiler/quote-owners-2.scala @@ -1,11 +1,9 @@ import quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val q = f(g(Type.IntTag)) println(q.run) println(q.show) diff --git a/tests/run-with-compiler/quote-owners.scala b/tests/run-with-compiler/quote-owners.scala index 093480065dbb..9a6f4bbd7d6d 100644 --- a/tests/run-with-compiler/quote-owners.scala +++ b/tests/run-with-compiler/quote-owners.scala @@ -1,10 +1,8 @@ import quoted._ -import scala.quoted.Toolbox.Default._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val q = f println(q.run) println(q.show) diff --git a/tests/run-with-compiler/quote-run-2.scala b/tests/run-with-compiler/quote-run-2.scala index fcbbf576e03f..25e527baaafb 100644 --- a/tests/run-with-compiler/quote-run-2.scala +++ b/tests/run-with-compiler/quote-run-2.scala @@ -1,12 +1,9 @@ -import scala.quoted.Toolbox.Default._ - import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def powerCode(n: Int, x: Expr[Double]): Expr[Double] = if (n == 0) '{1.0} else if (n == 1) x diff --git a/tests/run-with-compiler/quote-run-b.scala b/tests/run-with-compiler/quote-run-b.scala index 7d97a58fd8ef..71ba388be3cd 100644 --- a/tests/run-with-compiler/quote-run-b.scala +++ b/tests/run-with-compiler/quote-run-b.scala @@ -1,12 +1,9 @@ -import scala.quoted.Toolbox.Default._ - import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val lambdaExpr = '{ (x: Int) => println("lambda(" + x + ")") } diff --git a/tests/run-with-compiler/quote-run-c.check b/tests/run-with-compiler/quote-run-c.check index 7735271be69c..ad07a5715b14 100644 --- a/tests/run-with-compiler/quote-run-c.check +++ b/tests/run-with-compiler/quote-run-c.check @@ -1,4 +1,4 @@ Foo false Bar -class Quoted$A$1 +class Generated$Code$From$Quoted$A$1 diff --git a/tests/run-with-compiler/quote-run-c.scala b/tests/run-with-compiler/quote-run-c.scala index 999c0862c618..ddb6df723e8c 100644 --- a/tests/run-with-compiler/quote-run-c.scala +++ b/tests/run-with-compiler/quote-run-c.scala @@ -1,12 +1,9 @@ -import scala.quoted.Toolbox.Default._ - import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val classExpr = '{ class A { override def toString: String = "Foo" diff --git a/tests/run-with-compiler/quote-run-constants.scala b/tests/run-with-compiler/quote-run-constants.scala index 4613496008ab..837fb8834499 100644 --- a/tests/run-with-compiler/quote-run-constants.scala +++ b/tests/run-with-compiler/quote-run-constants.scala @@ -1,13 +1,11 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted.autolift._ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def run[T](expr: Expr[T]): Unit = println(expr.run) def show[T](expr: Expr[T]): Unit = println(expr.show) diff --git a/tests/run-with-compiler/quote-run-large.scala b/tests/run-with-compiler/quote-run-large.scala index ac21bddc7d23..a9772aeb6b62 100644 --- a/tests/run-with-compiler/quote-run-large.scala +++ b/tests/run-with-compiler/quote-run-large.scala @@ -1,4 +1,3 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted.Exprs.TastyExpr @@ -61,6 +60,8 @@ object Test { new Foo(5) } + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + assert(a.asInstanceOf[TastyExpr[_]].tasty.size > 1, "Test should be testing a quote with TastyExpr encoded in more than one string") a.show // Force unpiclking of the expression } diff --git a/tests/run-with-compiler/quote-run-many.scala b/tests/run-with-compiler/quote-run-many.scala index 1f4aa6cabd26..2a4644f523df 100644 --- a/tests/run-with-compiler/quote-run-many.scala +++ b/tests/run-with-compiler/quote-run-many.scala @@ -3,8 +3,7 @@ import scala.quoted.autolift._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def expr(i: Int) = '{ val a = 3 + ${i} 2 + a diff --git a/tests/run-with-compiler/quote-run-staged-interpreter.scala b/tests/run-with-compiler/quote-run-staged-interpreter.scala index 58ed3c591bfe..57f6fe6d128c 100644 --- a/tests/run-with-compiler/quote-run-staged-interpreter.scala +++ b/tests/run-with-compiler/quote-run-staged-interpreter.scala @@ -1,8 +1,6 @@ import scala.quoted._ import scala.quoted.autolift._ -import scala.quoted.Toolbox.Default._ - enum Exp { case Num(n: Int) case Plus(e1: Exp, e2: Exp) @@ -29,6 +27,7 @@ object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val exp = Plus(Plus(Num(2), Var("x")), Num(4)) val letExp = Let("x", Num(3), exp) diff --git a/tests/run-with-compiler/quote-run-with-settings.scala b/tests/run-with-compiler/quote-run-with-settings.scala index 493f312740d2..5e73f65dfafd 100644 --- a/tests/run-with-compiler/quote-run-with-settings.scala +++ b/tests/run-with-compiler/quote-run-with-settings.scala @@ -1,14 +1,11 @@ import java.nio.file.{Files, Paths} -import scala.quoted.Toolbox.Default._ -import scala.quoted.Toolbox - import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val expr = '{ val a = 3 println("foo") @@ -19,13 +16,13 @@ object Test { println() val outDir = Paths.get("out/out-quoted-1") - val classFile = outDir.resolve("Quoted.class") + val classFile = outDir.resolve("Generated$Code$From$Quoted.class") Files.deleteIfExists(classFile) { implicit val settings = Toolbox.Settings.make(outDir = Some(outDir.toString)) - implicit val toolbox2: scala.quoted.Toolbox = scala.quoted.Toolbox.make + implicit val toolbox2: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println(expr.run) assert(Files.exists(classFile)) } diff --git a/tests/run-with-compiler/quote-run.scala b/tests/run-with-compiler/quote-run.scala index a4cd3268a109..b7d38de71b11 100644 --- a/tests/run-with-compiler/quote-run.scala +++ b/tests/run-with-compiler/quote-run.scala @@ -1,12 +1,8 @@ - -import scala.quoted.Toolbox.Default._ - import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val expr = '{ val a = 3 println("foo") diff --git a/tests/run-with-compiler/quote-show-blocks.scala b/tests/run-with-compiler/quote-show-blocks.scala index cd6b857ab24e..c5fb45d1ce3a 100644 --- a/tests/run-with-compiler/quote-show-blocks.scala +++ b/tests/run-with-compiler/quote-show-blocks.scala @@ -3,8 +3,7 @@ import scala.quoted.autolift._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def a(n: Int, x: Expr[Unit]): Expr[Unit] = if (n == 0) x else a(n - 1, '{ println(${n}); $x }) diff --git a/tests/run-with-compiler/quote-two-captured-ref.scala b/tests/run-with-compiler/quote-two-captured-ref.scala index dc8f2ec3f0f8..79dea2f4482f 100644 --- a/tests/run-with-compiler/quote-two-captured-ref.scala +++ b/tests/run-with-compiler/quote-two-captured-ref.scala @@ -2,8 +2,7 @@ import quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) val q = '{ val x = 1 println(${ diff --git a/tests/run-with-compiler/quote-type-tags.scala b/tests/run-with-compiler/quote-type-tags.scala index dc33751495d3..36534c041b03 100644 --- a/tests/run-with-compiler/quote-type-tags.scala +++ b/tests/run-with-compiler/quote-type-tags.scala @@ -2,8 +2,7 @@ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def asof[T: Type, U](x: Expr[T], t: Type[U]): Expr[U] = '{$x.asInstanceOf[$t]} diff --git a/tests/run-with-compiler/quote-unrolled-foreach.scala b/tests/run-with-compiler/quote-unrolled-foreach.scala index 70cf60b31883..d4cc1bafe742 100644 --- a/tests/run-with-compiler/quote-unrolled-foreach.scala +++ b/tests/run-with-compiler/quote-unrolled-foreach.scala @@ -3,8 +3,7 @@ import scala.quoted._ import scala.quoted.autolift._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { val code1 = '{ (arr: Array[Int], f: Int => Unit) => ${ foreach1('arr, 'f) } } println(code1.show) diff --git a/tests/run-with-compiler/quote-var.scala b/tests/run-with-compiler/quote-var.scala index 895e8ca67b4f..02a79410cfb8 100644 --- a/tests/run-with-compiler/quote-var.scala +++ b/tests/run-with-compiler/quote-var.scala @@ -30,8 +30,7 @@ object Test { } def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) println(test1().run) } } diff --git a/tests/run-with-compiler/reflect-select-constructor/assert_1.scala b/tests/run-with-compiler/reflect-select-constructor/assert_1.scala index 3e471560d93b..f73a53a5937c 100644 --- a/tests/run-with-compiler/reflect-select-constructor/assert_1.scala +++ b/tests/run-with-compiler/reflect-select-constructor/assert_1.scala @@ -8,7 +8,6 @@ object scalatest { def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] = { import refl._ import util._ - import quoted.Toolbox.Default._ def isImplicitMethodType(tp: Type): Boolean = Type.IsMethodType.unapply(tp).flatMap(tp => if tp.isImplicit then Some(true) else None).nonEmpty diff --git a/tests/run-with-compiler/reflect-select-copy/assert_1.scala b/tests/run-with-compiler/reflect-select-copy/assert_1.scala index b15a1325088f..b8a9d7f0e5b3 100644 --- a/tests/run-with-compiler/reflect-select-copy/assert_1.scala +++ b/tests/run-with-compiler/reflect-select-copy/assert_1.scala @@ -8,7 +8,6 @@ object scalatest { def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] = { import refl._ import util._ - import quoted.Toolbox.Default._ def isImplicitMethodType(tp: Type): Boolean = Type.IsMethodType.unapply(tp).flatMap(tp => if tp.isImplicit then Some(true) else None).nonEmpty diff --git a/tests/run-with-compiler/reflect-select-value-class/assert_1.scala b/tests/run-with-compiler/reflect-select-value-class/assert_1.scala index 3e471560d93b..f73a53a5937c 100644 --- a/tests/run-with-compiler/reflect-select-value-class/assert_1.scala +++ b/tests/run-with-compiler/reflect-select-value-class/assert_1.scala @@ -8,7 +8,6 @@ object scalatest { def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] = { import refl._ import util._ - import quoted.Toolbox.Default._ def isImplicitMethodType(tp: Type): Boolean = Type.IsMethodType.unapply(tp).flatMap(tp => if tp.isImplicit then Some(true) else None).nonEmpty diff --git a/tests/run-with-compiler/shonan-hmm-simple.scala b/tests/run-with-compiler/shonan-hmm-simple.scala index 8c63e55b55e1..3b5a0373159a 100644 --- a/tests/run-with-compiler/shonan-hmm-simple.scala +++ b/tests/run-with-compiler/shonan-hmm-simple.scala @@ -116,8 +116,7 @@ class Blas1[Idx, T](r: Ring[T], ops: VecOps[Idx, T]) { object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { val arr1 = Array(0, 1, 2, 4, 8) val arr2 = Array(1, 0, 1, 0, 1) diff --git a/tests/run-with-compiler/shonan-hmm/MVmult.scala b/tests/run-with-compiler/shonan-hmm/MVmult.scala index 3462b2b3d6a2..72d35144acf0 100644 --- a/tests/run-with-compiler/shonan-hmm/MVmult.scala +++ b/tests/run-with-compiler/shonan-hmm/MVmult.scala @@ -1,5 +1,4 @@ -import scala.quoted.Toolbox.Default._ import scala.quoted._ import scala.quoted.autolift._ diff --git a/tests/run-with-compiler/shonan-hmm/Test.scala b/tests/run-with-compiler/shonan-hmm/Test.scala index 4aec6d833bb6..44849c6e3abd 100644 --- a/tests/run-with-compiler/shonan-hmm/Test.scala +++ b/tests/run-with-compiler/shonan-hmm/Test.scala @@ -1,5 +1,3 @@ - -import scala.quoted.Toolbox.Default._ import scala.quoted._ // DYNAMIC @@ -7,6 +5,8 @@ import scala.quoted._ object Test { def main(args: Array[String]): Unit = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + { val intComplex = new RingComplex(RingInt) import intComplex._ diff --git a/tests/run-with-compiler/shonan-hmm/Vmults.scala b/tests/run-with-compiler/shonan-hmm/Vmults.scala index 0e3b590f3123..14837e8b3da9 100644 --- a/tests/run-with-compiler/shonan-hmm/Vmults.scala +++ b/tests/run-with-compiler/shonan-hmm/Vmults.scala @@ -1,5 +1,3 @@ - -import scala.quoted.Toolbox.Default._ import scala.quoted._ class Vmult[Idx, T, Unt](tring: Ring[T], vec: VecOp[Idx, Unt]) { diff --git a/tests/run-with-compiler/tasty-extractors-constants-2/quoted_1.scala b/tests/run-with-compiler/tasty-extractors-constants-2/quoted_1.scala index cfd2acb5efe3..14ebf857b29e 100644 --- a/tests/run-with-compiler/tasty-extractors-constants-2/quoted_1.scala +++ b/tests/run-with-compiler/tasty-extractors-constants-2/quoted_1.scala @@ -1,5 +1,4 @@ import scala.quoted._ -import scala.quoted.Toolbox.Default._ import scala.quoted.autolift._ import scala.tasty._ @@ -10,6 +9,7 @@ object Macros { inline def testMacro: Unit = ${impl} def impl(implicit reflect: Reflection): Expr[Unit] = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) // 2 is a lifted constant val show1 = power(2, 3.0).show val run1 = power(2, 3.0).run diff --git a/tests/run/i5533b/Macro_1.scala b/tests/run/i5533b/Macro_1.scala index 5a12888603e9..c69192218c7e 100644 --- a/tests/run/i5533b/Macro_1.scala +++ b/tests/run/i5533b/Macro_1.scala @@ -8,9 +8,8 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${assertImpl('condition)} def assertImpl(condition: Expr[Boolean])(implicit refl: Reflection): Expr[Unit] = { + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader) import refl._ - import quoted.Toolbox.Default._ - val tree = condition.unseal def exprStr: String = condition.show diff --git a/tests/run/i5536/Macro_1.scala b/tests/run/i5536/Macro_1.scala index 7d4d625ea99c..45c27c56d642 100644 --- a/tests/run/i5536/Macro_1.scala +++ b/tests/run/i5536/Macro_1.scala @@ -6,8 +6,7 @@ object scalatest { def assertImpl(condition: Expr[Boolean])(implicit refl: Reflection): Expr[Unit] = { import refl._ - import quoted.Toolbox.Default._ - + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader) val tree = condition.unseal def exprStr: String = condition.show diff --git a/tests/run/reflect-select-copy/assert_1.scala b/tests/run/reflect-select-copy/assert_1.scala index cfefab644e1d..56a489edb7be 100644 --- a/tests/run/reflect-select-copy/assert_1.scala +++ b/tests/run/reflect-select-copy/assert_1.scala @@ -7,7 +7,6 @@ object scalatest { def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(implicit refl: Reflection): Expr[Unit] = { import refl._ - import quoted.Toolbox.Default._ cond.unseal.underlyingArgument match { case Apply(sel @ Select(lhs, op), rhs :: Nil) => diff --git a/tests/run/tasty-interpolation-1/Macro.scala b/tests/run/tasty-interpolation-1/Macro.scala index 054557b43fa2..c8c83914aeb3 100644 --- a/tests/run/tasty-interpolation-1/Macro.scala +++ b/tests/run/tasty-interpolation-1/Macro.scala @@ -3,7 +3,6 @@ import scala.quoted._ import scala.tasty.Reflection import scala.language.implicitConversions import scala.quoted.Exprs.LiftedExpr -import scala.quoted.Toolbox.Default._ import scala.quoted.autolift._ object Macro { diff --git a/tests/run/type-show/Macro_1.scala b/tests/run/type-show/Macro_1.scala index 87dbe60603c1..cb509769bcba 100644 --- a/tests/run/type-show/Macro_1.scala +++ b/tests/run/type-show/Macro_1.scala @@ -4,8 +4,7 @@ import scala.tasty._ object TypeToolbox { inline def show[A]: String = ${ showImpl('[A]) } private def showImpl[A, B](a: Type[A])(implicit refl: Reflection): Expr[String] = { - import refl._ - import scala.quoted.Toolbox.Default._ + implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader) a.show.toExpr } }