diff --git a/compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala b/compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala index aea4151c3969..c4d29d421351 100644 --- a/compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala +++ b/compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala @@ -8,7 +8,7 @@ import dotty.tools.io.{AbstractFile, Directory, PlainDirectory, VirtualDirectory import dotty.tools.repl.AbstractFileClassLoader import dotty.tools.dotc.reporting._ import scala.quoted._ -import scala.quoted.Toolbox +import scala.quoted.staging.Toolbox import java.net.URLClassLoader /** Driver to compile quoted code diff --git a/compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala b/compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala index 5443aeba3f15..17671b9d93f3 100644 --- a/compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala +++ b/compiler/src/dotty/tools/dotc/quoted/ToolboxImpl.scala @@ -13,7 +13,7 @@ object ToolboxImpl { * @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 { + def make(settings: scala.quoted.staging.Toolbox.Settings, appClassloader: ClassLoader): scala.quoted.staging.Toolbox = new scala.quoted.staging.Toolbox { private[this] val driver: QuoteDriver = new QuoteDriver(appClassloader) @@ -22,7 +22,7 @@ object ToolboxImpl { def run[T](exprBuilder: QuoteContext => Expr[T]): T = synchronized { try { if (running) // detected nested run - throw new scala.quoted.Toolbox.RunScopeException() + throw new scala.quoted.staging.RunScopeException() running = true driver.run(exprBuilder, settings) } finally { @@ -35,7 +35,7 @@ object ToolboxImpl { private[dotty] def checkScopeId(id: ScopeId) given Context: Unit = { if (id != scopeId) - throw new Toolbox.RunScopeException + throw new scala.quoted.staging.RunScopeException } // TODO Explore more fine grained scope ids. diff --git a/compiler/test-resources/repl-macros/i6007 b/compiler/test-resources/repl-macros/i6007 index e6372eb7deb7..cc2e2d09d97d 100644 --- a/compiler/test-resources/repl-macros/i6007 +++ b/compiler/test-resources/repl-macros/i6007 @@ -1,9 +1,10 @@ scala> import scala.quoted._ -scala> implicit def toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) -def toolbox: quoted.Toolbox +scala> import scala.quoted.staging._ +scala> implicit def toolbox: Toolbox = Toolbox.make(getClass.getClassLoader) +def toolbox: quoted.staging.Toolbox scala> def v given QuoteContext = '{ (if true then Some(1) else None).map(v => v+1) } def v given (x$1: quoted.QuoteContext): quoted.Expr[Option[Int]] -scala> scala.quoted.withQuoteContext(v.show) +scala> scala.quoted.staging.withQuoteContext(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> scala.quoted.run(v) +scala> scala.quoted.staging.run(v) val res1: Option[Int] = Some(2) diff --git a/compiler/test-resources/repl-macros/i6263 b/compiler/test-resources/repl-macros/i6263 index 2bb2b18f91e9..2dd3e41cc695 100644 --- a/compiler/test-resources/repl-macros/i6263 +++ b/compiler/test-resources/repl-macros/i6263 @@ -1,6 +1,7 @@ scala> import quoted._ -scala> implicit def toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) -def toolbox: quoted.Toolbox +scala> import quoted.staging._ +scala> implicit def toolbox: Toolbox = Toolbox.make(getClass.getClassLoader) +def toolbox: quoted.staging.Toolbox scala> def fn[T : Type](v : T) = println("ok") def fn[T](v: T)(implicit evidence$1: quoted.Type[T]): Unit scala> withQuoteContext { fn("foo") } diff --git a/docs/docs/reference/metaprogramming/macros.md b/docs/docs/reference/metaprogramming/macros.md index d8ed5dccea23..cb6a057ba190 100644 --- a/docs/docs/reference/metaprogramming/macros.md +++ b/docs/docs/reference/metaprogramming/macros.md @@ -471,7 +471,7 @@ you can expand code at runtime with a method `run`. There is also a problem with that invokation of `run` in splices. Consider the following expression: ```scala - '{ (x: Int) => ${ ('x).run; 1 } } + '{ (x: Int) => ${ run('x); 1 } } ``` This is again phase correct, but will lead us into trouble. Indeed, evaluating the splice will reduce the expression `('x).run` to `x`. But then the result diff --git a/docs/docs/reference/metaprogramming/staging.md b/docs/docs/reference/metaprogramming/staging.md index e712c2209ea0..24fd723498e9 100644 --- a/docs/docs/reference/metaprogramming/staging.md +++ b/docs/docs/reference/metaprogramming/staging.md @@ -64,7 +64,7 @@ Run provides a `QuoteContext` that can be used to show the expression in the sco On the other hand `withQuoteContext` provides a `QuoteContext` without evauating the expression. ```scala -package scala.quoted +package scala.quoted.staging def run[T](expr: given QuoteContext => Expr[T]) given (toolbox: Toolbox): T = ... @@ -81,8 +81,10 @@ expression at runtime. Within the scope of `run` we can also invoke `show` on an to get a source-like representation of the expression. ```scala +import scala.quoted.staging._ + // make available the necessary toolbox for runtime code generation -implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) +delegate for Toolbox = Toolbox.make(getClass.getClassLoader) val f: Array[Int] => Int = run { val stagedSum: Expr[Array[Int] => Int] = '{ (arr: Array[Int]) => ${sum('arr)}} diff --git a/library/src-bootstrapped/scala/quoted/package.scala b/library/src-bootstrapped/scala/quoted/package.scala index 14e1e755abb1..5122a18cee31 100644 --- a/library/src-bootstrapped/scala/quoted/package.scala +++ b/library/src-bootstrapped/scala/quoted/package.scala @@ -2,49 +2,6 @@ package scala package object quoted { - /** Evaluate the contents of this expression and return the result. - * It provides a new QuoteContext that is only valid within the scope the argument. - * - * Usage: - * ``` - * val e: T = run { // (given qctx: QuoteContext) => - * expr - * } - * ``` - * where `expr: Expr[T]` - * - * This method should not be called in a context where there is already has a `QuoteContext` - * such as within a `run` or a `withQuoteContext`. - */ - def run[T](expr: given QuoteContext => Expr[T]) given (toolbox: Toolbox): T = toolbox.run(expr given _) - - /** Provide a new quote context within the scope of the argument that is only valid within the scope the argument. - * Return the result of the argument. - * - * Usage: - * ``` - * val e: T = withQuoteContext { // (given qctx: QuoteContext) => - * thunk - * } - * ``` - * where `thunk: T` - * - * This method should not be called in a context where there is already has a `QuoteContext` - * such as within a `run` or a `withQuoteContext`. - */ - def withQuoteContext[T](thunk: given QuoteContext => T) given (toolbox: Toolbox): T = { - var result: T = NoResult.asInstanceOf[T] - def dummyRun given QuoteContext: Expr[Unit] = { - result = thunk - Expr.unitExpr - } - toolbox.run(dummyRun given _) - assert(result != NoResult) // toolbox.run should have thrown an exception - result - } - - private object NoResult - object autolift { given autoToExpr[T] as Conversion[T, Expr[T]] given Liftable[T], QuoteContext = _.toExpr } diff --git a/library/src-bootstrapped/scala/quoted/staging/package.scala b/library/src-bootstrapped/scala/quoted/staging/package.scala new file mode 100644 index 000000000000..10572a605455 --- /dev/null +++ b/library/src-bootstrapped/scala/quoted/staging/package.scala @@ -0,0 +1,48 @@ +package scala.quoted + +package object staging { + + /** Evaluate the contents of this expression and return the result. + * It provides a new QuoteContext that is only valid within the scope the argument. + * + * Usage: + * ``` + * val e: T = run { // (given qctx: QuoteContext) => + * expr + * } + * ``` + * where `expr: Expr[T]` + * + * This method should not be called in a context where there is already has a `QuoteContext` + * such as within a `run` or a `withQuoteContext`. + */ + def run[T](expr: given QuoteContext => Expr[T]) given (toolbox: Toolbox): T = toolbox.run(expr given _) + + /** Provide a new quote context within the scope of the argument that is only valid within the scope the argument. + * Return the result of the argument. + * + * Usage: + * ``` + * val e: T = withQuoteContext { // (given qctx: QuoteContext) => + * thunk + * } + * ``` + * where `thunk: T` + * + * This method should not be called in a context where there is already has a `QuoteContext` + * such as within a `run` or a `withQuoteContext`. + */ + def withQuoteContext[T](thunk: given QuoteContext => T) given (toolbox: Toolbox): T = { + var result: T = NoResult.asInstanceOf[T] + def dummyRun given QuoteContext: Expr[Unit] = { + result = thunk + Expr.unitExpr + } + toolbox.run(dummyRun given _) + assert(result != NoResult) // toolbox.run should have thrown an exception + result + } + + private object NoResult + +} diff --git a/library/src-non-bootstrapped/scala/quoted/package.scala b/library/src-non-bootstrapped/scala/quoted/package.scala index 4457f4c642fc..b42a7e7c36f7 100644 --- a/library/src-non-bootstrapped/scala/quoted/package.scala +++ b/library/src-non-bootstrapped/scala/quoted/package.scala @@ -2,49 +2,6 @@ package scala package object quoted { - /** Evaluate the contents of this expression and return the result. - * It provides a new QuoteContext that is only valid within the scope the argument. - * - * Usage: - * ``` - * val e: T = run { // (given qctx: QuoteContext) => - * expr - * } - * ``` - * where `expr: Expr[T]` - * - * This method should not be called in a context where there is already has a `QuoteContext` - * such as within a `run` or a `withQuoteContext`. - */ - def run[T](expr: given QuoteContext => Expr[T]) given (toolbox: Toolbox): T = toolbox.run(expr given _) - - /** Provide a new quote context within the scope of the argument that is only valid within the scope the argument. - * Return the result of the argument. - * - * Usage: - * ``` - * val e: T = withQuoteContext { // (given qctx: QuoteContext) => - * thunk - * } - * ``` - * where `thunk: T` - * - * This method should not be called in a context where there is already has a `QuoteContext` - * such as within a `run` or a `withQuoteContext`. - */ - def withQuoteContext[T](thunk: given QuoteContext => T) given (toolbox: Toolbox): T = { - var result: T = NoResult.asInstanceOf[T] - def dummyRun given QuoteContext: Expr[Unit] = { - result = thunk - Expr.unitExpr - } - toolbox.run(dummyRun given _) - assert(result != NoResult) // toolbox.run should have thrown an exception - result - } - - private object NoResult - object autolift { given autoToExpr[T] as Conversion[T, Expr[T]] given Liftable[T], QuoteContext = _.toExpr } diff --git a/library/src/scala/quoted/Expr.scala b/library/src/scala/quoted/Expr.scala index 9cc2f624647d..9c559a44bb72 100644 --- a/library/src/scala/quoted/Expr.scala +++ b/library/src/scala/quoted/Expr.scala @@ -3,6 +3,7 @@ package scala package quoted { import scala.quoted.show.SyntaxHighlight + import scala.quoted.staging.Toolbox sealed trait Expr[+T] { diff --git a/library/src/scala/quoted/staging/RunScopeException.scala b/library/src/scala/quoted/staging/RunScopeException.scala new file mode 100644 index 000000000000..e1a93cf7c508 --- /dev/null +++ b/library/src/scala/quoted/staging/RunScopeException.scala @@ -0,0 +1,3 @@ +package scala.quoted.staging + +class RunScopeException extends Exception("Cannot call `scala.quoted.staging.run(...)` within a macro or another `run(...)`") diff --git a/library/src/scala/quoted/Toolbox.scala b/library/src/scala/quoted/staging/Toolbox.scala similarity index 77% rename from library/src/scala/quoted/Toolbox.scala rename to library/src/scala/quoted/staging/Toolbox.scala index e0e24c82f856..261eaf83643a 100644 --- a/library/src/scala/quoted/Toolbox.scala +++ b/library/src/scala/quoted/staging/Toolbox.scala @@ -1,8 +1,9 @@ package scala.quoted +package staging 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(getClass.getClassLoader)`\n\n") +@implicitNotFound("Could not find implicit scala.quoted.staging.Toolbox.\n\nDefault toolbox can be instantiated with:\n `delegate for scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader)`\n\n") trait Toolbox { def run[T](expr: QuoteContext => Expr[T]): T } @@ -13,7 +14,8 @@ object Toolbox { * * Usuage: * ``` - * implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + * import scala.quoted.staging._ + * delegate for Toolbox = Toolbox.make(getClass.getClassLoader) * ``` * * @param appClassloader classloader of the application that generated the quotes @@ -55,8 +57,4 @@ object Toolbox { new Settings(outDir, showRawTree, compilerArgs) } - class ToolboxNotFoundException(msg: String, cause: ClassNotFoundException) extends Exception(msg, cause) - - class RunScopeException extends Exception("Cannot call `scala.quoted.run(...)` within a macro or another `run(...)`") - } diff --git a/library/src/scala/quoted/staging/ToolboxNotFoundException.scala b/library/src/scala/quoted/staging/ToolboxNotFoundException.scala new file mode 100644 index 000000000000..215f942dd72b --- /dev/null +++ b/library/src/scala/quoted/staging/ToolboxNotFoundException.scala @@ -0,0 +1,3 @@ +package scala.quoted.staging + +class ToolboxNotFoundException(msg: String, cause: ClassNotFoundException) extends Exception(msg, cause) 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 index 2e85bd8e1040..24e3146df076 100644 --- 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 @@ -5,7 +5,7 @@ import scala.quoted._ object Main { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { diff --git a/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/src/test/scala/hello/Tests.scala b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/src/test/scala/hello/Tests.scala index 4a04aadac601..dd5c1defffa0 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/src/test/scala/hello/Tests.scala +++ b/sbt-dotty/sbt-test/sbt-dotty/quoted-example-project/src/test/scala/hello/Tests.scala @@ -7,7 +7,7 @@ import scala.quoted._ class Tests { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) @Test def test(): Unit = { import hello.Main._ diff --git a/tests/disabled/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala b/tests/disabled/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala index 8c366159306b..e223d39ecc9c 100644 --- a/tests/disabled/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala +++ b/tests/disabled/neg-with-compiler/quote-run-in-macro-2/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { inline def foo(i: => Int): Int = ${ fooImpl('i) } def fooImpl(i: Expr[Int]) given QuoteContext: Expr[Int] = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) val y: Int = run(i) y } diff --git a/tests/neg-with-compiler/i5941/macro_1.scala b/tests/neg-with-compiler/i5941/macro_1.scala index d356955097e2..0911a8021511 100644 --- a/tests/neg-with-compiler/i5941/macro_1.scala +++ b/tests/neg-with-compiler/i5941/macro_1.scala @@ -12,7 +12,7 @@ object Lens { } def impl[S: Type, T: Type](getter: Expr[S => T]) given (qctx: QuoteContext): Expr[Lens[S, T]] = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(this.getClass.getClassLoader) import qctx.tasty._ import util._ // obj.copy(field = value) 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 eb7bf8cdf624..905f7946783f 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,10 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ object Macros { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) inline def foo(i: => Int): Int = ${ fooImpl('i) } def fooImpl(i: Expr[Int]) given QuoteContext: Expr[Int] = { val y: Int = run(i) diff --git a/tests/pos-with-compiler/quote-0.scala b/tests/pos-with-compiler/quote-0.scala index 39c459c93cb2..37e6539d4ae3 100644 --- a/tests/pos-with-compiler/quote-0.scala +++ b/tests/pos-with-compiler/quote-0.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ object Macros { @@ -24,7 +25,7 @@ object Macros { class Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) run { val program = '{ diff --git a/tests/pos-with-compiler/quote-assert/quoted_2.scala b/tests/pos-with-compiler/quote-assert/quoted_2.scala index 0f36072c3cce..bcb50317ef13 100644 --- a/tests/pos-with-compiler/quote-assert/quoted_2.scala +++ b/tests/pos-with-compiler/quote-assert/quoted_2.scala @@ -1,5 +1,7 @@ import scala.quoted._ +import scala.quoted.staging._ + import Macros._ object Test { @@ -15,6 +17,6 @@ object Test { ${ assertImpl('{x != 0}) } } - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) run(program) } diff --git a/tests/run-macros/i6765/Macro_1.scala b/tests/run-macros/i6765/Macro_1.scala index 267b1091bf82..f234fa289d08 100644 --- a/tests/run-macros/i6765/Macro_1.scala +++ b/tests/run-macros/i6765/Macro_1.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted._ given as Toolbox = Toolbox.make(getClass.getClassLoader) diff --git a/tests/run-macros/i6992/Macro_1.scala b/tests/run-macros/i6992/Macro_1.scala index f0e76e6b07a2..6f6c1a5cbfb0 100644 --- a/tests/run-macros/i6992/Macro_1.scala +++ b/tests/run-macros/i6992/Macro_1.scala @@ -1,5 +1,6 @@ import scala.quoted._, scala.quoted.matching._ +import scala.quoted.staging._ import delegate scala.quoted._ delegate for Toolbox = Toolbox.make(getClass.getClassLoader) @@ -16,7 +17,7 @@ object macros { case '{$x: Foo} => run(x).x.toExpr } } catch { - case _: scala.quoted.Toolbox.RunScopeException => + case _: scala.quoted.staging.RunScopeException => '{"OK"} } } diff --git a/tests/run-with-compiler/i3823-b.scala b/tests/run-with-compiler/i3823-b.scala index a1048e4937d8..16b5e6d03f62 100644 --- a/tests/run-with-compiler/i3823-b.scala +++ b/tests/run-with-compiler/i3823-b.scala @@ -1,6 +1,7 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { def f[T](x: Expr[T])(implicit t: Type[T]) = '{ val z: $t = $x diff --git a/tests/run-with-compiler/i3823-c.scala b/tests/run-with-compiler/i3823-c.scala index 61e393efab65..82a1ef9c0e49 100644 --- a/tests/run-with-compiler/i3823-c.scala +++ b/tests/run-with-compiler/i3823-c.scala @@ -1,6 +1,7 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { def f[T](x: Expr[T])(implicit t: Type[T]) = '{ val z = $x diff --git a/tests/run-with-compiler/i3823.scala b/tests/run-with-compiler/i3823.scala index 430b215acdf8..8a23b0d39456 100644 --- a/tests/run-with-compiler/i3823.scala +++ b/tests/run-with-compiler/i3823.scala @@ -1,6 +1,7 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { def f[T: Type](x: Expr[T])(t: Type[T]) = '{ val z: $t = $x diff --git a/tests/run-with-compiler/i3847-b.scala b/tests/run-with-compiler/i3847-b.scala index d51e9815d49f..0b28e31a7aef 100644 --- a/tests/run-with-compiler/i3847-b.scala +++ b/tests/run-with-compiler/i3847-b.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ import scala.reflect.ClassTag object Arrays { @@ -13,7 +14,7 @@ object Arrays { } object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { import Arrays._ implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int} diff --git a/tests/run-with-compiler/i3847.scala b/tests/run-with-compiler/i3847.scala index cce0dfd919c3..d6f08ce029cb 100644 --- a/tests/run-with-compiler/i3847.scala +++ b/tests/run-with-compiler/i3847.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ import scala.reflect.ClassTag object Arrays { @@ -13,7 +14,7 @@ object Arrays { } object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(this.getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(this.getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { import Arrays._ implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int} diff --git a/tests/run-with-compiler/i3876-b.scala b/tests/run-with-compiler/i3876-b.scala index 7f1e2884b6b4..b6b0415362d7 100644 --- a/tests/run-with-compiler/i3876-b.scala +++ b/tests/run-with-compiler/i3876-b.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def x given QuoteContext: Expr[Int] = '{3} diff --git a/tests/run-with-compiler/i3876-c.scala b/tests/run-with-compiler/i3876-c.scala index a28194a04d6d..e8179cf68e5f 100644 --- a/tests/run-with-compiler/i3876-c.scala +++ b/tests/run-with-compiler/i3876-c.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit def toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit def toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) def x given QuoteContext: Expr[Int] = '{3} diff --git a/tests/run-with-compiler/i3876-d.scala b/tests/run-with-compiler/i3876-d.scala index d61f09048bb6..041d88469e58 100644 --- a/tests/run-with-compiler/i3876-d.scala +++ b/tests/run-with-compiler/i3876-d.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def x given QuoteContext: Expr[Int] = '{3} diff --git a/tests/run-with-compiler/i3876-e.scala b/tests/run-with-compiler/i3876-e.scala index 27b935e57213..c3e3fc2dda38 100644 --- a/tests/run-with-compiler/i3876-e.scala +++ b/tests/run-with-compiler/i3876-e.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def x given QuoteContext: Expr[Int] = '{ println(); 3 } diff --git a/tests/run-with-compiler/i3876.scala b/tests/run-with-compiler/i3876.scala index ed9b1e6c2b76..06ee66c68927 100644 --- a/tests/run-with-compiler/i3876.scala +++ b/tests/run-with-compiler/i3876.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def x given QuoteContext: Expr[Int] = '{3} diff --git a/tests/run-with-compiler/i3946.scala b/tests/run-with-compiler/i3946.scala index d6d30aa3d4ef..ba299a8d5002 100644 --- a/tests/run-with-compiler/i3946.scala +++ b/tests/run-with-compiler/i3946.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def u given QuoteContext: Expr[Unit] = '{} println(withQuoteContext(u.show)) println(run(u)) diff --git a/tests/run-with-compiler/i3947.scala b/tests/run-with-compiler/i3947.scala index 35aa2334ccfe..d4f302024611 100644 --- a/tests/run-with-compiler/i3947.scala +++ b/tests/run-with-compiler/i3947.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { val lclazz = clazz.toExpr diff --git a/tests/run-with-compiler/i3947b.scala b/tests/run-with-compiler/i3947b.scala index c3ae8163019b..a8fd34908d6c 100644 --- a/tests/run-with-compiler/i3947b.scala +++ b/tests/run-with-compiler/i3947b.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i3947b2.scala b/tests/run-with-compiler/i3947b2.scala index 50616f22f987..26d9a3e4ee7e 100644 --- a/tests/run-with-compiler/i3947b2.scala +++ b/tests/run-with-compiler/i3947b2.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: given QuoteContext => java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i3947b3.scala b/tests/run-with-compiler/i3947b3.scala index 9219b4465138..35eb2a341935 100644 --- a/tests/run-with-compiler/i3947b3.scala +++ b/tests/run-with-compiler/i3947b3.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i3947c.scala b/tests/run-with-compiler/i3947c.scala index 41fb74844d3a..40a627aa319e 100644 --- a/tests/run-with-compiler/i3947c.scala +++ b/tests/run-with-compiler/i3947c.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i3947d.scala b/tests/run-with-compiler/i3947d.scala index fc03dd7a6aa2..0535ac8be357 100644 --- a/tests/run-with-compiler/i3947d.scala +++ b/tests/run-with-compiler/i3947d.scala @@ -1,8 +1,8 @@ import scala.quoted._ - +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i3947d2.scala b/tests/run-with-compiler/i3947d2.scala index e28600389949..b0fd5cceb96a 100644 --- a/tests/run-with-compiler/i3947d2.scala +++ b/tests/run-with-compiler/i3947d2.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i3947e.scala b/tests/run-with-compiler/i3947e.scala index f8d55b8da849..8b2de380f54a 100644 --- a/tests/run-with-compiler/i3947e.scala +++ b/tests/run-with-compiler/i3947e.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { diff --git a/tests/run-with-compiler/i3947f.scala b/tests/run-with-compiler/i3947f.scala index 34a7dc25ada3..3134f863dd2e 100644 --- a/tests/run-with-compiler/i3947f.scala +++ b/tests/run-with-compiler/i3947f.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i3947g.scala b/tests/run-with-compiler/i3947g.scala index 4fa44fce8d32..fba24a4818ce 100644 --- a/tests/run-with-compiler/i3947g.scala +++ b/tests/run-with-compiler/i3947g.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { val lclazz = clazz.toExpr diff --git a/tests/run-with-compiler/i3947i.scala b/tests/run-with-compiler/i3947i.scala index b0e66351aa2d..1e1ca59a34fd 100644 --- a/tests/run-with-compiler/i3947i.scala +++ b/tests/run-with-compiler/i3947i.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i3947j.scala b/tests/run-with-compiler/i3947j.scala index 260f04699df8..32a2225eb45a 100644 --- a/tests/run-with-compiler/i3947j.scala +++ b/tests/run-with-compiler/i3947j.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def test[T: Type](clazz: java.lang.Class[T]) = { diff --git a/tests/run-with-compiler/i4044a.scala b/tests/run-with-compiler/i4044a.scala index bf64dc60c419..195ba9361ff3 100644 --- a/tests/run-with-compiler/i4044a.scala +++ b/tests/run-with-compiler/i4044a.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ class Foo { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def foo: Unit = withQuoteContext { val e: Expr[Int] = '{3} val q = '{ ${ '{ $e } } } diff --git a/tests/run-with-compiler/i4044b.scala b/tests/run-with-compiler/i4044b.scala index 4968327e3667..b53089248292 100644 --- a/tests/run-with-compiler/i4044b.scala +++ b/tests/run-with-compiler/i4044b.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ sealed abstract class VarRef[T] { def update(expr: Expr[T]) given QuoteContext: Expr[Unit] @@ -19,7 +20,7 @@ object VarRef { } object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { 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 8a8b5cc546e0..04fe8e1b2ba5 100644 --- a/tests/run-with-compiler/i4044c.scala +++ b/tests/run-with-compiler/i4044c.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ class Foo { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def foo: Unit = withQuoteContext { val q = '{ ${ '{ ${ '{ 5 } } } } } println(q.show) diff --git a/tests/run-with-compiler/i4044d.scala b/tests/run-with-compiler/i4044d.scala index 583e9c4a2352..4298d1c98c73 100644 --- a/tests/run-with-compiler/i4044d.scala +++ b/tests/run-with-compiler/i4044d.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ class Foo { def foo: Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) run { val a: Expr[Int] = '{3} val q: Expr[Int] = '{ diff --git a/tests/run-with-compiler/i4044e.scala b/tests/run-with-compiler/i4044e.scala index 61cd5ce9b464..84a5b7c9be87 100644 --- a/tests/run-with-compiler/i4044e.scala +++ b/tests/run-with-compiler/i4044e.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ class Foo { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def foo: Unit = withQuoteContext { val e: Expr[Int] = '{3} val f: Expr[Int] = '{5} diff --git a/tests/run-with-compiler/i4044f.scala b/tests/run-with-compiler/i4044f.scala index 3a68edfb3f7a..e932d044b3ad 100644 --- a/tests/run-with-compiler/i4044f.scala +++ b/tests/run-with-compiler/i4044f.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ class Foo { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def foo: Unit = withQuoteContext { val e: Expr[Int] = '{3} val f: Expr[Int] = '{5} diff --git a/tests/run-with-compiler/i4350.scala b/tests/run-with-compiler/i4350.scala index cb823b457f8d..e39c07ed13d6 100644 --- a/tests/run-with-compiler/i4350.scala +++ b/tests/run-with-compiler/i4350.scala @@ -1,12 +1,13 @@ import scala.quoted._ +import scala.quoted.staging._ class Foo[T: Type] { def q given QuoteContext = '{(null: Any).asInstanceOf[T]} } object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { 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 0fb456874901..5cb8e4daab07 100644 --- a/tests/run-with-compiler/i4591.scala +++ b/tests/run-with-compiler/i4591.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { @@ -8,7 +9,7 @@ object Test { } def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) run(foo('{Option(9)})) } diff --git a/tests/run-with-compiler/i4730.scala b/tests/run-with-compiler/i4730.scala index f6007b18d279..07102d21e30e 100644 --- a/tests/run-with-compiler/i4730.scala +++ b/tests/run-with-compiler/i4730.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def ret given QuoteContext: Expr[Int => Int] = '{ (x: Int) => ${ val z = run('{x + 1}) // throws a RunScopeException @@ -13,7 +14,7 @@ object Test { run(ret).apply(10) throw new Exception } catch { - case ex: scala.quoted.Toolbox.RunScopeException => + case ex: scala.quoted.staging.RunScopeException => // ok } } diff --git a/tests/run-with-compiler/i5144.scala b/tests/run-with-compiler/i5144.scala index f937ee4b459c..14f901c30df1 100644 --- a/tests/run-with-compiler/i5144.scala +++ b/tests/run-with-compiler/i5144.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def eval1(ff: Expr[Int => Int]) given QuoteContext: Expr[Int] = '{$ff(42)} def peval1() given QuoteContext: Expr[Unit] = '{ diff --git a/tests/run-with-compiler/i5144b.scala b/tests/run-with-compiler/i5144b.scala index 77b5f59553f4..a4b740e8e968 100644 --- a/tests/run-with-compiler/i5144b.scala +++ b/tests/run-with-compiler/i5144b.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def eval1(ff: Expr[Int => Int]) given QuoteContext: Expr[Int] = ff('{42}) def peval1() given QuoteContext: Expr[Unit] = '{ diff --git a/tests/run-with-compiler/i5152.scala b/tests/run-with-compiler/i5152.scala index d7685274c215..5859cbf67430 100644 --- a/tests/run-with-compiler/i5152.scala +++ b/tests/run-with-compiler/i5152.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def eval1(ff: Expr[Int => Int]) given QuoteContext: Expr[Int => Int] = '{identity} def peval1()given QuoteContext: Expr[Unit] = '{ diff --git a/tests/run-with-compiler/i5161.scala b/tests/run-with-compiler/i5161.scala index 407ef023466f..12a9c086323b 100644 --- a/tests/run-with-compiler/i5161.scala +++ b/tests/run-with-compiler/i5161.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) enum Exp { case Int2(x: Int) diff --git a/tests/run-with-compiler/i5161b.scala b/tests/run-with-compiler/i5161b.scala index 05f877933e37..5f63900c4843 100644 --- a/tests/run-with-compiler/i5161b.scala +++ b/tests/run-with-compiler/i5161b.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { def res given QuoteContext = '{ diff --git a/tests/run-with-compiler/i5247.scala b/tests/run-with-compiler/i5247.scala index cdc643cb1b30..8daba481a04d 100644 --- a/tests/run-with-compiler/i5247.scala +++ b/tests/run-with-compiler/i5247.scala @@ -1,6 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ + object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { println(foo[Object].show) println(bar[Object].show) diff --git a/tests/run-with-compiler/i5376.scala b/tests/run-with-compiler/i5376.scala index 4e4eef4b4d49..96387cd26beb 100644 --- a/tests/run-with-compiler/i5376.scala +++ b/tests/run-with-compiler/i5376.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { var e = '{1} diff --git a/tests/run-with-compiler/i5434.scala b/tests/run-with-compiler/i5434.scala index 7f31d99b3e13..714646460205 100644 --- a/tests/run-with-compiler/i5434.scala +++ b/tests/run-with-compiler/i5434.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { diff --git a/tests/run-with-compiler/i5965.scala b/tests/run-with-compiler/i5965.scala index e8b66adbdc48..6d25a65c14c1 100644 --- a/tests/run-with-compiler/i5965.scala +++ b/tests/run-with-compiler/i5965.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { withQuoteContext('[List]) diff --git a/tests/run-with-compiler/i5965b.scala b/tests/run-with-compiler/i5965b.scala index 37b2a82497d4..7289ad7d8582 100644 --- a/tests/run-with-compiler/i5965b.scala +++ b/tests/run-with-compiler/i5965b.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) withQuoteContext('[List]) def list given QuoteContext = bound('{List(1, 2, 3)}) diff --git a/tests/run-with-compiler/i5997.scala b/tests/run-with-compiler/i5997.scala index 7fd7856ade42..1de86173e448 100644 --- a/tests/run-with-compiler/i5997.scala +++ b/tests/run-with-compiler/i5997.scala @@ -1,6 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ + object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val v = '{ (if true then Some(1) else None).map(v => v+1) } println(v.show) diff --git a/tests/run-with-compiler/i6263.scala b/tests/run-with-compiler/i6263.scala index 4c2d67d7abb7..66459bb599dd 100644 --- a/tests/run-with-compiler/i6263.scala +++ b/tests/run-with-compiler/i6263.scala @@ -1,7 +1,9 @@ import quoted._ +import scala.quoted.staging._ + object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { fn("foo") diff --git a/tests/run-with-compiler/i6281.scala b/tests/run-with-compiler/i6281.scala index b7290c96b17d..f2873243d5a2 100644 --- a/tests/run-with-compiler/i6281.scala +++ b/tests/run-with-compiler/i6281.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ object Test extends App { @@ -36,7 +37,7 @@ object Test extends App { def m given QuoteContext: STM[Int, RS] = k => k('{42}) - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) withQuoteContext { println(Effects[RS].reify[Int] { m }.show) diff --git a/tests/run-with-compiler/i6754.scala b/tests/run-with-compiler/i6754.scala index 596dc0900caa..5eb8bd0fdabd 100644 --- a/tests/run-with-compiler/i6754.scala +++ b/tests/run-with-compiler/i6754.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val tbx: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val tbx: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { def y given QuoteContext: Expr[Unit] = '{ @@ -15,7 +16,7 @@ object Test { throw new Exception } catch { case ex: java.lang.reflect.InvocationTargetException => - assert(ex.getTargetException.isInstanceOf[scala.quoted.Toolbox.RunScopeException]) + assert(ex.getTargetException.isInstanceOf[scala.quoted.staging.RunScopeException]) } } } diff --git a/tests/run-with-compiler/inline-quote.scala b/tests/run-with-compiler/inline-quote.scala index 95e526a78068..0c5501a460b2 100644 --- a/tests/run-with-compiler/inline-quote.scala +++ b/tests/run-with-compiler/inline-quote.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { @@ -7,7 +8,7 @@ object Test { $x } - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val y = '{45} diff --git a/tests/run-with-compiler/quote-ackermann-1.scala b/tests/run-with-compiler/quote-ackermann-1.scala index e2655c38fc0c..d4e5a8ee7328 100644 --- a/tests/run-with-compiler/quote-ackermann-1.scala +++ b/tests/run-with-compiler/quote-ackermann-1.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) val ack3 = run { ackermann(3) } 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 58a1678362bc..123ca72ed0d2 100644 --- a/tests/run-with-compiler/quote-fun-app-1.scala +++ b/tests/run-with-compiler/quote-fun-app-1.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) val f = run { f1 } diff --git a/tests/run-with-compiler/quote-function-applied-to.scala b/tests/run-with-compiler/quote-function-applied-to.scala index 6f05cfdb9855..d08dfd21c371 100644 --- a/tests/run-with-compiler/quote-function-applied-to.scala +++ b/tests/run-with-compiler/quote-function-applied-to.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def show(expr: given QuoteContext => Expr[_]): String = withQuoteContext(expr.show) println(show(('{ () => x(0) }).apply())) println(show(('{ (x1: Int) => x1 }).apply('{x(1)}))) diff --git a/tests/run-with-compiler/quote-lambda.scala b/tests/run-with-compiler/quote-lambda.scala index a9a65b9932cc..38d3b4760494 100644 --- a/tests/run-with-compiler/quote-lambda.scala +++ b/tests/run-with-compiler/quote-lambda.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { '{ (x: Int) => ${'x} } } diff --git a/tests/run-with-compiler/quote-lib.scala b/tests/run-with-compiler/quote-lib.scala index 0d00729d0d7f..28f9a69d8387 100644 --- a/tests/run-with-compiler/quote-lib.scala +++ b/tests/run-with-compiler/quote-lib.scala @@ -1,5 +1,6 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ import liftable.Units._ @@ -9,7 +10,7 @@ import liftable.Lists._ import liftable.Exprs._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val liftedUnit: Expr[Unit] = '{} diff --git a/tests/run-with-compiler/quote-lift-Array.scala b/tests/run-with-compiler/quote-lift-Array.scala index b4358c868922..bf34881d8726 100644 --- a/tests/run-with-compiler/quote-lift-Array.scala +++ b/tests/run-with-compiler/quote-lift-Array.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { '{ def p[T](arr: Array[T]): Unit = { diff --git a/tests/run-with-compiler/quote-lift-BigDecimal.scala b/tests/run-with-compiler/quote-lift-BigDecimal.scala index 0b30e6c2658a..21b45c4149da 100644 --- a/tests/run-with-compiler/quote-lift-BigDecimal.scala +++ b/tests/run-with-compiler/quote-lift-BigDecimal.scala @@ -1,6 +1,7 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = println(run { val a = BigDecimal(2.3).toExpr val b = BigDecimal("1005849025843905834908593485984390583429058574925.95489543").toExpr diff --git a/tests/run-with-compiler/quote-lift-BigInt.scala b/tests/run-with-compiler/quote-lift-BigInt.scala index bd28f360e4ed..33a5393a2afd 100644 --- a/tests/run-with-compiler/quote-lift-BigInt.scala +++ b/tests/run-with-compiler/quote-lift-BigInt.scala @@ -1,6 +1,7 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = println(run { val a = BigInt(2).toExpr val b = BigInt("1005849025843905834908593485984390583429058574925").toExpr diff --git a/tests/run-with-compiler/quote-lift-IArray.scala b/tests/run-with-compiler/quote-lift-IArray.scala index e43b96f18a28..9e9960290e4a 100644 --- a/tests/run-with-compiler/quote-lift-IArray.scala +++ b/tests/run-with-compiler/quote-lift-IArray.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { '{ def p[T](arr: IArray[T]): Unit = { 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 13328abc4453..7259bead222f 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,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ import Macros._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { 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 fc718f4995ce..a22465cc6161 100644 --- a/tests/run-with-compiler/quote-nested-1.scala +++ b/tests/run-with-compiler/quote-nested-1.scala @@ -1,7 +1,8 @@ import quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val q = '{ given (qctx: QuoteContext) => '{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 c76635652c25..3c3b3fa25a2e 100644 --- a/tests/run-with-compiler/quote-nested-2.scala +++ b/tests/run-with-compiler/quote-nested-2.scala @@ -1,7 +1,8 @@ import quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val q = '{ given (qctx: QuoteContext) => diff --git a/tests/run-with-compiler/quote-nested-3.scala b/tests/run-with-compiler/quote-nested-3.scala index 6189876a044f..967d2e24bc55 100644 --- a/tests/run-with-compiler/quote-nested-3.scala +++ b/tests/run-with-compiler/quote-nested-3.scala @@ -1,7 +1,8 @@ import quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val q = '{ diff --git a/tests/run-with-compiler/quote-nested-4.scala b/tests/run-with-compiler/quote-nested-4.scala index c90cf029bc7b..4fd564e11fd5 100644 --- a/tests/run-with-compiler/quote-nested-4.scala +++ b/tests/run-with-compiler/quote-nested-4.scala @@ -1,7 +1,8 @@ import quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val q = '{ diff --git a/tests/run-with-compiler/quote-nested-5.scala b/tests/run-with-compiler/quote-nested-5.scala index 40d3183c5b0c..65fa5768c1ee 100644 --- a/tests/run-with-compiler/quote-nested-5.scala +++ b/tests/run-with-compiler/quote-nested-5.scala @@ -1,7 +1,8 @@ import quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val q = '{ given (qctx: QuoteContext) => diff --git a/tests/run-with-compiler/quote-owners-2.scala b/tests/run-with-compiler/quote-owners-2.scala index 6a9c7946a0ae..ae80726518f2 100644 --- a/tests/run-with-compiler/quote-owners-2.scala +++ b/tests/run-with-compiler/quote-owners-2.scala @@ -1,8 +1,9 @@ import quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { val q = f(g(Type.IntTag)) println(q.show) diff --git a/tests/run-with-compiler/quote-owners.scala b/tests/run-with-compiler/quote-owners.scala index d34e4fae6482..95e29859a49d 100644 --- a/tests/run-with-compiler/quote-owners.scala +++ b/tests/run-with-compiler/quote-owners.scala @@ -1,8 +1,9 @@ import quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def q given QuoteContext = f println(run(q)) println(withQuoteContext(q.show)) diff --git a/tests/run-with-compiler/quote-run-2.scala b/tests/run-with-compiler/quote-run-2.scala index 00f8ceb5409a..34dadd914fcc 100644 --- a/tests/run-with-compiler/quote-run-2.scala +++ b/tests/run-with-compiler/quote-run-2.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { def powerCode(n: Int, x: Expr[Double]): Expr[Double] = if (n == 0) '{1.0} diff --git a/tests/run-with-compiler/quote-run-b.scala b/tests/run-with-compiler/quote-run-b.scala index 36949e12c2eb..b081258752e0 100644 --- a/tests/run-with-compiler/quote-run-b.scala +++ b/tests/run-with-compiler/quote-run-b.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def lambdaExpr given QuoteContext = '{ (x: Int) => println("lambda(" + x + ")") } diff --git a/tests/run-with-compiler/quote-run-c.scala b/tests/run-with-compiler/quote-run-c.scala index 3f0a14145cd3..e8899b234d4d 100644 --- a/tests/run-with-compiler/quote-run-c.scala +++ b/tests/run-with-compiler/quote-run-c.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def classExpr given QuoteContext = '{ 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 3f2d26b77ffd..80db9e42c920 100644 --- a/tests/run-with-compiler/quote-run-constants.scala +++ b/tests/run-with-compiler/quote-run-constants.scala @@ -2,10 +2,11 @@ import given scala.quoted.autolift._ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def runAndPrint[T](expr: given QuoteContext => Expr[T]): Unit = println(run(expr)) runAndPrint(true) diff --git a/tests/run-with-compiler/quote-run-large.scala b/tests/run-with-compiler/quote-run-large.scala index 3b89c3eb5e6c..055c75a9e116 100644 --- a/tests/run-with-compiler/quote-run-large.scala +++ b/tests/run-with-compiler/quote-run-large.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { @@ -59,7 +60,7 @@ object Test { new Foo(5) } - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) withQuoteContext { 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 0c35431c2169..c09e43d4e4b6 100644 --- a/tests/run-with-compiler/quote-run-many.scala +++ b/tests/run-with-compiler/quote-run-many.scala @@ -1,9 +1,10 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def expr(i: Int) given QuoteContext = '{ 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 4918f8e21b9a..13089980c766 100644 --- a/tests/run-with-compiler/quote-run-staged-interpreter.scala +++ b/tests/run-with-compiler/quote-run-staged-interpreter.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ enum Exp { @@ -27,7 +28,7 @@ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = 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 7238966a0750..408e59832db9 100644 --- a/tests/run-with-compiler/quote-run-with-settings.scala +++ b/tests/run-with-compiler/quote-run-with-settings.scala @@ -2,10 +2,11 @@ import java.nio.file.{Files, Paths} import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def expr given QuoteContext = '{ val a = 3 println("foo") @@ -22,7 +23,7 @@ object Test { { implicit val settings = Toolbox.Settings.make(outDir = Some(outDir.toString)) - implicit val toolbox2: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val toolbox2: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) println(run(expr)) assert(Files.exists(classFile)) } diff --git a/tests/run-with-compiler/quote-run.scala b/tests/run-with-compiler/quote-run.scala index af5656f6050d..b8c3b2b2d2f5 100644 --- a/tests/run-with-compiler/quote-run.scala +++ b/tests/run-with-compiler/quote-run.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def expr given QuoteContext = '{ 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 47bb41b6eb8f..e891cf6ea836 100644 --- a/tests/run-with-compiler/quote-show-blocks.scala +++ b/tests/run-with-compiler/quote-show-blocks.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def a(n: Int, x: Expr[Unit]): Expr[Unit] = if (n == 0) x diff --git a/tests/run-with-compiler/quote-simple-hole.scala b/tests/run-with-compiler/quote-simple-hole.scala index f98c7496b69c..8688275fcecc 100644 --- a/tests/run-with-compiler/quote-simple-hole.scala +++ b/tests/run-with-compiler/quote-simple-hole.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { val x = '{0} diff --git a/tests/run-with-compiler/quote-toExprOfTuple.scala b/tests/run-with-compiler/quote-toExprOfTuple.scala index bf11ea82f126..bee761679d22 100644 --- a/tests/run-with-compiler/quote-toExprOfTuple.scala +++ b/tests/run-with-compiler/quote-toExprOfTuple.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { for (n <- 0 to 25) { prev = 0 diff --git a/tests/run-with-compiler/quote-two-captured-ref.scala b/tests/run-with-compiler/quote-two-captured-ref.scala index 093931d9ac78..e7d71d6eb7f7 100644 --- a/tests/run-with-compiler/quote-two-captured-ref.scala +++ b/tests/run-with-compiler/quote-two-captured-ref.scala @@ -1,7 +1,8 @@ import quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { val q = '{ val x = 1 diff --git a/tests/run-with-compiler/quote-type-tags.scala b/tests/run-with-compiler/quote-type-tags.scala index 394efe9edd9d..0579a5c4e22b 100644 --- a/tests/run-with-compiler/quote-type-tags.scala +++ b/tests/run-with-compiler/quote-type-tags.scala @@ -1,7 +1,8 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { 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 c93e526bc1fc..a2a1106bd624 100644 --- a/tests/run-with-compiler/quote-unrolled-foreach.scala +++ b/tests/run-with-compiler/quote-unrolled-foreach.scala @@ -1,9 +1,10 @@ import scala.annotation.tailrec import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { def code1 given QuoteContext = '{ (arr: Array[Int], f: Int => Unit) => ${ foreach1('arr, 'f) } } println(code1.show) diff --git a/tests/run-with-compiler/quote-valueof-list.scala b/tests/run-with-compiler/quote-valueof-list.scala index 956c4054523f..2c9ba429bcae 100644 --- a/tests/run-with-compiler/quote-valueof-list.scala +++ b/tests/run-with-compiler/quote-valueof-list.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { diff --git a/tests/run-with-compiler/quote-valueof.scala b/tests/run-with-compiler/quote-valueof.scala index a1e8a0fda07c..4467009ffe72 100644 --- a/tests/run-with-compiler/quote-valueof.scala +++ b/tests/run-with-compiler/quote-valueof.scala @@ -1,8 +1,9 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { println(('{}).getValue) diff --git a/tests/run-with-compiler/quote-var.scala b/tests/run-with-compiler/quote-var.scala index d40101a71ba5..ea64ee8f3806 100644 --- a/tests/run-with-compiler/quote-var.scala +++ b/tests/run-with-compiler/quote-var.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ object Test { @@ -30,7 +31,7 @@ object Test { } def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) val res = run { test1() } diff --git a/tests/run-with-compiler/shonan-hmm-simple.scala b/tests/run-with-compiler/shonan-hmm-simple.scala index e949246806c2..fbd98a8b6a9e 100644 --- a/tests/run-with-compiler/shonan-hmm-simple.scala +++ b/tests/run-with-compiler/shonan-hmm-simple.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ trait Ring[T] { @@ -116,7 +117,7 @@ class Blas1[Idx, T](r: Ring[T], ops: VecOps[Idx, T]) { object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = 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/Test.scala b/tests/run-with-compiler/shonan-hmm/Test.scala index fcff0cf0e73e..66a562201ec9 100644 --- a/tests/run-with-compiler/shonan-hmm/Test.scala +++ b/tests/run-with-compiler/shonan-hmm/Test.scala @@ -1,10 +1,11 @@ import scala.quoted._ +import scala.quoted.staging._ // DYNAMIC object Test { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = withQuoteContext { diff --git a/tests/run-with-compiler/staged-streams_1.scala b/tests/run-with-compiler/staged-streams_1.scala index 3de089a68e77..efce9cd46363 100644 --- a/tests/run-with-compiler/staged-streams_1.scala +++ b/tests/run-with-compiler/staged-streams_1.scala @@ -1,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ import scala.quoted.util._ import given scala.quoted.autolift._ @@ -657,7 +658,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(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) println(run(test1())) println println(run(test2())) diff --git a/tests/run-with-compiler/staged-tuples/Test.scala b/tests/run-with-compiler/staged-tuples/Test.scala index 2ab1843db224..e846c765c83e 100644 --- a/tests/run-with-compiler/staged-tuples/Test.scala +++ b/tests/run-with-compiler/staged-tuples/Test.scala @@ -1,10 +1,10 @@ -import scala.quoted.run +import scala.quoted.staging.run import scala.internal.StagedTuple._ object Test { def main(args: Array[String]): Unit = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) assert(run(fromArrayStaged('{ Array.empty[Object] }, Some(0))).==(())) assert(run(fromArrayStaged[Tuple1[String]]('{ Array[Object]("a") }, Some(1))) == Tuple1("a")) 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 bf98e0d9a9ce..0544cf29dfd6 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,4 +1,5 @@ import scala.quoted._ +import scala.quoted.staging._ import given scala.quoted.autolift._ import scala.tasty.util._ @@ -8,7 +9,7 @@ object Macros { inline def testMacro: Unit = ${impl} def impl given QuoteContext: Expr[Unit] = { - implicit val toolbox: scala.quoted.Toolbox = scala.quoted.Toolbox.make(getClass.getClassLoader) + delegate for Toolbox = Toolbox.make(getClass.getClassLoader) // 2 is a lifted constant val show1 = withQuoteContext(power(2, 3.0).show) val run1 = run(power(2, 3.0))