From 80ed86aa1bc8a4643cee80855afe32dc88aed964 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Sat, 21 Nov 2020 14:15:11 +0100 Subject: [PATCH] Rename QuoteContext to Quotes `QuoteContext` is required on all signatures. To make it simpler to keep signatures on one line we shorten the name to `Quotes`. This name will usually be used in `(using Quotes)` which reads as _using quotes_ and descibes exactly why this contextual parameter is the. ```diff - def f[T: Type](x: Expr[T])(using QuoteContext): Expr[T] = ... + def f[T: Type](x: Expr[T])(using Quotes): Expr[T] = ... ``` --- community-build/community-projects/PPrint | 2 +- .../community-projects/dotty-cps-async | 2 +- community-build/community-projects/intent | 2 +- community-build/community-projects/minitest | 2 +- community-build/community-projects/munit | 2 +- community-build/community-projects/scalatest | 2 +- .../community-projects/scodec-bits | 2 +- community-build/community-projects/shapeless | 2 +- community-build/community-projects/sourcecode | 2 +- community-build/community-projects/upickle | 2 +- community-build/community-projects/utest | 2 +- .../community-projects/xml-interpolator | 2 +- community-build/sbt-scalajs-sbt | 2 +- .../dotty/tools/dotc/core/Definitions.scala | 2 +- .../tools/dotc/core/StagingContext.scala | 18 +++--- .../decompiler/DecompilationPrinter.scala | 4 +- .../dotc/decompiler/IDEDecompilerDriver.scala | 4 +- .../tools/dotc/quoted/PickledQuotes.scala | 20 +++--- .../tools/dotc/transform/PickleQuotes.scala | 12 ++-- .../dotty/tools/dotc/transform/Splicer.scala | 10 +-- .../dotc/transform/TreeMapWithStages.scala | 2 +- .../tools/dotc/typer/QuotesAndSplices.scala | 10 +-- .../scala/quoted/runtime/impl/Matcher.scala | 2 +- ...uoteContextImpl.scala => QuotesImpl.scala} | 62 +++++++++--------- .../scala/quoted/runtime/impl/TypeImpl.scala | 2 +- .../runtime/impl/printers/Extractors.scala | 12 ++-- .../runtime/impl/printers/SourceCode.scala | 12 ++-- compiler/test-resources/repl-macros/i5551 | 4 +- compiler/test-resources/repl/i9227 | 6 +- .../changed-features/numeric-literals.md | 2 +- .../reference/contextual/derivation-macro.md | 10 +-- docs/docs/reference/metaprogramming/macros.md | 46 ++++++------- .../docs/reference/metaprogramming/staging.md | 8 +-- .../metaprogramming/tasty-reflect.md | 8 +-- .../src-bootstrapped/scala/quoted/Expr.scala | 64 ++++++++++--------- .../scala/quoted/ExprMap.scala | 8 +-- .../scala/quoted/Liftable.scala | 54 ++++++++-------- .../src-bootstrapped/scala/quoted/Type.scala | 6 +- .../scala/quoted/Unliftable.scala | 2 +- .../scala/internal/quoted/CompileTime.scala | 6 +- .../scala/quoted/Type.scala | 4 +- .../scala/quoted/Unliftable.scala | 2 +- .../scala/quoted/internal/Expr.scala | 8 +-- library/src/scala/quoted/Const.scala | 2 +- library/src/scala/quoted/Consts.scala | 4 +- .../{QuoteContext.scala => Quotes.scala} | 36 +++++------ library/src/scala/quoted/Unlifted.scala | 8 +-- library/src/scala/quoted/Varargs.scala | 6 +- library/src/scala/quoted/qctx.scala | 4 +- library/src/scala/quoted/report.scala | 12 ++-- library/src/scala/quoted/runtime/Expr.scala | 8 +-- .../scala/quoted/runtime/QuoteMatching.scala | 8 +-- .../scala/quoted/runtime/QuoteUnpickler.scala | 8 +-- .../src/main/scala/hello/Hello.scala | 2 +- .../app/Main.scala | 2 +- .../changes/Macro.scala | 2 +- .../changes/MacroCompileError.scala | 2 +- .../changes/MacroRuntimeError.scala | 2 +- .../Macro.scala | 2 +- .../changes/MacroRuntime.scala | 2 +- .../changes/MacroRuntimeCompileError.scala | 2 +- .../changes/MacroRuntimeRuntimeError.scala | 2 +- .../Macros.scala | 2 +- scala3doc/src/dotty/dokka/tasty/SymOps.scala | 2 +- .../dotty/dokka/tasty/SyntheticSupport.scala | 24 +++---- .../src/dotty/dokka/tasty/TastyParser.scala | 14 ++-- .../dotty/dokka/tasty/comments/Comments.scala | 2 +- .../dokka/tasty/comments/MemberLookup.scala | 16 ++--- .../tasty/comments/MemberLookupTests.scala | 8 +-- .../quoted/staging/ExprCompilationUnit.scala | 2 +- .../scala/quoted/staging/QuoteCompiler.scala | 8 +-- .../scala/quoted/staging/QuoteDriver.scala | 2 +- .../src/scala/quoted/staging/Toolbox.scala | 4 +- .../src/scala/quoted/staging/staging.scala | 22 +++---- staging/test-resources/repl-staging/i6007 | 6 +- staging/test-resources/repl-staging/i6263 | 6 +- .../test/BootstrappedStdLibTASYyTest.scala | 2 +- .../tasty/inspector/TastyInspector.scala | 10 +-- tests/bench/power-macro/PowerMacro.scala | 4 +- .../string-interpolation-macro/Macro.scala | 2 +- .../quote-run-in-macro-2/quoted_1.scala | 2 +- .../disabled/pos-macros/i3898c/quoted_1.scala | 2 +- .../disabled/pos-macros/i3898c/quoted_2.scala | 2 +- .../i7853/SummonJsonEncoderTest_2.scala | 2 +- tests/disabled/run-macros/1.scala | 2 +- .../quote-macro-in-splice/quoted_1.scala | 2 +- .../quote-macro-in-splice/quoted_2.scala | 2 +- .../fatal-warnings/quote-simple-hole.scala | 4 +- .../BigFloat/BigFloatFromDigitsImpl_1.scala | 2 +- .../GenericNumLits/EvenFromDigitsImpl_1.scala | 2 +- .../beta-reduce-inline-result/Macro_1.scala | 2 +- .../neg-macros/delegate-match-1/Macro_1.scala | 2 +- .../neg-macros/delegate-match-2/Macro_1.scala | 2 +- .../neg-macros/delegate-match-3/Macro_1.scala | 2 +- tests/neg-macros/i4044a.scala | 6 +- tests/neg-macros/i4044b.scala | 8 +-- tests/neg-macros/i4846.scala | 2 +- tests/neg-macros/i5547.scala | 2 +- tests/neg-macros/i5840.scala | 4 +- tests/neg-macros/i5954b.scala | 2 +- tests/neg-macros/i5954c.scala | 2 +- tests/neg-macros/i6432/Macro_1.scala | 2 +- tests/neg-macros/i6432b/Macro_1.scala | 2 +- tests/neg-macros/i6436.check | 2 +- tests/neg-macros/i6530b.scala | 2 +- tests/neg-macros/i6739.scala | 2 +- tests/neg-macros/i6762.scala | 2 +- tests/neg-macros/i6976/Macro_1.scala | 2 +- tests/neg-macros/i6997.scala | 2 +- tests/neg-macros/i6997b.scala | 2 +- tests/neg-macros/i7013.scala | 2 +- tests/neg-macros/i7013b.scala | 2 +- tests/neg-macros/i7013c.scala | 2 +- tests/neg-macros/i7048e.scala | 2 +- tests/neg-macros/i7052.scala | 2 +- tests/neg-macros/i7052b.scala | 4 +- tests/neg-macros/i7121.scala | 2 +- tests/neg-macros/i7142/Macro_1.scala | 2 +- tests/neg-macros/i7142b/Macro_1.scala | 2 +- tests/neg-macros/i7142c/Macro_1.scala | 2 +- tests/neg-macros/i7142d/Macro_1.scala | 2 +- tests/neg-macros/i7142e/Macro_1.scala | 2 +- tests/neg-macros/i7142f/Macro_1.scala | 2 +- tests/neg-macros/i7142g/Macro_1.scala | 2 +- tests/neg-macros/i7142h/Macro_1.scala | 2 +- tests/neg-macros/i7264d.scala | 2 +- tests/neg-macros/i7407.scala | 2 +- tests/neg-macros/i7603.scala | 2 +- tests/neg-macros/i7618.scala | 4 +- tests/neg-macros/i7618b.scala | 4 +- tests/neg-macros/i7698.scala | 2 +- tests/neg-macros/i7839.scala | 2 +- tests/neg-macros/i7892.scala | 2 +- tests/neg-macros/i7919.scala | 2 +- tests/neg-macros/i8052.scala | 2 +- tests/neg-macros/i8749.scala | 2 +- tests/neg-macros/i8871.scala | 2 +- tests/neg-macros/i8871b.scala | 2 +- tests/neg-macros/i9014/Macros_1.scala | 2 +- tests/neg-macros/i9801/Macro_1.scala | 2 +- tests/neg-macros/i9801b/Macro_1.scala | 2 +- tests/neg-macros/i9972/Test_2.scala | 2 +- .../Macro_1.scala | 14 ++-- tests/neg-macros/inline-option/Macro_1.scala | 2 +- tests/neg-macros/inline-quote.scala | 2 +- .../neg-macros/inline-tuples-1/Macro_1.scala | 44 ++++++------- .../macro-class-not-found-1/Foo.scala | 2 +- .../macro-class-not-found-2/Foo.scala | 2 +- tests/neg-macros/macro-cycle1.scala | 4 +- .../neg-macros/macros-in-same-project-1.scala | 2 +- .../neg-macros/macros-in-same-project-2.scala | 2 +- .../macros-in-same-project-4/Bar.scala | 2 +- .../macros-in-same-project-4/Foo.scala | 2 +- .../macros-in-same-project-5/Bar.scala | 4 +- .../macros-in-same-project-6/Foo.scala | 2 +- tests/neg-macros/quote-0.scala | 4 +- tests/neg-macros/quote-1.scala | 4 +- .../neg-macros/quote-complex-top-splice.scala | 2 +- tests/neg-macros/quote-error-2/Macro_1.scala | 4 +- tests/neg-macros/quote-error/Macro_1.scala | 2 +- .../neg-macros/quote-exception/Macro_1.scala | 2 +- .../quote-interpolator-core-old.scala | 4 +- tests/neg-macros/quote-macro-2-splices.scala | 2 +- .../quote-macro-complex-arg-0.scala | 2 +- .../quote-open-patterns-stages.scala | 2 +- .../quote-open-patterns-typer.scala | 2 +- ...-pattern-implemnetation-restrictions.scala | 2 +- tests/neg-macros/quote-spliceNonStaged.scala | 2 +- tests/neg-macros/quote-this-a.scala | 2 +- tests/neg-macros/quote-this-b.scala | 2 +- tests/neg-macros/quote-this-c.scala | 6 +- tests/neg-macros/quote-whitebox/Macro_1.scala | 2 +- tests/neg-macros/quotedPatterns-1.scala | 2 +- tests/neg-macros/quotedPatterns-2.scala | 2 +- tests/neg-macros/quotedPatterns-3.scala | 2 +- tests/neg-macros/quotedPatterns-5.scala | 2 +- tests/neg-macros/quotedPatterns-6.scala | 2 +- .../neg-macros/reflect-inline/assert_1.scala | 2 +- .../splice-in-top-level-splice-1.scala | 4 +- .../splice-in-top-level-splice-2.scala | 2 +- tests/neg-macros/splice-non-expr.scala | 2 +- .../tasty-macro-assert-1/quoted_1.scala | 2 +- .../tasty-macro-assert-2/quoted_1.scala | 2 +- .../tasty-macro-error/quoted_1.scala | 2 +- .../tasty-macro-positions/quoted_1.scala | 2 +- .../Macro_1.scala | 2 +- .../Macro_1.scala | 2 +- tests/neg-macros/toexproftuple.scala | 2 +- .../type-splice-in-val-pattern.scala | 2 +- tests/neg-staging/i5941/macro_1.scala | 2 +- .../quote-run-in-macro-1/quoted_1.scala | 2 +- .../GenericNumLits/EvenFromDigitsImpl_1.scala | 2 +- tests/patmat/i6255.scala | 2 +- tests/patmat/i6255b.scala | 2 +- tests/patmat/i9489.scala | 2 +- tests/patmat/i9489b.scala | 2 +- tests/pending/pos/cps-async-failure.scala | 2 +- .../pending/run/tasty-comments/quoted_1.scala | 2 +- .../semanticdb/inline-unapply/Macro_1.scala | 2 +- .../semanticdb/macro-pos/example_1.scala | 2 +- tests/pos-macros/f64Pow5Split/Macro.scala | 2 +- tests/pos-macros/i10050.scala | 2 +- tests/pos-macros/i10107b/Macro_1.scala | 2 +- tests/pos-macros/i10151/Macro_1.scala | 2 +- tests/pos-macros/i10211/Macro_1.scala | 2 +- tests/pos-macros/i3898/quoted_1.scala | 2 +- tests/pos-macros/i3898b/quoted_1.scala | 2 +- tests/pos-macros/i3912-1/i3912_1.scala | 2 +- tests/pos-macros/i3912-2/i3912_1.scala | 2 +- tests/pos-macros/i3912-3/i3912_1.scala | 2 +- tests/pos-macros/i4023/Test_2.scala | 2 +- tests/pos-macros/i4023b/Macro_1.scala | 2 +- tests/pos-macros/i4023b/Test_2.scala | 2 +- tests/pos-macros/i4023c/Macro_1.scala | 2 +- tests/pos-macros/i4350.scala | 2 +- tests/pos-macros/i4380a.scala | 4 +- tests/pos-macros/i4380b.scala | 2 +- tests/pos-macros/i4396a.scala | 2 +- tests/pos-macros/i4396b.scala | 2 +- tests/pos-macros/i4414.scala | 2 +- tests/pos-macros/i4514.scala | 2 +- tests/pos-macros/i4539.scala | 2 +- tests/pos-macros/i4539b.scala | 2 +- tests/pos-macros/i4734/Macro_1.scala | 2 +- tests/pos-macros/i4773.scala | 2 +- tests/pos-macros/i4774a.scala | 2 +- tests/pos-macros/i4774b.scala | 2 +- tests/pos-macros/i4774c.scala | 2 +- tests/pos-macros/i4774d.scala | 2 +- tests/pos-macros/i4774e.scala | 4 +- tests/pos-macros/i4774f.scala | 4 +- tests/pos-macros/i4891.scala | 2 +- tests/pos-macros/i5547.scala | 2 +- tests/pos-macros/i5954.scala | 4 +- tests/pos-macros/i5954b.scala | 4 +- tests/pos-macros/i5954c.scala | 4 +- tests/pos-macros/i5954d.scala | 4 +- tests/pos-macros/i5962.scala | 2 +- tests/pos-macros/i6008.scala | 2 +- tests/pos-macros/i6140.scala | 2 +- tests/pos-macros/i6142.scala | 2 +- tests/pos-macros/i6171/Macro_1.scala | 2 +- tests/pos-macros/i6210/Macros_1.scala | 2 +- tests/pos-macros/i6214.scala | 2 +- tests/pos-macros/i6214b.scala | 2 +- tests/pos-macros/i6253.scala | 2 +- tests/pos-macros/i6435.scala | 2 +- tests/pos-macros/i6535/Macro_1.scala | 2 +- tests/pos-macros/i6588.scala | 2 +- tests/pos-macros/i6783.scala | 2 +- tests/pos-macros/i6803b/Macro_1.scala | 2 +- tests/pos-macros/i6997c.scala | 2 +- tests/pos-macros/i6998.scala | 2 +- tests/pos-macros/i7011/Macros_1.scala | 2 +- tests/pos-macros/i7030/Macros_1.scala | 4 +- tests/pos-macros/i7046.scala | 2 +- tests/pos-macros/i7048.scala | 2 +- tests/pos-macros/i7048b.scala | 2 +- tests/pos-macros/i7048c.scala | 2 +- tests/pos-macros/i7048d.scala | 2 +- tests/pos-macros/i7048e.scala | 2 +- tests/pos-macros/i7052.scala | 2 +- tests/pos-macros/i7110a/Macro_1.scala | 2 +- tests/pos-macros/i7110b/Macro_1.scala | 2 +- tests/pos-macros/i7110c/Macro_1.scala | 2 +- tests/pos-macros/i7110d/Macro_1.scala | 2 +- tests/pos-macros/i7110e/Macro_1.scala | 2 +- tests/pos-macros/i7110f/Macro_1.scala | 2 +- tests/pos-macros/i7204.scala | 2 +- tests/pos-macros/i7262.scala | 2 +- tests/pos-macros/i7264.scala | 2 +- tests/pos-macros/i7264b.scala | 2 +- tests/pos-macros/i7264c.scala | 2 +- tests/pos-macros/i7322/Macro_1.scala | 4 +- tests/pos-macros/i7322/Test_2.scala | 4 +- tests/pos-macros/i7342/Macro_1.scala | 4 +- tests/pos-macros/i7342/Macro_2.scala | 4 +- tests/pos-macros/i7343/Macro_1.scala | 4 +- tests/pos-macros/i7343/Test_2.scala | 4 +- tests/pos-macros/i7343b/Macro_1.scala | 2 +- tests/pos-macros/i7343b/Test_2.scala | 2 +- tests/pos-macros/i7358.scala | 4 +- tests/pos-macros/i7405.scala | 2 +- tests/pos-macros/i7405b.scala | 2 +- tests/pos-macros/i7513/Macro_1.scala | 2 +- tests/pos-macros/i7513b/Macro_1.scala | 2 +- tests/pos-macros/i7513c/Macro_1.scala | 2 +- tests/pos-macros/i7519.scala | 2 +- tests/pos-macros/i7519b.scala | 2 +- tests/pos-macros/i7521.scala | 2 +- tests/pos-macros/i7887.scala | 2 +- tests/pos-macros/i7997.scala | 2 +- tests/pos-macros/i8045.scala | 4 +- tests/pos-macros/i8045b.scala | 6 +- tests/pos-macros/i8052.scala | 2 +- tests/pos-macros/i8100.scala | 2 +- tests/pos-macros/i8302.scala | 4 +- tests/pos-macros/i8325/Macro_1.scala | 2 +- tests/pos-macros/i8325b/Macro_1.scala | 2 +- tests/pos-macros/i8521/Macro_1.scala | 2 +- tests/pos-macros/i8651a.scala | 2 +- tests/pos-macros/i8651b.scala | 2 +- tests/pos-macros/i8866/Macro_1.scala | 4 +- tests/pos-macros/i8866b/Macro_1.scala | 2 +- tests/pos-macros/i8866c/Macro_1.scala | 2 +- tests/pos-macros/i8879/Macro_1.scala | 2 +- tests/pos-macros/i8945.scala | 2 +- tests/pos-macros/i9020-a/Macro_1.scala | 2 +- tests/pos-macros/i9020-b/Macro_1.scala | 2 +- tests/pos-macros/i9240/Macro_1.scala | 4 +- tests/pos-macros/i9251/Macro_1.scala | 2 +- tests/pos-macros/i9252/Macro.scala | 2 +- tests/pos-macros/i9321/macros.scala | 4 +- tests/pos-macros/i9465.scala | 2 +- tests/pos-macros/i9484/C.scala | 2 +- tests/pos-macros/i9484/Q.scala | 2 +- tests/pos-macros/i9484b/C.scala | 2 +- tests/pos-macros/i9484b/Q.scala | 2 +- tests/pos-macros/i9518/Macro_1.scala | 2 +- tests/pos-macros/i9570.scala | 2 +- tests/pos-macros/i9687/Macro_1.scala | 2 +- tests/pos-macros/i9802/Macro_1.scala | 2 +- tests/pos-macros/i9812.scala | 2 +- tests/pos-macros/i9894/Macro_1.scala | 2 +- .../pos-macros/macro-classloaders/Macro.scala | 2 +- tests/pos-macros/macro-docs.scala | 2 +- .../pos-macros/macro-with-type/Macro_1.scala | 2 +- .../macros-in-same-project-1/Foo.scala | 2 +- .../macros-in-same-project-2/Foo.scala | 2 +- .../macros-in-same-project-3/Bar.scala | 2 +- .../macros-in-same-project-3/Foo.scala | 2 +- .../macros-in-same-project-4/Bar.scala | 4 +- tests/pos-macros/nil-liftable.scala | 2 +- tests/pos-macros/power-macro/Macro_1.scala | 4 +- tests/pos-macros/quote-1.scala | 2 +- tests/pos-macros/quote-bind-T.scala | 2 +- tests/pos-macros/quote-lift.scala | 2 +- tests/pos-macros/quote-liftable.scala | 4 +- .../quote-matching-implicit-types.scala | 2 +- .../quote-nested-object/Macro_1.scala | 4 +- tests/pos-macros/quote-nested.scala | 2 +- tests/pos-macros/quote-no-splices.scala | 2 +- tests/pos-macros/quote-non-static-macro.scala | 2 +- tests/pos-macros/quote-this.scala | 10 +-- tests/pos-macros/quote-type-with-param.scala | 2 +- .../pos-macros/quote-whitebox-2/Macro_1.scala | 2 +- tests/pos-macros/quoted-inline-quote.scala | 4 +- tests/pos-macros/quoted-pattern-type.scala | 2 +- .../quoted-splice-pattern-applied.scala | 2 +- tests/pos-macros/quoted-var.scala | 6 +- tests/pos-macros/quotedPatterns-4.scala | 2 +- tests/pos-macros/quotedPatterns.scala | 4 +- tests/pos-macros/scala2-macro-compat-1.scala | 2 +- .../splice-with-explicit-context.scala | 6 +- .../tasty-constant-type/Macro_1.scala | 2 +- tests/pos-macros/toexproftuple.scala | 2 +- tests/pos-macros/treemap-unapply/Macro.scala | 2 +- tests/pos-macros/typetags.scala | 2 +- tests/pos-macros/using-quote-context.scala | 2 +- .../fatal-warnings/tasty-parent-unapply.scala | 2 +- tests/pos-staging/quote-0.scala | 8 +-- tests/pos-staging/quote-assert/quoted_1.scala | 2 +- tests/pos-staging/quote-assert/quoted_2.scala | 2 +- tests/rewrites/i9632.scala | 2 +- .../tasty-definitions-2/Macro_1.scala | 2 +- .../tasty-definitions-3/Macro_1.scala | 2 +- .../tasty-extractors-owners/quoted_1.scala | 4 +- .../tasty-load-tree-1/quoted_1.scala | 2 +- .../tasty-load-tree-2/quoted_1.scala | 2 +- .../run-macros-erased/macro-erased/1.scala | 16 ++--- .../reflect-isFunctionType/macro_1.scala | 8 +-- .../tasty-inspector/i8163.scala | 4 +- .../tasty-inspector/i8364.scala | 2 +- .../tasty-inspector/i8389.scala | 2 +- .../tasty-inspector/i8460.scala | 4 +- .../tasty-documentation-inspector/Test.scala | 2 +- .../tasty-inspector/Test.scala | 2 +- .../interpreter/TastyInterpreter.scala | 2 +- .../interpreter/TreeInterpreter.scala | 2 +- .../interpreter/jvm/Interpreter.scala | 2 +- .../interpreter/jvm/JVMReflection.scala | 2 +- .../BigFloat/BigFloatFromDigitsImpl_1.scala | 2 +- .../beta-reduce-inline-result/Macro_1.scala | 4 +- .../run-macros/enum-nat-macro/Macros_2.scala | 6 +- tests/run-macros/expr-map-1/Macro_1.scala | 4 +- tests/run-macros/expr-map-2/Macro_1.scala | 4 +- .../f-interpolation-1/FQuote_1.scala | 2 +- .../run-macros/flops-rewrite-2/Macro_1.scala | 6 +- .../run-macros/flops-rewrite-3/Macro_1.scala | 10 +-- tests/run-macros/flops-rewrite/Macro_1.scala | 6 +- .../gestalt-optional-staging/Macro_1.scala | 4 +- .../Macro_1.scala | 28 ++++---- tests/run-macros/i10011/Macro_1.scala | 2 +- tests/run-macros/i4515/Macro_1.scala | 2 +- tests/run-macros/i4515b/Macro_1.scala | 2 +- tests/run-macros/i4734/Macro_1.scala | 6 +- tests/run-macros/i4735/Macro_1.scala | 4 +- tests/run-macros/i4803/Macro_1.scala | 4 +- tests/run-macros/i4803b/Macro_1.scala | 4 +- tests/run-macros/i4803c/Macro_1.scala | 4 +- tests/run-macros/i4803e/Macro_1.scala | 2 +- tests/run-macros/i4803f/Macro_1.scala | 4 +- tests/run-macros/i4947e/Macro_1.scala | 2 +- tests/run-macros/i4947f/Macro_1.scala | 2 +- tests/run-macros/i5119/Macro_1.scala | 2 +- tests/run-macros/i5119b/Macro_1.scala | 2 +- tests/run-macros/i5188a/Macro_1.scala | 2 +- tests/run-macros/i5533/Macro_1.scala | 2 +- tests/run-macros/i5533b/Macro_1.scala | 2 +- tests/run-macros/i5536/Macro_1.scala | 2 +- tests/run-macros/i5629/Macro_1.scala | 4 +- tests/run-macros/i5715/Macro_1.scala | 2 +- tests/run-macros/i5941/macro_1.scala | 10 +-- tests/run-macros/i6171/Macro_1.scala | 2 +- tests/run-macros/i6201/macro_1.scala | 4 +- tests/run-macros/i6253-b/quoted_1.scala | 2 +- tests/run-macros/i6253-c/quoted_1.scala | 2 +- tests/run-macros/i6253/quoted_1.scala | 2 +- tests/run-macros/i6270/Macro_1.scala | 4 +- tests/run-macros/i6518/Macro_1.scala | 2 +- tests/run-macros/i6679/Macro_1.scala | 4 +- tests/run-macros/i6765-b/Macro_1.scala | 2 +- tests/run-macros/i6765-c/Macro_1.scala | 2 +- tests/run-macros/i6765/Macro_1.scala | 2 +- tests/run-macros/i6772/Macro_1.scala | 4 +- tests/run-macros/i6803/Macro_1.scala | 4 +- tests/run-macros/i6988/FirstArg_1.scala | 2 +- tests/run-macros/i7008/macro_1.scala | 4 +- tests/run-macros/i7025/Macros_1.scala | 2 +- tests/run-macros/i7048/Lib_1.scala | 4 +- tests/run-macros/i7519c/Macro_1.scala | 2 +- tests/run-macros/i7715/Macros_1.scala | 2 +- tests/run-macros/i7716/Macro_1.scala | 4 +- tests/run-macros/i7887/Macro_1.scala | 2 +- tests/run-macros/i7898/Macro_1.scala | 4 +- tests/run-macros/i7964/Macro_1.scala | 2 +- tests/run-macros/i7987/Macros_1.scala | 2 +- tests/run-macros/i8007/Macro_1.scala | 4 +- tests/run-macros/i8007/Macro_2.scala | 6 +- tests/run-macros/i8007/Macro_3.scala | 4 +- tests/run-macros/i8115/Macro_2.scala | 2 +- tests/run-macros/i8115b/Macro_2.scala | 2 +- tests/run-macros/i8514/Macro_1.scala | 2 +- tests/run-macros/i8514b/Macro_1.scala | 2 +- tests/run-macros/i8520/Macro_1.scala | 2 +- tests/run-macros/i8530/Macro_1.scala | 2 +- tests/run-macros/i8671/Macro_1.scala | 2 +- tests/run-macros/i8745/Macro_1.scala | 2 +- tests/run-macros/i8745b/Macro_1.scala | 2 +- tests/run-macros/i8746/Macro_1.scala | 2 +- tests/run-macros/i8746b/Macro_1.scala | 2 +- tests/run-macros/i9206/Macros_1.scala | 2 +- tests/run-macros/i9475/Macro_1.scala | 4 +- tests/run-macros/i9570/Macro_1.scala | 2 +- tests/run-macros/i9812b/Macro_1.scala | 18 +++--- .../inferred-repeated-result/test_1.scala | 2 +- .../inline-case-objects/Macro_1.scala | 2 +- .../inline-macro-inner-object/Macro_1.scala | 6 +- .../Macro_1.scala | 24 +++---- tests/run-macros/inline-option/Macro_1.scala | 4 +- .../run-macros/inline-tuples-1/Macro_1.scala | 44 ++++++------- .../run-macros/inline-tuples-2/Macro_1.scala | 4 +- .../run-macros/inline-varargs-1/Macro_1.scala | 2 +- .../macros-in-same-project1/Foo.scala | 2 +- tests/run-macros/no-symbol/1.scala | 2 +- tests/run-macros/paramSymss/Macro_1.scala | 2 +- tests/run-macros/power-macro/Macro_1.scala | 4 +- .../quote-and-splice/Macros_1.scala | 14 ++-- .../quote-change-owner/Macro_1.scala | 2 +- .../quote-elide-prefix/quoted_1.scala | 2 +- tests/run-macros/quote-force/quoted_1.scala | 2 +- .../quote-implicitMatch/Macro_1.scala | 4 +- .../quote-impure-by-name/quoted_1.scala | 2 +- .../quote-indexed-map-by-name/quoted_1.scala | 2 +- .../quote-inline-function/quoted_1.scala | 2 +- .../quote-matcher-inference/Macro_1.scala | 2 +- .../quote-matcher-power/Macro_1.scala | 6 +- .../quote-matcher-runtime/quoted_1.scala | 2 +- .../quoted_1.scala | 2 +- .../quoted_1.scala | 2 +- .../quoted_1.scala | 2 +- .../quote-matcher-symantics-1/quoted_1.scala | 2 +- .../quote-matcher-symantics-2/quoted_1.scala | 56 ++++++++-------- .../quote-matcher-symantics-3/quoted_1.scala | 10 +-- .../quote-matcher-type-bind/Macro_1.scala | 2 +- .../quote-matching-open/Macro_1.scala | 12 ++-- .../quote-matching-optimize-1/Macro_1.scala | 2 +- .../quote-matching-optimize-2/Macro_1.scala | 2 +- .../quote-matching-optimize-3/Macro_1.scala | 2 +- .../run-macros/quote-sep-comp-2/Macro_1.scala | 2 +- tests/run-macros/quote-sep-comp/Macro_1.scala | 2 +- .../quote-simple-macro/quoted_1.scala | 2 +- .../quote-toExprOfSeq/Macro_1.scala | 2 +- .../quote-toExprOfTuple/Macro_1.scala | 2 +- .../quote-type-matcher-2/quoted_1.scala | 2 +- .../quote-type-matcher/quoted_1.scala | 2 +- .../quote-unrolled-foreach/quoted_1.scala | 4 +- tests/run-macros/quote-whitebox/Macro_1.scala | 2 +- .../quoted-expr-block/quoted_1.scala | 2 +- .../quoted-matching-docs-2/Macro_1.scala | 6 +- .../quoted-matching-docs/Macro_1.scala | 6 +- .../quoted-pattern-open-expr-0/Macro_1.scala | 2 +- .../Macro_1.scala | 2 +- .../quoted-pattern-open-expr/Macro_1.scala | 2 +- .../quoted-pattern-type/Macro_1.scala | 2 +- .../refined-selectable-macro/Macro_1.scala | 4 +- .../refined-selectable-macro/Macro_2.scala | 2 +- tests/run-macros/reflect-dsl/assert_1.scala | 2 +- .../run-macros/reflect-inline/assert_1.scala | 4 +- .../run-macros/reflect-lambda/assert_1.scala | 2 +- .../run-macros/reflect-pos-fun/assert_1.scala | 2 +- .../reflect-select-constructor/assert_1.scala | 2 +- .../reflect-select-copy-2/assert_1.scala | 2 +- .../reflect-select-copy/assert_1.scala | 2 +- .../assert_1.scala | 2 +- .../reflect-select-value-class/assert_1.scala | 2 +- .../reflect-sourceCode/Macro_1.scala | 2 +- .../reflect-typeChecks/assert_1.scala | 2 +- .../run-macros/requiredSymbols/Macro_1.scala | 2 +- .../string-context-implicits/Macro_1.scala | 2 +- .../tasty-argument-tree-1/quoted_1.scala | 2 +- .../tasty-construct-types/Macro_1.scala | 2 +- .../tasty-create-method-symbol/Macro_1.scala | 2 +- tests/run-macros/tasty-dealias/quoted_1.scala | 2 +- .../tasty-definitions-1/quoted_1.scala | 2 +- tests/run-macros/tasty-eval/quoted_1.scala | 8 +-- .../tasty-extractors-1/quoted_1.scala | 2 +- .../tasty-extractors-2/quoted_1.scala | 2 +- .../tasty-extractors-3/quoted_1.scala | 2 +- .../quoted_1.scala | 2 +- .../tasty-extractors-types/quoted_1.scala | 2 +- .../Macro_1.scala | 2 +- .../Macro_1.scala | 4 +- tests/run-macros/tasty-getfile/Macro_1.scala | 2 +- .../Macro_1.scala | 6 +- .../tasty-indexed-map/quoted_1.scala | 2 +- .../tasty-interpolation-1/Macro.scala | 16 ++--- .../tasty-linenumber-2/quoted_1.scala | 2 +- .../tasty-linenumber/quoted_1.scala | 2 +- .../run-macros/tasty-location/quoted_1.scala | 2 +- .../tasty-macro-assert/quoted_1.scala | 2 +- .../tasty-macro-const/quoted_1.scala | 2 +- .../tasty-macro-positions/quoted_1.scala | 8 +-- .../tasty-original-source/Macros_1.scala | 2 +- .../tasty-overload-secondargs/Macro_1.scala | 2 +- .../tasty-positioned/quoted_1.scala | 2 +- .../tasty-seal-method/quoted_1.scala | 4 +- .../tasty-simplified/quoted_1.scala | 2 +- .../Macros_1.scala | 6 +- .../run-macros/tasty-subtyping/quoted_1.scala | 4 +- .../run-macros/tasty-tree-map/quoted_1.scala | 2 +- tests/run-macros/tasty-typeof/Macro_1.scala | 2 +- .../tasty-unsafe-let/quoted_1.scala | 2 +- tests/run-macros/type-show/Macro_1.scala | 2 +- .../xml-interpolation-1/XmlQuote_1.scala | 2 +- .../xml-interpolation-2/XmlQuote_1.scala | 2 +- .../xml-interpolation-3/XmlQuote_1.scala | 2 +- .../xml-interpolation-4/Macros_1.scala | 2 +- .../xml-interpolation-5/Macros_1.scala | 2 +- .../xml-interpolation-6/Macros_1.scala | 2 +- .../xml-interpolation-7/Macros_1.scala | 2 +- tests/run-staging/abstract-int-quote.scala | 6 +- tests/run-staging/expr-matches.scala | 2 +- tests/run-staging/i3823-b.scala | 2 +- tests/run-staging/i3823-c.scala | 2 +- tests/run-staging/i3823.scala | 2 +- tests/run-staging/i3847-b.scala | 4 +- tests/run-staging/i3847.scala | 2 +- tests/run-staging/i3876-b.scala | 8 +-- tests/run-staging/i3876-c.scala | 8 +-- tests/run-staging/i3876-d.scala | 6 +- tests/run-staging/i3876-e.scala | 6 +- tests/run-staging/i3876.scala | 6 +- tests/run-staging/i3946.scala | 4 +- tests/run-staging/i3947b2.scala | 2 +- tests/run-staging/i4044a.scala | 2 +- tests/run-staging/i4044b.scala | 12 ++-- tests/run-staging/i4044c.scala | 2 +- tests/run-staging/i4044e.scala | 2 +- tests/run-staging/i4044f.scala | 2 +- tests/run-staging/i4350.scala | 4 +- tests/run-staging/i4591.scala | 2 +- tests/run-staging/i4730.scala | 2 +- tests/run-staging/i5144.scala | 6 +- tests/run-staging/i5144b.scala | 6 +- tests/run-staging/i5152.scala | 6 +- tests/run-staging/i5161.scala | 6 +- tests/run-staging/i5161b.scala | 6 +- tests/run-staging/i5247.scala | 6 +- tests/run-staging/i5376.scala | 2 +- tests/run-staging/i5965.scala | 16 ++--- tests/run-staging/i5965b.scala | 16 ++--- tests/run-staging/i5997.scala | 2 +- tests/run-staging/i6263.scala | 2 +- tests/run-staging/i6281.scala | 6 +- tests/run-staging/i6754.scala | 4 +- tests/run-staging/i6992/Macro_1.scala | 4 +- tests/run-staging/i7381.scala | 2 +- tests/run-staging/i8178.scala | 2 +- tests/run-staging/i8585.scala | 8 +-- tests/run-staging/inline-quote.scala | 4 +- tests/run-staging/liftables.scala | 2 +- tests/run-staging/multi-staging.check | 4 +- tests/run-staging/multi-staging.scala | 8 +-- tests/run-staging/quote-ackermann-1.scala | 2 +- tests/run-staging/quote-fun-app-1.scala | 8 +-- .../quote-function-applied-to.scala | 2 +- tests/run-staging/quote-lambda.scala | 2 +- tests/run-staging/quote-lib.scala | 20 +++--- tests/run-staging/quote-nested-1.check | 2 +- tests/run-staging/quote-nested-1.scala | 4 +- tests/run-staging/quote-nested-2.check | 6 +- tests/run-staging/quote-nested-2.scala | 4 +- tests/run-staging/quote-nested-3.scala | 2 +- tests/run-staging/quote-nested-4.check | 4 +- tests/run-staging/quote-nested-4.scala | 4 +- tests/run-staging/quote-nested-5.check | 6 +- tests/run-staging/quote-nested-5.scala | 6 +- tests/run-staging/quote-nested-6.scala | 2 +- tests/run-staging/quote-owners-2.scala | 4 +- tests/run-staging/quote-owners.scala | 8 +-- tests/run-staging/quote-run-2.scala | 2 +- tests/run-staging/quote-run-b.scala | 2 +- tests/run-staging/quote-run-c.scala | 4 +- tests/run-staging/quote-run-constants.scala | 4 +- tests/run-staging/quote-run-large.scala | 4 +- tests/run-staging/quote-run-many.scala | 2 +- .../quote-run-staged-interpreter.scala | 14 ++-- .../run-staging/quote-run-with-settings.scala | 4 +- tests/run-staging/quote-run.scala | 4 +- tests/run-staging/quote-simple-hole.scala | 2 +- tests/run-staging/quote-type-matcher.scala | 2 +- .../run-staging/quote-unrolled-foreach.scala | 30 ++++----- tests/run-staging/quote-valueof-list.scala | 2 +- tests/run-staging/quote-valueof.scala | 2 +- tests/run-staging/quote-var.scala | 12 ++-- tests/run-staging/shonan-hmm-simple.scala | 52 +++++++-------- tests/run-staging/shonan-hmm/Complex.scala | 4 +- tests/run-staging/shonan-hmm/Lifters.scala | 4 +- tests/run-staging/shonan-hmm/MVmult.scala | 28 ++++---- tests/run-staging/shonan-hmm/PV.scala | 6 +- tests/run-staging/shonan-hmm/Ring.scala | 8 +-- tests/run-staging/shonan-hmm/Test.scala | 2 +- .../run-staging/shonan-hmm/UnrolledExpr.scala | 8 +-- tests/run-staging/shonan-hmm/VecOp.scala | 2 +- tests/run-staging/shonan-hmm/VecROp.scala | 8 +-- tests/run-staging/shonan-hmm/Vmults.scala | 2 +- tests/run-staging/staged-streams_1.scala | 48 +++++++------- .../staged-tuples/StagedTuple.scala | 20 +++--- .../quoted_1.scala | 16 ++--- tests/run-staging/unliftables.scala | 2 +- 651 files changed, 1389 insertions(+), 1387 deletions(-) rename compiler/src/scala/quoted/runtime/impl/{QuoteContextImpl.scala => QuotesImpl.scala} (97%) rename library/src/scala/quoted/{QuoteContext.scala => Quotes.scala} (99%) diff --git a/community-build/community-projects/PPrint b/community-build/community-projects/PPrint index bb3f91fe9aa6..cd3ccb07dedc 160000 --- a/community-build/community-projects/PPrint +++ b/community-build/community-projects/PPrint @@ -1 +1 @@ -Subproject commit bb3f91fe9aa68450c873722a19d788081d930030 +Subproject commit cd3ccb07dedc9f5ce191b7acee5029da262b8257 diff --git a/community-build/community-projects/dotty-cps-async b/community-build/community-projects/dotty-cps-async index df8b03d97cd4..3ab2f588f717 160000 --- a/community-build/community-projects/dotty-cps-async +++ b/community-build/community-projects/dotty-cps-async @@ -1 +1 @@ -Subproject commit df8b03d97cd441fda5d3409d19d9100363c44055 +Subproject commit 3ab2f588f7174784df6ae47f34362fa6976bc567 diff --git a/community-build/community-projects/intent b/community-build/community-projects/intent index a7c71df19b7e..7b8158ddf60b 160000 --- a/community-build/community-projects/intent +++ b/community-build/community-projects/intent @@ -1 +1 @@ -Subproject commit a7c71df19b7e2003986df01ea882d75a36b9a388 +Subproject commit 7b8158ddf60bacf6689367066cf202d03fc25fde diff --git a/community-build/community-projects/minitest b/community-build/community-projects/minitest index a9dce860ed53..e14209a60ea5 160000 --- a/community-build/community-projects/minitest +++ b/community-build/community-projects/minitest @@ -1 +1 @@ -Subproject commit a9dce860ed5346b15bf28a35681ba18989ed2cb6 +Subproject commit e14209a60ea5de95110cc12adc430e78847cc027 diff --git a/community-build/community-projects/munit b/community-build/community-projects/munit index b32f594f3bcd..e26d260c1d0b 160000 --- a/community-build/community-projects/munit +++ b/community-build/community-projects/munit @@ -1 +1 @@ -Subproject commit b32f594f3bcd78e4784439fb7099939ac3b5eb68 +Subproject commit e26d260c1d0b11aeca7c353516005ad5903029e8 diff --git a/community-build/community-projects/scalatest b/community-build/community-projects/scalatest index fe5d1697c939..6d2b032ad962 160000 --- a/community-build/community-projects/scalatest +++ b/community-build/community-projects/scalatest @@ -1 +1 @@ -Subproject commit fe5d1697c93969996a207e2b02c47b97d89bb8dd +Subproject commit 6d2b032ad9629ac8d0e4fa1b147f00cca4000b33 diff --git a/community-build/community-projects/scodec-bits b/community-build/community-projects/scodec-bits index 61a0b9fc2fff..9ed683efcfd8 160000 --- a/community-build/community-projects/scodec-bits +++ b/community-build/community-projects/scodec-bits @@ -1 +1 @@ -Subproject commit 61a0b9fc2ffff9686207a0c2f15ca1377a3302d3 +Subproject commit 9ed683efcfd8bcae8cfe484224c1b0da18d409a4 diff --git a/community-build/community-projects/shapeless b/community-build/community-projects/shapeless index 1e4d28e12755..5f5e650cbabc 160000 --- a/community-build/community-projects/shapeless +++ b/community-build/community-projects/shapeless @@ -1 +1 @@ -Subproject commit 1e4d28e12755ede23e8e2e3ad6077e69bd4d4e8e +Subproject commit 5f5e650cbabcef5e976434665f936c624117d937 diff --git a/community-build/community-projects/sourcecode b/community-build/community-projects/sourcecode index 10375294d6de..d6a585fa5d9d 160000 --- a/community-build/community-projects/sourcecode +++ b/community-build/community-projects/sourcecode @@ -1 +1 @@ -Subproject commit 10375294d6de6b49485dd2b7bacac3e007095c89 +Subproject commit d6a585fa5d9df236a74195e7bfcff8ca7200eb2a diff --git a/community-build/community-projects/upickle b/community-build/community-projects/upickle index be1d0ee4287e..3a40b5ec7b16 160000 --- a/community-build/community-projects/upickle +++ b/community-build/community-projects/upickle @@ -1 +1 @@ -Subproject commit be1d0ee4287e2b3c1b8f92670fe5c5ee14758faa +Subproject commit 3a40b5ec7b167aa69b533d9dfe2e0288f3df82d7 diff --git a/community-build/community-projects/utest b/community-build/community-projects/utest index 7662ed1dd428..755eea98afcc 160000 --- a/community-build/community-projects/utest +++ b/community-build/community-projects/utest @@ -1 +1 @@ -Subproject commit 7662ed1dd428e641fdc3323a3521cecca28c388a +Subproject commit 755eea98afcce574724a0eb77b949ef6bed74b34 diff --git a/community-build/community-projects/xml-interpolator b/community-build/community-projects/xml-interpolator index cdddcc8e447e..21fb73a386f2 160000 --- a/community-build/community-projects/xml-interpolator +++ b/community-build/community-projects/xml-interpolator @@ -1 +1 @@ -Subproject commit cdddcc8e447e998fb9ff84692d03879301c2c6f7 +Subproject commit 21fb73a386f2bce72d5c532b039661e02c0a32ad diff --git a/community-build/sbt-scalajs-sbt b/community-build/sbt-scalajs-sbt index 1a1034041a18..8f1d0ac9bcc4 100644 --- a/community-build/sbt-scalajs-sbt +++ b/community-build/sbt-scalajs-sbt @@ -1 +1 @@ -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1") diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala index d2807152ddf8..5a7a27be15df 100644 --- a/compiler/src/dotty/tools/dotc/core/Definitions.scala +++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala @@ -797,7 +797,7 @@ class Definitions { @tu lazy val QuotedExprClass: ClassSymbol = requiredClass("scala.quoted.Expr") @tu lazy val QuotedExprModule: Symbol = QuotedExprClass.companionModule - @tu lazy val QuoteContextClass: ClassSymbol = requiredClass("scala.quoted.QuoteContext") + @tu lazy val QuotesClass: ClassSymbol = requiredClass("scala.quoted.Quotes") @tu lazy val QuoteUnpicklerClass: ClassSymbol = requiredClass("scala.quoted.runtime.QuoteUnpickler") @tu lazy val QuoteUnpickler_unpickleExpr: Symbol = QuoteUnpicklerClass.requiredMethod("unpickleExpr") diff --git a/compiler/src/dotty/tools/dotc/core/StagingContext.scala b/compiler/src/dotty/tools/dotc/core/StagingContext.scala index 25de93d44d5a..9fbb009f6e5f 100644 --- a/compiler/src/dotty/tools/dotc/core/StagingContext.scala +++ b/compiler/src/dotty/tools/dotc/core/StagingContext.scala @@ -17,9 +17,9 @@ object StagingContext { private val QuotationLevel = new Property.Key[Int] /** A key to be used in a context property that tracks the quoteation stack. - * Stack containing the QuoteContext references recieved by the surrounding quotes. + * Stack containing the Quotes references recieved by the surrounding quotes. */ - private val QuoteContextStack = new Property.Key[List[tpd.Tree]] + private val QuotesStack = new Property.Key[List[tpd.Tree]] private val TaggedTypes = new Property.Key[PCPCheckAndHeal.QuoteTypeTags] @@ -31,11 +31,11 @@ object StagingContext { def quoteContext(using Context): Context = ctx.fresh.setProperty(QuotationLevel, level + 1) - /** Context with an incremented quotation level and pushes a refecence to a QuoteContext on the quote context stack */ - def pushQuoteContext(qctxRef: tpd.Tree)(using Context): Context = - val old = ctx.property(QuoteContextStack).getOrElse(List.empty) + /** Context with an incremented quotation level and pushes a refecence to a Quotes on the quote context stack */ + def pushQuotes(qctxRef: tpd.Tree)(using Context): Context = + val old = ctx.property(QuotesStack).getOrElse(List.empty) ctx.fresh.setProperty(QuotationLevel, level + 1) - .setProperty(QuoteContextStack, qctxRef :: old) + .setProperty(QuotesStack, qctxRef :: old) /** Context with a decremented quotation level. */ def spliceContext(using Context): Context = @@ -50,12 +50,12 @@ object StagingContext { /** Context with a decremented quotation level and pops the Some of top of the quote context stack or None if the stack is empty. * The quotation stack could be empty if we are in a top level splice or an eroneous splice directly witin a top level splice. */ - def popQuoteContext()(using Context): (Option[tpd.Tree], Context) = + def popQuotes()(using Context): (Option[tpd.Tree], Context) = val ctx1 = ctx.fresh.setProperty(QuotationLevel, level - 1) val head = - ctx.property(QuoteContextStack) match + ctx.property(QuotesStack) match case Some(x :: xs) => - ctx1.setProperty(QuoteContextStack, xs) + ctx1.setProperty(QuotesStack, xs) Some(x) case _ => None // Splice at level 0 or lower diff --git a/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala b/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala index 5f713d8db469..978ebb4416e3 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/DecompilationPrinter.scala @@ -11,7 +11,7 @@ import dotty.tools.dotc.core.Phases.Phase import dotty.tools.dotc.core.tasty.TastyPrinter import dotty.tools.io.File -import scala.quoted.runtime.impl.QuoteContextImpl +import scala.quoted.runtime.impl.QuotesImpl /** Phase that prints the trees in all loaded compilation units. * @@ -45,7 +45,7 @@ class DecompilationPrinter extends Phase { else { val unitFile = unit.source.toString.replace("\\", "/").replace(".class", ".tasty") out.println(s"/** Decompiled from $unitFile */") - out.println(QuoteContextImpl.showDecompiledTree(unit.tpdTree)) + out.println(QuotesImpl.showDecompiledTree(unit.tpdTree)) } } } diff --git a/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala b/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala index 68c5a2c87e56..b738a294d1f0 100644 --- a/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala +++ b/compiler/src/dotty/tools/dotc/decompiler/IDEDecompilerDriver.scala @@ -7,7 +7,7 @@ import dotty.tools.dotc.core._ import dotty.tools.dotc.core.tasty.TastyHTMLPrinter import dotty.tools.dotc.reporting._ -import scala.quoted.runtime.impl.QuoteContextImpl +import scala.quoted.runtime.impl.QuotesImpl /** * Decompiler to be used with IDEs @@ -35,7 +35,7 @@ class IDEDecompilerDriver(val settings: List[String]) extends dotc.Driver { run.printSummary() val unit = ctx.run.units.head - val decompiled = QuoteContextImpl.showDecompiledTree(unit.tpdTree) + val decompiled = QuotesImpl.showDecompiledTree(unit.tpdTree) val tree = new TastyHTMLPrinter(unit.pickled.head._2()).showContents() reporter.removeBufferedMessages.foreach(message => System.err.println(message)) diff --git a/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala b/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala index ea6dd84f9f8f..d3c91f12bfb6 100644 --- a/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala +++ b/compiler/src/dotty/tools/dotc/quoted/PickledQuotes.scala @@ -19,7 +19,7 @@ import dotty.tools.dotc.report import scala.reflect.ClassTag -import scala.quoted.QuoteContext +import scala.quoted.Quotes import scala.quoted.runtime.impl._ import scala.collection.mutable @@ -41,19 +41,19 @@ object PickledQuotes { /** Transform the expression into its fully spliced Tree */ def quotedExprToTree[T](expr: quoted.Expr[T])(using Context): Tree = { val expr1 = expr.asInstanceOf[ExprImpl] - expr1.checkScopeId(QuoteContextImpl.scopeId) + expr1.checkScopeId(QuotesImpl.scopeId) changeOwnerOfTree(expr1.tree, ctx.owner) } /** Transform the expression into its fully spliced TypeTree */ def quotedTypeToTree(tpe: quoted.Type[?])(using Context): Tree = { val tpe1 = tpe.asInstanceOf[TypeImpl] - tpe1.checkScopeId(QuoteContextImpl.scopeId) + tpe1.checkScopeId(QuotesImpl.scopeId) changeOwnerOfTree(tpe1.typeTree, ctx.owner) } /** Unpickle the tree contained in the TastyExpr */ - def unpickleTerm(pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?])(using Context): Tree = { + def unpickleTerm(pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.Quotes) => scala.quoted.Expr[?])(using Context): Tree = { val unpickled = withMode(Mode.ReadPositions)(unpickle(pickled, isType = false)) val Inlined(call, Nil, expnasion) = unpickled val inlineCtx = inlineContext(call) @@ -63,22 +63,22 @@ object PickledQuotes { } /** Unpickle the tree contained in the TastyType */ - def unpickleTypeTree(pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?])(using Context): Tree = { + def unpickleTypeTree(pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.Quotes) => scala.quoted.Expr[?])(using Context): Tree = { val unpickled = withMode(Mode.ReadPositions)(unpickle(pickled, isType = true)) spliceTypes(unpickled, typeHole, termHole) } /** Replace all term holes with the spliced terms */ - private def spliceTerms(tree: Tree, typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?])(using Context): Tree = { + private def spliceTerms(tree: Tree, typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.Quotes) => scala.quoted.Expr[?])(using Context): Tree = { val evaluateHoles = new TreeMap { override def transform(tree: tpd.Tree)(using Context): tpd.Tree = tree match { case Hole(isTerm, idx, args) => val reifiedArgs = args.map { arg => - if (arg.isTerm) (using qctx: QuoteContext) => new ExprImpl(arg, QuoteContextImpl.scopeId) - else new TypeImpl(arg, QuoteContextImpl.scopeId) + if (arg.isTerm) (using q: Quotes) => new ExprImpl(arg, QuotesImpl.scopeId) + else new TypeImpl(arg, QuotesImpl.scopeId) } if isTerm then - val quotedExpr = termHole(idx, reifiedArgs, QuoteContextImpl()) + val quotedExpr = termHole(idx, reifiedArgs, QuotesImpl()) val filled = PickledQuotes.quotedExprToTree(quotedExpr) // We need to make sure a hole is created with the source file of the surrounding context, even if @@ -123,7 +123,7 @@ object PickledQuotes { } /** Replace all type holes generated with the spliced types */ - private def spliceTypes(tree: Tree, typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Int], scala.quoted.QuoteContext) => Any)(using Context): Tree = { + private def spliceTypes(tree: Tree, typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Int], scala.quoted.Quotes) => Any)(using Context): Tree = { tree match case Block(stat :: rest, expr1) if stat.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot) => val typeSpliceMap = (stat :: rest).iterator.map { diff --git a/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala b/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala index d41b7dc2ab63..52b9e53b73c0 100644 --- a/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala +++ b/compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala @@ -54,7 +54,7 @@ import scala.annotation.constructorOnly * typeHole = (idx: Int, args: List[Any]) => idx match { * case 0 => ... * }, - * termHole = (idx: Int, args: List[Any], qctx: QuoteContext) => idx match { + * termHole = (idx: Int, args: List[Any], qctx: Quotes) => idx match { * case 0 => ... * ... * case => @@ -159,7 +159,7 @@ class PickleQuotes extends MacroTransform { */ def pickleAsLiteral(lit: Literal) = { val exprType = defn.QuotedExprClass.typeRef.appliedTo(body.tpe) - val lambdaTpe = MethodType(defn.QuoteContextClass.typeRef :: Nil, exprType) + val lambdaTpe = MethodType(defn.QuotesClass.typeRef :: Nil, exprType) def mkConst(ts: List[Tree]) = { val reflect = ts.head.select("reflect".toTermName) val typeName = body.tpe.typeSymbol.name @@ -239,7 +239,7 @@ class PickleQuotes extends MacroTransform { else Lambda( MethodType( - List(defn.IntType, defn.SeqType.appliedTo(defn.AnyType), defn.QuoteContextClass.typeRef), + List(defn.IntType, defn.SeqType.appliedTo(defn.AnyType), defn.QuotesClass.typeRef), defn.QuotedExprClass.typeRef.appliedTo(defn.AnyType)), args => { val cases = termSplices.map { case (splice, idx) => @@ -253,7 +253,7 @@ class PickleQuotes extends MacroTransform { val quoteClass = if isType then defn.QuotedTypeClass else defn.QuotedExprClass val quotedType = quoteClass.typeRef.appliedTo(originalTp) - val lambdaTpe = MethodType(defn.QuoteContextClass.typeRef :: Nil, quotedType) + val lambdaTpe = MethodType(defn.QuotesClass.typeRef :: Nil, quotedType) def callUnpickle(ts: List[Tree]) = { val qctx = ts.head.asInstance(defn.QuoteUnpicklerClass.typeRef) val unpickleMeth = if isType then defn.QuoteUnpickler_unpickleType else defn.QuoteUnpickler_unpickleExpr @@ -275,7 +275,7 @@ class PickleQuotes extends MacroTransform { def taggedType() = val typeType = defn.QuotedTypeClass.typeRef.appliedTo(body.tpe) val classTree = TypeApply(ref(defn.Predef_classOf.termRef), body :: Nil) - val lambdaTpe = MethodType(defn.QuoteContextClass.typeRef :: Nil, typeType) + val lambdaTpe = MethodType(defn.QuotesClass.typeRef :: Nil, typeType) def callTypeConstructorOf(ts: List[Tree]) = { val reflect = ts.head.select("reflect".toTermName) val typeRepr = reflect.select("TypeRepr".toTermName).select("typeConstructorOf".toTermName).appliedTo(classTree) @@ -370,7 +370,7 @@ class PickleQuotes extends MacroTransform { assert(tpw.isInstanceOf[ValueType]) val argTpe = if (tree.isType) defn.QuotedTypeClass.typeRef.appliedTo(tpw) - else defn.FunctionType(1, isContextual = true).appliedTo(defn.QuoteContextClass.typeRef, defn.QuotedExprClass.typeRef.appliedTo(tpw)) + else defn.FunctionType(1, isContextual = true).appliedTo(defn.QuotesClass.typeRef, defn.QuotedExprClass.typeRef.appliedTo(tpw)) val selectArg = arg.select(nme.apply).appliedTo(Literal(Constant(i))).cast(argTpe) val capturedArg = SyntheticValDef(UniqueName.fresh(tree.symbol.name.toTermName).toTermName, selectArg) i += 1 diff --git a/compiler/src/dotty/tools/dotc/transform/Splicer.scala b/compiler/src/dotty/tools/dotc/transform/Splicer.scala index 3abbeed9d6bf..fdf704dc63d7 100644 --- a/compiler/src/dotty/tools/dotc/transform/Splicer.scala +++ b/compiler/src/dotty/tools/dotc/transform/Splicer.scala @@ -26,7 +26,7 @@ import scala.reflect.ClassTag import dotty.tools.dotc.quoted.{PickledQuotes, QuoteUtils} -import scala.quoted.QuoteContext +import scala.quoted.Quotes import scala.quoted.runtime.impl._ /** Utility class to splice quoted expressions */ @@ -51,8 +51,8 @@ object Splicer { val interpreter = new Interpreter(pos, classLoader) // Some parts of the macro are evaluated during the unpickling performed in quotedExprToTree - val interpretedExpr = interpreter.interpret[QuoteContext => scala.quoted.Expr[Any]](tree) - val interpretedTree = interpretedExpr.fold(tree)(macroClosure => PickledQuotes.quotedExprToTree(macroClosure(QuoteContextImpl()))) + val interpretedExpr = interpreter.interpret[Quotes => scala.quoted.Expr[Any]](tree) + val interpretedTree = interpretedExpr.fold(tree)(macroClosure => PickledQuotes.quotedExprToTree(macroClosure(QuotesImpl()))) checkEscapedVariables(interpretedTree, macroOwner) } finally { @@ -325,10 +325,10 @@ object Splicer { } private def interpretQuote(tree: Tree)(implicit env: Env): Object = - new ExprImpl(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuoteContextImpl.scopeId) + new ExprImpl(Inlined(EmptyTree, Nil, QuoteUtils.changeOwnerOfTree(tree, ctx.owner)).withSpan(tree.span), QuotesImpl.scopeId) private def interpretTypeQuote(tree: Tree)(implicit env: Env): Object = - new TypeImpl(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuoteContextImpl.scopeId) + new TypeImpl(QuoteUtils.changeOwnerOfTree(tree, ctx.owner), QuotesImpl.scopeId) private def interpretLiteral(value: Any)(implicit env: Env): Object = value.asInstanceOf[Object] diff --git a/compiler/src/dotty/tools/dotc/transform/TreeMapWithStages.scala b/compiler/src/dotty/tools/dotc/transform/TreeMapWithStages.scala index a1ae110990f7..703369234d4a 100644 --- a/compiler/src/dotty/tools/dotc/transform/TreeMapWithStages.scala +++ b/compiler/src/dotty/tools/dotc/transform/TreeMapWithStages.scala @@ -109,7 +109,7 @@ abstract class TreeMapWithStages(@constructorOnly ictx: Context) extends TreeMap try dropEmptyBlocks(quotedTree) match { case Spliced(t) => // '{ $x } --> x - // and adapt the refinment of `QuoteContext { type tasty: ... } ?=> Expr[T]` + // and adapt the refinment of `Quotes { type tasty: ... } ?=> Expr[T]` transform(t).asInstance(tree.tpe) case _ => transformQuotation(quotedTree, tree) } diff --git a/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala b/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala index bf5c6fbba441..330d62ae618b 100644 --- a/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala +++ b/compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala @@ -49,12 +49,12 @@ trait QuotesAndSplices { report.warning("Canceled splice directly inside a quote. '[ ${ XYZ } ] is equivalent to XYZ.", tree.srcPos) case _ => } - val qctx = inferImplicitArg(defn.QuoteContextClass.typeRef, tree.span) + val qctx = inferImplicitArg(defn.QuotesClass.typeRef, tree.span) if qctx.tpe.isInstanceOf[SearchFailureType] then - report.error(missingArgMsg(qctx, defn.QuoteContextClass.typeRef, ""), ctx.source.atSpan(tree.span)) + report.error(missingArgMsg(qctx, defn.QuotesClass.typeRef, ""), ctx.source.atSpan(tree.span)) else if !qctx.tpe.isStable then - report.error(em"Quotes require stable QuoteContext, but found non stable $qctx", qctx.srcPos) + report.error(em"Quotes require stable Quotes, but found non stable $qctx", qctx.srcPos) val tree1 = if ctx.mode.is(Mode.Pattern) then @@ -65,7 +65,7 @@ trait QuotesAndSplices { else report.warning(msg, tree.srcPos) typedTypeApply(untpd.TypeApply(untpd.ref(defn.QuotedTypeModule_of.termRef), tree.quoted :: Nil), pt)(using quoteContext).select(nme.apply).appliedTo(qctx) else - typedApply(untpd.Apply(untpd.ref(defn.QuotedRuntime_exprQuote.termRef), tree.quoted), pt)(using pushQuoteContext(qctx)).select(nme.apply).appliedTo(qctx) + typedApply(untpd.Apply(untpd.ref(defn.QuotedRuntime_exprQuote.termRef), tree.quoted), pt)(using pushQuotes(qctx)).select(nme.apply).appliedTo(qctx) tree1.withSpan(tree.span) } @@ -103,7 +103,7 @@ trait QuotesAndSplices { markAsMacro(ctx) } - val (outerQctx, ctx1) = popQuoteContext() + val (outerQctx, ctx1) = popQuotes() val internalSplice = outerQctx match diff --git a/compiler/src/scala/quoted/runtime/impl/Matcher.scala b/compiler/src/scala/quoted/runtime/impl/Matcher.scala index 440ef84eb459..285b2c19c6c5 100644 --- a/compiler/src/scala/quoted/runtime/impl/Matcher.scala +++ b/compiler/src/scala/quoted/runtime/impl/Matcher.scala @@ -96,7 +96,7 @@ import scala.annotation.{Annotation, compileTimeOnly} */ object Matcher { - abstract class QuoteMatcher[QCtx <: QuoteContext & Singleton](val qctx: QCtx) { + abstract class QuoteMatcher[QCtx <: Quotes & Singleton](val qctx: QCtx) { // TODO improve performance diff --git a/compiler/src/scala/quoted/runtime/impl/QuoteContextImpl.scala b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala similarity index 97% rename from compiler/src/scala/quoted/runtime/impl/QuoteContextImpl.scala rename to compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala index 8c437b1832ff..57e76e5545b7 100644 --- a/compiler/src/scala/quoted/runtime/impl/QuoteContextImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala @@ -21,15 +21,15 @@ import scala.quoted.runtime.impl.printers._ import scala.reflect.TypeTest -object QuoteContextImpl { +object QuotesImpl { type ScopeId = Int - def apply()(using Context): QuoteContext = - new QuoteContextImpl + def apply()(using Context): Quotes = + new QuotesImpl def showDecompiledTree(tree: tpd.Tree)(using Context): String = { - val qctx: QuoteContextImpl = new QuoteContextImpl(using MacroExpansion.context(tree)) + val qctx: QuotesImpl = new QuotesImpl(using MacroExpansion.context(tree)) if ctx.settings.color.value == "always" then qctx.reflect.TreeMethodsImpl.temporaryShowAnsiColored(tree) else @@ -43,7 +43,7 @@ object QuoteContextImpl { } -class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, QuoteUnpickler, QuoteMatching: +class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler, QuoteMatching: private val yCheck: Boolean = ctx.settings.Ycheck.value(using ctx).exists(x => x == "all" || x == "macros") @@ -92,11 +92,11 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu def pos: Position = self.sourcePos def symbol: Symbol = self.symbol def showExtractors: String = - Extractors.showTree(using QuoteContextImpl.this)(self) + Extractors.showTree(using QuotesImpl.this)(self) def show: String = - SourceCode.showTree(using QuoteContextImpl.this)(self)(SyntaxHighlight.plain) + SourceCode.showTree(using QuotesImpl.this)(self)(SyntaxHighlight.plain) def showAnsiColored: String = - SourceCode.showTree(using QuoteContextImpl.this)(self)(SyntaxHighlight.ANSI) + SourceCode.showTree(using QuotesImpl.this)(self)(SyntaxHighlight.ANSI) def isExpr: Boolean = self match case TermTypeTest(self) => @@ -106,7 +106,7 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu case _ => false def asExpr: scala.quoted.Expr[Any] = if self.isExpr then - new ExprImpl(self, QuoteContextImpl.this.hashCode) + new ExprImpl(self, QuotesImpl.this.hashCode) else self match case TermTypeTest(self) => throw new Exception("Expected an expression. This is a partially applied Term. Try eta-expanding the term first.") case _ => throw new Exception("Expected a Term but was: " + self) @@ -114,7 +114,7 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu extension [T](self: Tree) def asExprOf(using tp: scala.quoted.Type[T]): scala.quoted.Expr[T] = - QuoteContextImpl.this.asExprOf[T](self.asExpr)(using tp) + QuotesImpl.this.asExprOf[T](self.asExpr)(using tp) end extension extension [ThisTree <: Tree](self: ThisTree): @@ -332,7 +332,7 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu object Term extends TermModule: def of(expr: Expr[Any]): Term = val exprImpl = expr.asInstanceOf[ExprImpl] - exprImpl.checkScopeId(QuoteContextImpl.this.hashCode) + exprImpl.checkScopeId(QuotesImpl.this.hashCode) exprImpl.tree def betaReduce(tree: Term): Option[Term] = @@ -352,11 +352,11 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu object TermMethodsImpl extends TermMethods: extension (self: Term): def seal: scala.quoted.Expr[Any] = - if self.isExpr then new ExprImpl(self, QuoteContextImpl.this.hashCode) + if self.isExpr then new ExprImpl(self, QuotesImpl.this.hashCode) else throw new Exception("Cannot seal a partially applied Term. Try eta-expanding the term first.") def sealOpt: Option[scala.quoted.Expr[Any]] = - if self.isExpr then Some(new ExprImpl(self, QuoteContextImpl.this.hashCode)) + if self.isExpr then Some(new ExprImpl(self, QuotesImpl.this.hashCode)) else None def tpe: TypeRepr = self.tpe @@ -1564,18 +1564,18 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu object TypeReprMethodsImpl extends TypeReprMethods: extension (self: TypeRepr): def showExtractors: String = - Extractors.showType(using QuoteContextImpl.this)(self) + Extractors.showType(using QuotesImpl.this)(self) def show: String = - SourceCode.showType(using QuoteContextImpl.this)(self)(SyntaxHighlight.plain) + SourceCode.showType(using QuotesImpl.this)(self)(SyntaxHighlight.plain) def showAnsiColored: String = - SourceCode.showType(using QuoteContextImpl.this)(self)(SyntaxHighlight.ANSI) + SourceCode.showType(using QuotesImpl.this)(self)(SyntaxHighlight.ANSI) def seal: scala.quoted.Type[_] = self.asType def asType: scala.quoted.Type[?] = - new TypeImpl(Inferred(self), QuoteContextImpl.this.hashCode) + new TypeImpl(Inferred(self), QuotesImpl.this.hashCode) def =:=(that: TypeRepr): Boolean = self =:= that def <:<(that: TypeRepr): Boolean = self <:< that @@ -2129,11 +2129,11 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu extension (self: Constant): def value: Any = self.value def showExtractors: String = - Extractors.showConstant(using QuoteContextImpl.this)(self) + Extractors.showConstant(using QuotesImpl.this)(self) def show: String = - SourceCode.showConstant(using QuoteContextImpl.this)(self)(SyntaxHighlight.plain) + SourceCode.showConstant(using QuotesImpl.this)(self)(SyntaxHighlight.plain) def showAnsiColored: String = - SourceCode.showConstant(using QuoteContextImpl.this)(self)(SyntaxHighlight.ANSI) + SourceCode.showConstant(using QuotesImpl.this)(self)(SyntaxHighlight.ANSI) end extension end ConstantMethodsImpl @@ -2335,11 +2335,11 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu def children: List[Symbol] = self.denot.children def showExtractors: String = - Extractors.showSymbol(using QuoteContextImpl.this)(self) + Extractors.showSymbol(using QuotesImpl.this)(self) def show: String = - SourceCode.showSymbol(using QuoteContextImpl.this)(self)(SyntaxHighlight.plain) + SourceCode.showSymbol(using QuotesImpl.this)(self)(SyntaxHighlight.plain) def showAnsiColored: String = - SourceCode.showSymbol(using QuoteContextImpl.this)(self)(SyntaxHighlight.ANSI) + SourceCode.showSymbol(using QuotesImpl.this)(self)(SyntaxHighlight.ANSI) end extension @@ -2473,11 +2473,11 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu def |(that: Flags): Flags = dotc.core.Flags.or(self, that) // TODO: Replace with dotc.core.Flags.|(self)(that) once extension names have stabilized def &(that: Flags): Flags = dotc.core.Flags.and(self, that)// TODO: Replace with dotc.core.Flags.&(self)(that) once extension names have stabilized def showExtractors: String = - Extractors.showFlags(using QuoteContextImpl.this)(self) + Extractors.showFlags(using QuotesImpl.this)(self) def show: String = - SourceCode.showFlags(using QuoteContextImpl.this)(self)(SyntaxHighlight.plain) + SourceCode.showFlags(using QuotesImpl.this)(self)(SyntaxHighlight.plain) def showAnsiColored: String = - SourceCode.showFlags(using QuoteContextImpl.this)(self)(SyntaxHighlight.ANSI) + SourceCode.showFlags(using QuotesImpl.this)(self)(SyntaxHighlight.ANSI) end extension end FlagsMethodsImpl @@ -2600,11 +2600,11 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu end reflect - def unpickleExpr[T](pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?]): scala.quoted.Expr[T] = + def unpickleExpr[T](pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.Quotes) => scala.quoted.Expr[?]): scala.quoted.Expr[T] = val tree = PickledQuotes.unpickleTerm(pickled, typeHole, termHole) new ExprImpl(tree, hash).asInstanceOf[scala.quoted.Expr[T]] - def unpickleType[T <: AnyKind](pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.QuoteContext) => scala.quoted.Expr[?]): scala.quoted.Type[T] = + def unpickleType[T <: AnyKind](pickled: String | List[String], typeHole: (Int, Seq[Any]) => scala.quoted.Type[?], termHole: (Int, Seq[Any], scala.quoted.Quotes) => scala.quoted.Expr[?]): scala.quoted.Type[T] = val tree = PickledQuotes.unpickleTypeTree(pickled, typeHole, termHole) new TypeImpl(tree, hash).asInstanceOf[scala.quoted.Type[T]] @@ -2649,7 +2649,7 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu ctx1.gadt.addToConstraint(typeHoles) ctx1 - val qctx1 = QuoteContextImpl()(using ctx1) + val qctx1 = QuotesImpl()(using ctx1) val matcher = new Matcher.QuoteMatcher[qctx1.type](qctx1) { def patternHoleSymbol: qctx1.reflect.Symbol = dotc.core.Symbols.defn.QuotedRuntimePatterns_patternHole.asInstanceOf @@ -2673,7 +2673,7 @@ class QuoteContextImpl private (using val ctx: Context) extends QuoteContext, Qu } } - private[this] val hash = QuoteContextImpl.scopeId(using ctx) + private[this] val hash = QuotesImpl.scopeId(using ctx) override def hashCode: Int = hash -end QuoteContextImpl +end QuotesImpl diff --git a/compiler/src/scala/quoted/runtime/impl/TypeImpl.scala b/compiler/src/scala/quoted/runtime/impl/TypeImpl.scala index 398103b92666..537c90a5a881 100644 --- a/compiler/src/scala/quoted/runtime/impl/TypeImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/TypeImpl.scala @@ -14,7 +14,7 @@ final class TypeImpl(val typeTree: tpd.Tree, val scopeId: Int) extends Type[?] { } /** View this expression `quoted.Type[T]` as a `TypeTree` */ - def unseal(using qctx: QuoteContext): qctx.reflect.TypeTree = + def unseal(using Quotes): qctx.reflect.TypeTree = checkScopeId(qctx.hashCode) typeTree.asInstanceOf[qctx.reflect.TypeTree] diff --git a/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala b/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala index 2de06f2c4e90..55c9979da0d9 100644 --- a/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala +++ b/compiler/src/scala/quoted/runtime/impl/printers/Extractors.scala @@ -5,19 +5,19 @@ import scala.quoted._ object Extractors { - def showTree(using QuoteContext)(tree: qctx.reflect.Tree): String = + def showTree(using Quotes)(tree: qctx.reflect.Tree): String = new ExtractorsPrinter[qctx.type]().visitTree(tree).result() - def showType(using QuoteContext)(tpe: qctx.reflect.TypeRepr): String = + def showType(using Quotes)(tpe: qctx.reflect.TypeRepr): String = new ExtractorsPrinter[qctx.type]().visitType(tpe).result() - def showConstant(using QuoteContext)(const: qctx.reflect.Constant): String = + def showConstant(using Quotes)(const: qctx.reflect.Constant): String = new ExtractorsPrinter[qctx.type]().visitConstant(const).result() - def showSymbol(using QuoteContext)(symbol: qctx.reflect.Symbol): String = + def showSymbol(using Quotes)(symbol: qctx.reflect.Symbol): String = new ExtractorsPrinter[qctx.type]().visitSymbol(symbol).result() - def showFlags(using QuoteContext)(flags: qctx.reflect.Flags): String = { + def showFlags(using Quotes)(flags: qctx.reflect.Flags): String = { import qctx.reflect._ val flagList = List.newBuilder[String] if (flags.is(Flags.Abstract)) flagList += "Flags.Abstract" @@ -57,7 +57,7 @@ object Extractors { flagList.result().mkString(" | ") } - private class ExtractorsPrinter[QCtx <: QuoteContext & Singleton](using val qctx: QCtx) { self => + private class ExtractorsPrinter[QCtx <: Quotes & Singleton](using val qctx: QCtx) { self => import qctx.reflect._ private val sb: StringBuilder = new StringBuilder diff --git a/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala b/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala index df422291b313..f1335c8569fa 100644 --- a/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala +++ b/compiler/src/scala/quoted/runtime/impl/printers/SourceCode.scala @@ -6,19 +6,19 @@ import scala.annotation.switch /** Printer for fully elaborated representation of the source code */ object SourceCode { - def showTree(using QuoteContext)(tree: qctx.reflect.Tree)(syntaxHighlight: SyntaxHighlight): String = + def showTree(using Quotes)(tree: qctx.reflect.Tree)(syntaxHighlight: SyntaxHighlight): String = new SourceCodePrinter[qctx.type](syntaxHighlight).printTree(tree).result() - def showType(using QuoteContext)(tpe: qctx.reflect.TypeRepr)(syntaxHighlight: SyntaxHighlight): String = + def showType(using Quotes)(tpe: qctx.reflect.TypeRepr)(syntaxHighlight: SyntaxHighlight): String = new SourceCodePrinter[qctx.type](syntaxHighlight).printType(tpe)(using None).result() - def showConstant(using QuoteContext)(const: qctx.reflect.Constant)(syntaxHighlight: SyntaxHighlight): String = + def showConstant(using Quotes)(const: qctx.reflect.Constant)(syntaxHighlight: SyntaxHighlight): String = new SourceCodePrinter[qctx.type](syntaxHighlight).printConstant(const).result() - def showSymbol(using QuoteContext)(symbol: qctx.reflect.Symbol)(syntaxHighlight: SyntaxHighlight): String = + def showSymbol(using Quotes)(symbol: qctx.reflect.Symbol)(syntaxHighlight: SyntaxHighlight): String = symbol.fullName - def showFlags(using QuoteContext)(flags: qctx.reflect.Flags)(syntaxHighlight: SyntaxHighlight): String = { + def showFlags(using Quotes)(flags: qctx.reflect.Flags)(syntaxHighlight: SyntaxHighlight): String = { import qctx.reflect._ val flagList = List.newBuilder[String] if (flags.is(Flags.Abstract)) flagList += "abstract" @@ -58,7 +58,7 @@ object SourceCode { flagList.result().mkString("/*", " ", "*/") } - private class SourceCodePrinter[QCtx <: QuoteContext & Singleton](syntaxHighlight: SyntaxHighlight)(using val qctx: QCtx) { + private class SourceCodePrinter[QCtx <: Quotes & Singleton](syntaxHighlight: SyntaxHighlight)(using val qctx: QCtx) { import syntaxHighlight._ import qctx.reflect._ diff --git a/compiler/test-resources/repl-macros/i5551 b/compiler/test-resources/repl-macros/i5551 index a7e8b1df0ac9..fb039ed19dd6 100644 --- a/compiler/test-resources/repl-macros/i5551 +++ b/compiler/test-resources/repl-macros/i5551 @@ -1,8 +1,8 @@ scala> import scala.quoted._ -scala> def assertImpl(expr: Expr[Boolean])(using qctx: QuoteContext) = '{ if !($expr) then throw new AssertionError("failed assertion")} +scala> def assertImpl(expr: Expr[Boolean])(using q: Quotes) = '{ if !($expr) then throw new AssertionError("failed assertion")} def assertImpl (expr: quoted.Expr[Boolean]) - (using qctx: quoted.QuoteContext): quoted.Expr[Unit] + (using q: quoted.Quotes): quoted.Expr[Unit] scala> inline def assert(expr: => Boolean): Unit = ${ assertImpl('{expr}) } def assert(expr: => Boolean): Unit diff --git a/compiler/test-resources/repl/i9227 b/compiler/test-resources/repl/i9227 index 97f9caab6bca..772325640ff7 100644 --- a/compiler/test-resources/repl/i9227 +++ b/compiler/test-resources/repl/i9227 @@ -1,5 +1,5 @@ -scala> import scala.quoted._; inline def myMacro[T]: Unit = ${ myMacroImpl[T] }; def myMacroImpl[T](using qctx: QuoteContext): Expr[Unit] = '{}; println(myMacro[Int]) -1 | import scala.quoted._; inline def myMacro[T]: Unit = ${ myMacroImpl[T] }; def myMacroImpl[T](using qctx: QuoteContext): Expr[Unit] = '{}; println(myMacro[Int]) - | ^^^^^^^^^^^^ +scala> import scala.quoted._; inline def myMacro[T]: Unit = ${ myMacroImpl[T] }; def myMacroImpl[T](using Quotes): Expr[Unit] = '{}; println(myMacro[Int]) +1 | import scala.quoted._; inline def myMacro[T]: Unit = ${ myMacroImpl[T] }; def myMacroImpl[T](using Quotes): Expr[Unit] = '{}; println(myMacro[Int]) + | ^^^^^^^^^^^^ | Cannot call macro method myMacroImpl defined in the same source file | This location contains code that was inlined from rs$line$1:1 diff --git a/docs/docs/reference/changed-features/numeric-literals.md b/docs/docs/reference/changed-features/numeric-literals.md index 4e4f815ff264..29a903f8390e 100644 --- a/docs/docs/reference/changed-features/numeric-literals.md +++ b/docs/docs/reference/changed-features/numeric-literals.md @@ -206,7 +206,7 @@ no code that can be executed at runtime. That is why we define an intermediary c method in the `FromDigits` given instance. That method is defined in terms of a macro implementation method `fromDigitsImpl`. Here is its definition: ```scala - private def fromDigitsImpl(digits: Expr[String])(using ctx: QuoteContext): Expr[BigFloat] = + private def fromDigitsImpl(digits: Expr[String])(using ctx: Quotes): Expr[BigFloat] = digits match { case Const(ds) => try { diff --git a/docs/docs/reference/contextual/derivation-macro.md b/docs/docs/reference/contextual/derivation-macro.md index a4df3f4e7711..71222ec1c2e9 100644 --- a/docs/docs/reference/contextual/derivation-macro.md +++ b/docs/docs/reference/contextual/derivation-macro.md @@ -25,7 +25,7 @@ we need to implement a method `Eq.derived` on the companion object of `Eq` that produces a quoted instance for `Eq[T]`. Here is a possible signature, ```scala -given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] +given derived[T: Type](using Quotes) as Expr[Eq[T]] ``` and for comparison reasons we give the same signature we had with `inline`: @@ -41,7 +41,7 @@ from the signature. The body of the `derived` method is shown below: ```scala -given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = { +given derived[T: Type](using Quotes) as Expr[Eq[T]] = { import qctx.reflect._ val ev: Expr[Mirror.Of[T]] = Expr.summon[Mirror.Of[T]].get @@ -91,7 +91,7 @@ The implementation of `summonAll` as a macro can be show below assuming that we have the given instances for our primitive types: ```scala - def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = Type.of[T] match { + def summonAll[T: Type](using Quotes): List[Expr[Eq[_]]] = Type.of[T] match { case '[String *: tpes] => '{ summon[Eq[String]] } :: summonAll[tpes] case '[Int *: tpes] => '{ summon[Eq[Int]] } :: summonAll[tpes] case '[tpe *: tpes] => derived[tpe] :: summonAll[tpes] @@ -169,14 +169,14 @@ object Eq { def eqv(x: T, y: T): Boolean = body(x, y) } - def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = Type.of[T] match { + def summonAll[T: Type](using Quotes): List[Expr[Eq[_]]] = Type.of[T] match { case '[String *: tpes] => '{ summon[Eq[String]] } :: summonAll[tpes] case '[Int *: tpes] => '{ summon[Eq[Int]] } :: summonAll[tpes] case '[tpe *: tpes] => derived[tpe] :: summonAll[tpes] case '[EmptyTuple] => Nil } - given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = { + given derived[T: Type](using q: Quotes) as Expr[Eq[T]] = { import qctx.reflect._ val ev: Expr[Mirror.Of[T]] = Expr.summon[Mirror.Of[T]].get diff --git a/docs/docs/reference/metaprogramming/macros.md b/docs/docs/reference/metaprogramming/macros.md index 6ece61300ec3..d1ac99d7f2a8 100644 --- a/docs/docs/reference/metaprogramming/macros.md +++ b/docs/docs/reference/metaprogramming/macros.md @@ -36,12 +36,12 @@ import scala.quoted._ inline def assert(inline expr: Boolean): Unit = ${ assertImpl('expr) } -def assertImpl(expr: Expr[Boolean])(using QuoteContext) = '{ +def assertImpl(expr: Expr[Boolean])(using Quotes) = '{ if (!$expr) throw new AssertionError(s"failed assertion: ${${ showExpr(expr) }}") } -def showExpr(expr: Expr[Boolean])(using QuoteContext): Expr[String] = +def showExpr(expr: Expr[Boolean])(using Quotes): Expr[String] = '{ "" } // Better implementation later in this document ``` @@ -139,10 +139,10 @@ It is possible to convert any `Expr[T => R]` into `Expr[T] => Expr[R]` and back. These conversions can be implemented as follows: ```scala -def to[T: Type, R: Type](f: Expr[T] => Expr[R])(using QuoteContext): Expr[T => R] = +def to[T: Type, R: Type](f: Expr[T] => Expr[R])(using Quotes): Expr[T => R] = '{ (x: T) => ${ f('x) } } -def from[T: Type, R: Type](f: Expr[T => R])(using QuoteContext): Expr[T] => Expr[R] = +def from[T: Type, R: Type](f: Expr[T => R])(using Quotes): Expr[T] => Expr[R] = (x: Expr[T]) => '{ $f($x) } ``` @@ -187,7 +187,7 @@ Indeed, the definition of `to` above uses `T` in the next stage, there is a quote but no splice between the parameter binding of `T` and its usage. But the code can be rewritten by adding a binding of a `Type[T]` tag: ```scala -def to[T, R](f: Expr[T] => Expr[R])(using Type[T], Type[R], QuoteContext): Expr[T => R] = +def to[T, R](f: Expr[T] => Expr[R])(using Type[T], Type[R], Quotes): Expr[T => R] = '{ (x: T) => ${ f('x) } } ``` In this version of `to`, the type of `x` is now the result of @@ -199,12 +199,12 @@ reference to a type `T` in subsequent phases to a type-splice, by rewriting `T` For instance, the user-level definition of `to`: ```scala -def to[T, R](f: Expr[T] => Expr[R])(using t: Type[T], r: Type[R], QuoteContext): Expr[T => R] = +def to[T, R](f: Expr[T] => Expr[R])(using t: Type[T], r: Type[R], Quotes): Expr[T => R] = '{ (x: T) => ${ f('x) } } ``` would be rewritten to ```scala -def to[T, R](f: Expr[T] => Expr[R])(using t: Type[T], r: Type[R], QuoteContext): Expr[T => R] = +def to[T, R](f: Expr[T] => Expr[R])(using t: Type[T], r: Type[R], Quotes): Expr[T => R] = '{ (x: t.Underlying }) => ${ f('x) } } ``` The `summon` query succeeds because there is a given instance of @@ -239,7 +239,7 @@ The compiler takes an environment that maps variable names to Scala `Expr`s. ```scala import scala.quoted._ -def compile(e: Exp, env: Map[String, Expr[Int]])(using QuoteContext): Expr[Int] = e match { +def compile(e: Exp, env: Map[String, Expr[Int]])(using Quotes): Expr[Int] = e match { case Num(n) => Expr(n) case Plus(e1, e2) => @@ -266,7 +266,7 @@ package quoted object Expr { ... - def apply[T: Liftable](x: T)(using QuoteContext): Expr[T] = summon[Liftable[T]].toExpr(x) + def apply[T: Liftable](x: T)(using Quotes): Expr[T] = summon[Liftable[T]].toExpr(x) ... } ``` @@ -320,7 +320,7 @@ analogue of lifting. Using lifting, we can now give the missing definition of `showExpr` in the introductory example: ```scala -def showExpr[T](expr: Expr[T])(using QuoteContext): Expr[String] = { +def showExpr[T](expr: Expr[T])(using Quotes): Expr[String] = { val code: String = expr.show Expr(code) } @@ -371,7 +371,7 @@ object Macros { inline def assert(inline expr: Boolean): Unit = ${ assertImpl('expr) } - def assertImpl(expr: Expr[Boolean])(using QuoteContext) = + def assertImpl(expr: Expr[Boolean])(using Quotes) = val failMsg: Expr[String] = Expr("failed assertion: " + expr.show) '{ if !($expr) then throw new AssertionError($failMsg) } } @@ -438,12 +438,12 @@ implementation of the `power` function that makes use of a statically known expo ```scala inline def power(x: Double, inline n: Int) = ${ powerCode('x, 'n) } -private def powerCode(x: Expr[Double], n: Expr[Int])(using QuoteContext): Expr[Double] = +private def powerCode(x: Expr[Double], n: Expr[Int])(using Quotes): Expr[Double] = n.unlift match case Some(m) => powerCode(x, m) case None => '{ Math.pow($x, $y) } -private def powerCode(x: Expr[Double], n: Int)(using QuoteContext): Expr[Double] = +private def powerCode(x: Expr[Double], n: Int)(using Quotes): Expr[Double] = if (n == 0) '{ 1.0 } else if (n == 1) x else if (n % 2 == 0) '{ val y = $x * $x; ${ powerCode('y, n / 2) } } @@ -499,7 +499,7 @@ function `f` and one `sum` that performs a sum by delegating to `map`. ```scala object Macros { - def map[T](arr: Expr[Array[T]], f: Expr[T] => Expr[Unit])(using Type[T], QuoteContext): Expr[Unit] = '{ + def map[T](arr: Expr[Array[T]], f: Expr[T] => Expr[Unit])(using Type[T], Quotes): Expr[Unit] = '{ var i: Int = 0 while (i < ($arr).length) { val element: T = ($arr)(i) @@ -508,7 +508,7 @@ object Macros { } } - def sum(arr: Expr[Array[Int]])(using QuoteContext): Expr[Int] = '{ + def sum(arr: Expr[Array[Int]])(using Quotes): Expr[Int] = '{ var sum = 0 ${ map(arr, x => '{sum += $x}) } sum @@ -583,7 +583,7 @@ in a quote context. For this we simply provide `scala.quoted.Expr.summon`: ```scala inline def setFor[T]: Set[T] = ${ setForExpr[T] } -def setForExpr[T: Type](using QuoteContext): Expr[Set[T]] = { +def setForExpr[T: Type](using Quotes): Expr[Set[T]] = { Expr.summon[Ordering[T]] match { case Some(ord) => '{ new TreeSet[T]()($ord) } case _ => '{ new HashSet[T] } @@ -600,7 +600,7 @@ inline method that can calculate either a value of type `Int` or a value of type ```scala transparent inline def defaultOf(inline str: String) = ${ defaultOfImpl('str) } -def defaultOfImpl(strExpr: Expr[String])(using QuoteContext): Expr[Any] = +def defaultOfImpl(strExpr: Expr[String])(using Quotes): Expr[Any] = strExpr.unliftOrError match case "int" => '{1} case "string" => '{"a"} @@ -636,7 +636,7 @@ It is possible to deconstruct or extract values out of `Expr` using pattern matc These could be used in the following way to optimize any call to `sum` that has statically known values. ```scala inline def sum(inline args: Int*): Int = ${ sumExpr('args) } -private def sumExpr(argsExpr: Expr[Seq[Int]])(using QuoteContext): Expr[Int] = argsExpr match { +private def sumExpr(argsExpr: Expr[Seq[Int]])(using Quotes): Expr[Int] = argsExpr match { case Varargs(Consts(args)) => // args is of type Seq[Int] Expr(args.sum) // precompute result of sum case Varargs(argExprs) => // argExprs is of type Seq[Expr[Int]] @@ -669,7 +669,7 @@ optimize { ```scala def sum(args: Int*): Int = args.sum inline def optimize(inline arg: Int): Int = ${ optimizeExpr('arg) } -private def optimizeExpr(body: Expr[Int])(using QuoteContext): Expr[Int] = body match { +private def optimizeExpr(body: Expr[Int])(using Quotes): Expr[Int] = body match { // Match a call to sum without any arguments case '{ sum() } => Expr(0) // Match a call to sum with an argument $n of type Int. n will be the Expr[Int] representing the argument. @@ -678,7 +678,7 @@ private def optimizeExpr(body: Expr[Int])(using QuoteContext): Expr[Int] = body case '{ sum(${Varargs(args)}: _*) } => sumExpr(args) case body => body } -private def sumExpr(args1: Seq[Expr[Int]])(using QuoteContext): Expr[Int] = { +private def sumExpr(args1: Seq[Expr[Int]])(using Quotes): Expr[Int] = { def flatSumArgs(arg: Expr[Int]): Seq[Expr[Int]] = arg match { case '{ sum(${Varargs(subArgs)}: _*) } => subArgs.flatMap(flatSumArgs) case arg => Seq(arg) @@ -701,7 +701,7 @@ private def sumExpr(args1: Seq[Expr[Int]])(using QuoteContext): Expr[Int] = { Sometimes it is necessary to get a more precise type for an expression. This can be achived using the following pattern match. ```scala -def f(exp: Expr[Any])(using QuoteContext) = +def f(exp: Expr[Any])(using Quotes) = expr match case '{ $x: t } => // If the pattern match succeeds, then there is some type `t` such that @@ -716,7 +716,7 @@ This might be used to then perform an implicit search as in: ```scala extension (inline sc: StringContext) inline def showMe(inline args: Any*): String = ${ showMeExpr('sc, 'args) } -private def showMeExpr(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using QuoteContext): Expr[String] = { +private def showMeExpr(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes): Expr[String] = { argsExpr match { case Varargs(argExprs) => val argShowedExprs = argExprs.map { @@ -761,7 +761,7 @@ the subexpression of type `Expr[Int]` is bound to `body` as an `Expr[Int => Int] ```scala inline def eval(inline e: Int): Int = ${ evalExpr('e) } -private def evalExpr(e: Expr[Int])(using QuoteContext): Expr[Int] = { +private def evalExpr(e: Expr[Int])(using Quotes): Expr[Int] = { e match { case '{ val y: Int = $x; $body(y): Int } => // body: Expr[Int => Int] where the argument represents references to y diff --git a/docs/docs/reference/metaprogramming/staging.md b/docs/docs/reference/metaprogramming/staging.md index 6f2114db0194..6044564eb43c 100644 --- a/docs/docs/reference/metaprogramming/staging.md +++ b/docs/docs/reference/metaprogramming/staging.md @@ -60,15 +60,15 @@ The framework as discussed so far allows code to be staged, i.e. be prepared to be executed at a later stage. To run that code, there is another method in class `Expr` called `run`. Note that `$` and `run` both map from `Expr[T]` to `T` but only `$` is subject to the PCP, whereas `run` is just a normal method. -Run provides a `QuoteContext` that can be used to show the expression in the scope of `run`. -On the other hand `withQuoteContext` provides a `QuoteContext` without evaluating the expression. +Run provides a `Quotes` that can be used to show the expression in the scope of `run`. +On the other hand `withQuotes` provides a `Quotes` without evaluating the expression. ```scala package scala.quoted.staging -def run[T](expr: QuoteContext ?=> Expr[T])(using toolbox: Toolbox): T = ... +def run[T](expr: Quotes ?=> Expr[T])(using toolbox: Toolbox): T = ... -def withQuoteContext[T](thunk: QuoteContext ?=> T)(using toolbox: Toolbox): T = ... +def withQuotes[T](thunk: Quotes ?=> T)(using toolbox: Toolbox): T = ... ``` ## Create a new Dotty project with staging enabled diff --git a/docs/docs/reference/metaprogramming/tasty-reflect.md b/docs/docs/reference/metaprogramming/tasty-reflect.md index 6af67c527d41..56926071e616 100644 --- a/docs/docs/reference/metaprogramming/tasty-reflect.md +++ b/docs/docs/reference/metaprogramming/tasty-reflect.md @@ -20,7 +20,7 @@ guarantees and may fail at macro expansion time, hence additional explicit checks must be done. To provide reflection capabilities in macros we need to add an implicit -parameter of type `scala.quoted.QuoteContext` and import `qctx.reflect._` from it in +parameter of type `scala.quoted.Quotes` and import `qctx.reflect._` from it in the scope where it is used. ```scala @@ -28,7 +28,7 @@ import scala.quoted._ inline def natConst(inline x: Int): Int = ${natConstImpl('{x})} -def natConstImpl(x: Expr[Int])(using qctx: QuoteContext): Expr[Int] = { +def natConstImpl(x: Expr[Int])(using Quotes): Expr[Int] = { import qctx.reflect._ ... } @@ -40,7 +40,7 @@ def natConstImpl(x: Expr[Int])(using qctx: QuoteContext): Expr[Int] = { trees. For example the `Literal(_)` extractor used below. ```scala -def natConstImpl(x: Expr[Int])(using qctx: QuoteContext): Expr[Int] = { +def natConstImpl(x: Expr[Int])(using Quotes): Expr[Int] = { import qctx.reflect._ val xTree: Term = Term.of(x) xTree match { @@ -75,7 +75,7 @@ such as the start line, the end line or even the source code at the expansion point. ```scala -def macroImpl()(qctx: QuoteContext): Expr[Unit] = { +def macroImpl()(qctx: Quotes): Expr[Unit] = { import qctx.reflect._ val pos = rootPosition diff --git a/library/src-bootstrapped/scala/quoted/Expr.scala b/library/src-bootstrapped/scala/quoted/Expr.scala index 3d13259d4505..052758331569 100644 --- a/library/src-bootstrapped/scala/quoted/Expr.scala +++ b/library/src-bootstrapped/scala/quoted/Expr.scala @@ -13,7 +13,7 @@ object Expr { * To retain semantics the argument `ei` is bound as `val yi = ei` and by-name arguments to `def yi = ei`. * Some bindings may be elided as an early optimization. */ - def betaReduce[T](expr: Expr[T])(using qctx: QuoteContext): Expr[T] = + def betaReduce[T](expr: Expr[T])(using Quotes): Expr[T] = import qctx.reflect._ Term.betaReduce(Term.of(expr)) match case Some(expr1) => expr1.asExpr.asInstanceOf[Expr[T]] @@ -23,13 +23,14 @@ object Expr { * Given list of statements `s1 :: s2 :: ... :: Nil` and an expression `e` the resulting expression * will be equivalent to `'{ $s1; $s2; ...; $e }`. */ - def block[T](statements: List[Expr[Any]], expr: Expr[T])(using qctx: QuoteContext): Expr[T] = { + def block[T](statements: List[Expr[Any]], expr: Expr[T])(using Quotes): Expr[T] = { import qctx.reflect._ Block(statements.map(Term.of), Term.of(expr)).asExpr.asInstanceOf[Expr[T]] } /** Lift a value into an expression containing the construction of that value */ - def apply[T](x: T)(using qctx: QuoteContext, lift: Liftable[T]): Expr[T] = lift.toExpr(x) + def apply[T](x: T)(using lift: Liftable[T])(using Quotes): Expr[T] = + lift.toExpr(x) /** Lifts this sequence of expressions into an expression of a sequence * @@ -39,7 +40,8 @@ object Expr { * `'{ Seq($e1, $e2, ...) }` typed as an `Expr[Seq[T]]` * ``` */ - def ofSeq[T](xs: Seq[Expr[T]])(using tp: Type[T], qctx: QuoteContext): Expr[Seq[T]] = Varargs(xs) + def ofSeq[T](xs: Seq[Expr[T]])(using tp: Type[T], qctx: Quotes): Expr[Seq[T]] = + Varargs(xs) /** Lifts this list of expressions into an expression of a list * @@ -48,7 +50,7 @@ object Expr { * to an expression equivalent to * `'{ List($e1, $e2, ...) }` typed as an `Expr[List[T]]` */ - def ofList[T](xs: Seq[Expr[T]])(using Type[T], QuoteContext): Expr[List[T]] = + def ofList[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[List[T]] = if (xs.isEmpty) Expr(Nil) else '{ List(${Varargs(xs)}: _*) } /** Lifts this sequence of expressions into an expression of a tuple @@ -58,7 +60,7 @@ object Expr { * to an expression equivalent to * `'{ ($e1, $e2, ...) }` typed as an `Expr[Tuple]` */ - def ofTupleFromSeq(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = { + def ofTupleFromSeq(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = { seq.size match { case 0 => '{ Tuple() } case 1 => ofTupleFromSeq1(seq) @@ -87,116 +89,116 @@ object Expr { } } - private def ofTupleFromSeq1(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq1(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }) => '{ Tuple1($x1) } - private def ofTupleFromSeq2(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq2(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }) => '{ Tuple2($x1, $x2) } - private def ofTupleFromSeq3(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq3(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }) => '{ Tuple3($x1, $x2, $x3) } - private def ofTupleFromSeq4(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq4(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }) => '{ Tuple4($x1, $x2, $x3, $x4) } - private def ofTupleFromSeq5(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq5(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }) => '{ Tuple5($x1, $x2, $x3, $x4, $x5) } - private def ofTupleFromSeq6(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq6(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }) => '{ Tuple6($x1, $x2, $x3, $x4, $x5, $x6) } - private def ofTupleFromSeq7(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq7(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }) => '{ Tuple7($x1, $x2, $x3, $x4, $x5, $x6, $x7) } - private def ofTupleFromSeq8(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq8(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }) => '{ Tuple8($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8) } - private def ofTupleFromSeq9(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq9(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }) => '{ Tuple9($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9) } - private def ofTupleFromSeq10(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq10(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }) => '{ Tuple10($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10) } - private def ofTupleFromSeq11(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq11(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }) => '{ Tuple11($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11) } - private def ofTupleFromSeq12(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq12(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }) => '{ Tuple12($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12) } - private def ofTupleFromSeq13(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq13(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }) => '{ Tuple13($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13) } - private def ofTupleFromSeq14(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq14(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }) => '{ Tuple14($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14) } - private def ofTupleFromSeq15(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq15(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }) => '{ Tuple15($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15) } - private def ofTupleFromSeq16(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq16(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }) => '{ Tuple16($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16) } - private def ofTupleFromSeq17(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq17(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }) => '{ Tuple17($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17) } - private def ofTupleFromSeq18(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq18(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }) => '{ Tuple18($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18) } - private def ofTupleFromSeq19(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq19(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }, '{ $x19: t19 }) => '{ Tuple19($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19) } - private def ofTupleFromSeq20(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq20(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }, '{ $x19: t19 }, '{ $x20: t20 }) => '{ Tuple20($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20) } - private def ofTupleFromSeq21(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq21(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }, '{ $x19: t19 }, '{ $x20: t20 }, '{ $x21: t21 }) => '{ Tuple21($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20, $x21) } - private def ofTupleFromSeq22(seq: Seq[Expr[Any]])(using qctx: QuoteContext): Expr[Tuple] = + private def ofTupleFromSeq22(seq: Seq[Expr[Any]])(using Quotes): Expr[Tuple] = seq match case Seq('{ $x1: t1 }, '{ $x2: t2 }, '{ $x3: t3 }, '{ $x4: t4 }, '{ $x5: t5 }, '{ $x6: t6 }, '{ $x7: t7 }, '{ $x8: t8 }, '{ $x9: t9 }, '{ $x10: t10 }, '{ $x11: t11 }, '{ $x12: t12 }, '{ $x13: t13 }, '{ $x14: t14 }, '{ $x15: t15 }, '{ $x16: t16 }, '{ $x17: t17 }, '{ $x18: t18 }, '{ $x19: t19 }, '{ $x20: t20 }, '{ $x21: t21 }, '{ $x22: t22 }) => '{ Tuple22($x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x20, $x21, $x22) } /** Given a tuple of the form `(Expr[A1], ..., Expr[An])`, outputs a tuple `Expr[(A1, ..., An)]`. */ - def ofTuple[T <: Tuple: Tuple.IsMappedBy[Expr]: Type](tup: T)(using qctx: QuoteContext): Expr[Tuple.InverseMap[T, Expr]] = { + def ofTuple[T <: Tuple: Tuple.IsMappedBy[Expr]: Type](tup: T)(using Quotes): Expr[Tuple.InverseMap[T, Expr]] = { val elems: Seq[Expr[Any]] = tup.asInstanceOf[Product].productIterator.toSeq.asInstanceOf[Seq[Expr[Any]]] ofTupleFromSeq(elems).asExprOf[Tuple.InverseMap[T, Expr]] } @@ -209,7 +211,7 @@ object Expr { * @param tpe quoted type of the implicit parameter * @param qctx current context */ - def summon[T](using tpe: Type[T])(using qctx: QuoteContext): Option[Expr[T]] = { + def summon[T](using Type[T])(using Quotes): Option[Expr[T]] = { import qctx.reflect._ Implicits.search(TypeRepr.of[T]) match { case iss: ImplicitSearchSuccess => Some(iss.tree.asExpr.asInstanceOf[Expr[T]]) @@ -221,7 +223,7 @@ object Expr { /** Matches a `StringContext(part0, part1, ...)` and extracts the parts of a call to if the * parts are passed explicitly. Returns the equvalent to `Seq('{part0}, '{part1}, ...)`. */ - def unapply(sc: Expr[StringContext])(using QuoteContext): Option[Seq[Expr[String]]] = + def unapply(sc: Expr[StringContext])(using Quotes): Option[Seq[Expr[String]]] = sc match case '{ scala.StringContext(${Varargs(parts)}: _*) } => Some(parts) case '{ new scala.StringContext(${Varargs(parts)}: _*) } => Some(parts) diff --git a/library/src-bootstrapped/scala/quoted/ExprMap.scala b/library/src-bootstrapped/scala/quoted/ExprMap.scala index f045309a959a..5c279b149db3 100644 --- a/library/src-bootstrapped/scala/quoted/ExprMap.scala +++ b/library/src-bootstrapped/scala/quoted/ExprMap.scala @@ -2,11 +2,11 @@ package scala.quoted trait ExprMap: - /** Map an expression `e` with a type `tpe` */ - def transform[T](e: Expr[T])(using qctx: QuoteContext, tpe: Type[T]): Expr[T] + /** Map an expression `e` with a type `T` */ + def transform[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] - /** Map subexpressions an expression `e` with a type `tpe` */ - def transformChildren[T](e: Expr[T])(using qctx: QuoteContext, tpe: Type[T]): Expr[T] = { + /** Map subexpressions an expression `e` with a type `T` */ + def transformChildren[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] = { import qctx.reflect._ final class MapChildren() { diff --git a/library/src-bootstrapped/scala/quoted/Liftable.scala b/library/src-bootstrapped/scala/quoted/Liftable.scala index 2247356471f7..9bfb8bf05844 100644 --- a/library/src-bootstrapped/scala/quoted/Liftable.scala +++ b/library/src-bootstrapped/scala/quoted/Liftable.scala @@ -8,7 +8,7 @@ import scala.reflect.ClassTag trait Liftable[T] { /** Lift a value into an expression containing the construction of that value */ - def toExpr(x: T): QuoteContext ?=> Expr[T] + def toExpr(x: T): Quotes ?=> Expr[T] } @@ -94,111 +94,111 @@ object Liftable { /** Default liftable for ClassTag[T] */ given ClassTagLiftable[T: Type] as Liftable[ClassTag[T]] = new Liftable[ClassTag[T]] { - def toExpr(ct: ClassTag[T]): QuoteContext ?=> Expr[ClassTag[T]] = + def toExpr(ct: ClassTag[T]): Quotes ?=> Expr[ClassTag[T]] = '{ ClassTag[T](${Expr(ct.runtimeClass.asInstanceOf[Class[T]])}) } } /** Default liftable for Array[T] */ given ArrayLiftable[T: Type: Liftable: ClassTag] as Liftable[Array[T]] = new Liftable[Array[T]] { - def toExpr(arr: Array[T]): QuoteContext ?=> Expr[Array[T]] = + def toExpr(arr: Array[T]): Quotes ?=> Expr[Array[T]] = '{ Array[T](${Expr(arr.toSeq)}: _*)(${Expr(summon[ClassTag[T]])}) } } /** Default liftable for Array[Boolean] */ given ArrayOfBooleanLiftable as Liftable[Array[Boolean]] = new Liftable[Array[Boolean]] { - def toExpr(array: Array[Boolean]): QuoteContext ?=> Expr[Array[Boolean]] = + def toExpr(array: Array[Boolean]): Quotes ?=> Expr[Array[Boolean]] = if (array.length == 0) '{ Array.emptyBooleanArray } else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } } /** Default liftable for Array[Byte] */ given ArrayOfByteLiftable as Liftable[Array[Byte]] = new Liftable[Array[Byte]] { - def toExpr(array: Array[Byte]): QuoteContext ?=> Expr[Array[Byte]] = + def toExpr(array: Array[Byte]): Quotes ?=> Expr[Array[Byte]] = if (array.length == 0) '{ Array.emptyByteArray } else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } } /** Default liftable for Array[Short] */ given ArrayOfShortLiftable as Liftable[Array[Short]] = new Liftable[Array[Short]] { - def toExpr(array: Array[Short]): QuoteContext ?=> Expr[Array[Short]] = + def toExpr(array: Array[Short]): Quotes ?=> Expr[Array[Short]] = if (array.length == 0) '{ Array.emptyShortArray } else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } } /** Default liftable for Array[Char] */ given ArrayOfCharLiftable as Liftable[Array[Char]] = new Liftable[Array[Char]] { - def toExpr(array: Array[Char]): QuoteContext ?=> Expr[Array[Char]] = + def toExpr(array: Array[Char]): Quotes ?=> Expr[Array[Char]] = if (array.length == 0) '{ Array.emptyCharArray } else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } } /** Default liftable for Array[Int] */ given ArrayOfIntLiftable as Liftable[Array[Int]] = new Liftable[Array[Int]] { - def toExpr(array: Array[Int]): QuoteContext ?=> Expr[Array[Int]] = + def toExpr(array: Array[Int]): Quotes ?=> Expr[Array[Int]] = if (array.length == 0) '{ Array.emptyIntArray } else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } } /** Default liftable for Array[Long] */ given ArrayOfLongLiftable as Liftable[Array[Long]] = new Liftable[Array[Long]] { - def toExpr(array: Array[Long]): QuoteContext ?=> Expr[Array[Long]] = + def toExpr(array: Array[Long]): Quotes ?=> Expr[Array[Long]] = if (array.length == 0) '{ Array.emptyLongArray } else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } } /** Default liftable for Array[Float] */ given ArrayOfFloatLiftable as Liftable[Array[Float]] = new Liftable[Array[Float]] { - def toExpr(array: Array[Float]): QuoteContext ?=> Expr[Array[Float]] = + def toExpr(array: Array[Float]): Quotes ?=> Expr[Array[Float]] = if (array.length == 0) '{ Array.emptyFloatArray } else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } } /** Default liftable for Array[Double] */ given ArrayOfDoubleLiftable as Liftable[Array[Double]] = new Liftable[Array[Double]] { - def toExpr(array: Array[Double]): QuoteContext ?=> Expr[Array[Double]] = + def toExpr(array: Array[Double]): Quotes ?=> Expr[Array[Double]] = if (array.length == 0) '{ Array.emptyDoubleArray } else '{ Array(${Expr(array(0))}, ${Expr(array.toSeq.tail)}: _*) } } /** Default liftable for IArray[T] */ given IArrayLiftable[T: Type](using ltArray: Liftable[Array[T]]) as Liftable[IArray[T]] { - def toExpr(iarray: IArray[T]): QuoteContext ?=> Expr[IArray[T]] = + def toExpr(iarray: IArray[T]): Quotes ?=> Expr[IArray[T]] = '{ ${ltArray.toExpr(iarray.asInstanceOf[Array[T]])}.asInstanceOf[IArray[T]] } } /** Default liftable for Seq[T] */ given SeqLiftable[T: Type: Liftable] as Liftable[Seq[T]] = new Liftable[Seq[T]] { - def toExpr(xs: Seq[T]): QuoteContext ?=> Expr[Seq[T]] = + def toExpr(xs: Seq[T]): Quotes ?=> Expr[Seq[T]] = Expr.ofSeq(xs.map(summon[Liftable[T]].toExpr)) } /** Default liftable for List[T] */ given ListLiftable[T: Type: Liftable] as Liftable[List[T]] = new Liftable[List[T]] { - def toExpr(xs: List[T]): QuoteContext ?=> Expr[List[T]] = + def toExpr(xs: List[T]): Quotes ?=> Expr[List[T]] = Expr.ofList(xs.map(summon[Liftable[T]].toExpr)) } /** Default liftable for Nil.type */ given NilLiftable as Liftable[Nil.type] = new Liftable[Nil.type] { - def toExpr(xs: Nil.type): QuoteContext ?=> Expr[Nil.type] = + def toExpr(xs: Nil.type): Quotes ?=> Expr[Nil.type] = '{ Nil } } /** Default liftable for Set[T] */ given SetLiftable[T: Type: Liftable] as Liftable[Set[T]] = new Liftable[Set[T]] { - def toExpr(set: Set[T]): QuoteContext ?=> Expr[Set[T]] = + def toExpr(set: Set[T]): Quotes ?=> Expr[Set[T]] = '{ Set(${Expr(set.toSeq)}: _*) } } /** Default liftable for Map[T, U] */ given MapLiftable[T: Type: Liftable, U: Type: Liftable] as Liftable[Map[T, U]] = new Liftable[Map[T, U]] { - def toExpr(map: Map[T, U]): QuoteContext ?=> Expr[Map[T, U]] = + def toExpr(map: Map[T, U]): Quotes ?=> Expr[Map[T, U]] = '{ Map(${Expr(map.toSeq)}: _*) } } /** Default liftable for Option[T] */ given OptionLiftable[T: Type: Liftable] as Liftable[Option[T]] = new Liftable[Option[T]] { - def toExpr(x: Option[T]): QuoteContext ?=> Expr[Option[T]] = x match { + def toExpr(x: Option[T]): Quotes ?=> Expr[Option[T]] = x match { case x: Some[T] => Expr(x) case None => Expr(None) } @@ -206,32 +206,32 @@ object Liftable { /** Default liftable for Some[T] */ given SomeLiftable[T: Type: Liftable] as Liftable[Some[T]] = new Liftable[Some[T]] { - def toExpr(x: Some[T]): QuoteContext ?=> Expr[Some[T]] = + def toExpr(x: Some[T]): Quotes ?=> Expr[Some[T]] = '{ Some[T](${Expr(x.get)}) } } /** Default liftable for None.type */ given NoneLiftable as Liftable[None.type] = new Liftable[None.type] { - def toExpr(x: None.type): QuoteContext ?=> Expr[None.type] = + def toExpr(x: None.type): Quotes ?=> Expr[None.type] = '{ None } } /** Default liftable for Either[L, R] */ given EitherLiftable[L: Type: Liftable, R: Type: Liftable] as Liftable[Either[L, R]] = new Liftable[Either[L, R]] { - def toExpr(x: Either[L, R]): QuoteContext ?=> Expr[Either[L, R]] = x match + def toExpr(x: Either[L, R]): Quotes ?=> Expr[Either[L, R]] = x match case x: Left[L, R] => Expr(x) case x: Right[L, R] => Expr(x) } /** Default liftable for Left[L, R] */ given LeftLiftable[L: Type: Liftable, R: Type] as Liftable[Left[L, R]] = new Liftable[Left[L, R]] { - def toExpr(x: Left[L, R]): QuoteContext ?=> Expr[Left[L, R]] = + def toExpr(x: Left[L, R]): Quotes ?=> Expr[Left[L, R]] = '{ Left[L, R](${Expr(x.value)}) } } /** Default liftable for Right[L, R] */ given RightLiftable[L: Type, R: Type: Liftable] as Liftable[Right[L, R]] = new Liftable[Right[L, R]] { - def toExpr(x: Right[L, R]): QuoteContext ?=> Expr[Right[L, R]] = + def toExpr(x: Right[L, R]): Quotes ?=> Expr[Right[L, R]] = '{ Right[L, R](${Expr(x.value)}) } } @@ -411,26 +411,26 @@ object Liftable { /** Default liftable for H *: T */ given TupleConsLiftable [H: Type: Liftable, T <: Tuple: Type: Liftable] as Liftable[H *: T] = new { - def toExpr(tup: H *: T): QuoteContext ?=> Expr[H *: T] = + def toExpr(tup: H *: T): Quotes ?=> Expr[H *: T] = '{ ${summon[Liftable[H]].toExpr(tup.head)} *: ${summon[Liftable[T]].toExpr(tup.tail)} } // '{ ${Expr(tup.head)} *: ${Expr(tup.tail)} } // TODO figure out why this fails during CI documentation } /** Default liftable for BigInt */ given BigIntLiftable as Liftable[BigInt] = new Liftable[BigInt] { - def toExpr(x: BigInt): QuoteContext ?=> Expr[BigInt] = + def toExpr(x: BigInt): Quotes ?=> Expr[BigInt] = '{ BigInt(${Expr(x.toByteArray)}) } } /** Default liftable for BigDecimal using the default MathContext */ given BigDecimalLiftable as Liftable[BigDecimal] = new Liftable[BigDecimal] { - def toExpr(x: BigDecimal): QuoteContext ?=> Expr[BigDecimal] = + def toExpr(x: BigDecimal): Quotes ?=> Expr[BigDecimal] = '{ BigDecimal(${Expr(x.toString)}) } } /** Default liftable for StringContext */ given StringContextLiftable as Liftable[StringContext] = new Liftable[StringContext] { - def toExpr(stringContext: StringContext): QuoteContext ?=> Expr[StringContext] = + def toExpr(stringContext: StringContext): Quotes ?=> Expr[StringContext] = val parts = Varargs(stringContext.parts.map(Expr(_))) '{ StringContext($parts: _*) } } diff --git a/library/src-bootstrapped/scala/quoted/Type.scala b/library/src-bootstrapped/scala/quoted/Type.scala index e751e34e1e47..391bb10fd427 100644 --- a/library/src-bootstrapped/scala/quoted/Type.scala +++ b/library/src-bootstrapped/scala/quoted/Type.scala @@ -12,15 +12,15 @@ end Type object Type: /** Show a source code like representation of this type without syntax highlight */ - def show[T](using tp: Type[T])(using qctx: QuoteContext): String = + def show[T](using Type[T])(using Quotes): String = qctx.reflect.TypeTree.of[T].show /** Shows the tree as fully typed source code colored with ANSI */ - def showAnsiColored[T](using tp: Type[T])(using qctx: QuoteContext): String = + def showAnsiColored[T](using Type[T])(using Quotes): String = qctx.reflect.TypeTree.of[T].showAnsiColored /** Return a quoted.Type with the given type */ @compileTimeOnly("Reference to `scala.quoted.Type.of` was not handled by PickleQuotes") - given of[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ??? + given of[T <: AnyKind] as (Quotes ?=> Type[T]) = ??? end Type diff --git a/library/src-bootstrapped/scala/quoted/Unliftable.scala b/library/src-bootstrapped/scala/quoted/Unliftable.scala index 20d14ac251cf..52c3ee4a8b58 100644 --- a/library/src-bootstrapped/scala/quoted/Unliftable.scala +++ b/library/src-bootstrapped/scala/quoted/Unliftable.scala @@ -8,7 +8,7 @@ trait Unliftable[T] { * Returns `None` if the expression does not contain a value or contains side effects. * Otherwise returns the `Some` of the value. */ - def fromExpr(x: Expr[T]): QuoteContext ?=> Option[T] + def fromExpr(x: Expr[T]): Quotes ?=> Option[T] } diff --git a/library/src-non-bootstrapped/scala/internal/quoted/CompileTime.scala b/library/src-non-bootstrapped/scala/internal/quoted/CompileTime.scala index ab08405edc05..23377924ddc2 100644 --- a/library/src-non-bootstrapped/scala/internal/quoted/CompileTime.scala +++ b/library/src-non-bootstrapped/scala/internal/quoted/CompileTime.scala @@ -7,13 +7,13 @@ import scala.quoted._ object CompileTime { @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.exprQuote`") - def exprQuote[T](x: T): QuoteContext ?=> Expr[T] = ??? + def exprQuote[T](x: T): Quotes ?=> Expr[T] = ??? @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.exprSplice`") - def exprSplice[T](x: QuoteContext ?=> Expr[T]): T = ??? + def exprSplice[T](x: Quotes ?=> Expr[T]): T = ??? @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.exprNestedSplice`") - def exprNestedSplice[T](ctx: QuoteContext)(x: ctx.Nested ?=> Expr[T]): T = ??? + def exprNestedSplice[T](ctx: Quotes)(x: ctx.Nested ?=> Expr[T]): T = ??? @compileTimeOnly("Illegal reference to `scala.internal.quoted.CompileTime.quoteTypeTag`") class quoteTypeTag extends Annotation diff --git a/library/src-non-bootstrapped/scala/quoted/Type.scala b/library/src-non-bootstrapped/scala/quoted/Type.scala index 0e89740d4420..05daac01f659 100644 --- a/library/src-non-bootstrapped/scala/quoted/Type.scala +++ b/library/src-non-bootstrapped/scala/quoted/Type.scala @@ -7,5 +7,5 @@ abstract class Type[T <: AnyKind] private[scala]: object Type: @compileTimeOnly("Reference to `scala.quoted.Type.apply` was not handled by PickleQuotes") - given of[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ??? - given apply[T <: AnyKind] as (QuoteContext ?=> Type[T]) = ??? + given of[T <: AnyKind] as (Quotes ?=> Type[T]) = ??? + given apply[T <: AnyKind] as (Quotes ?=> Type[T]) = ??? diff --git a/library/src-non-bootstrapped/scala/quoted/Unliftable.scala b/library/src-non-bootstrapped/scala/quoted/Unliftable.scala index 8aaab0c9e79d..1739c04e9cba 100644 --- a/library/src-non-bootstrapped/scala/quoted/Unliftable.scala +++ b/library/src-non-bootstrapped/scala/quoted/Unliftable.scala @@ -1,4 +1,4 @@ package scala.quoted trait Unliftable[T]: - def fromExpr(x: Expr[T]): QuoteContext ?=> Option[T] + def fromExpr(x: Expr[T]): Quotes ?=> Option[T] diff --git a/library/src-non-bootstrapped/scala/quoted/internal/Expr.scala b/library/src-non-bootstrapped/scala/quoted/internal/Expr.scala index d19953b1f5fd..d70be07f8574 100644 --- a/library/src-non-bootstrapped/scala/quoted/internal/Expr.scala +++ b/library/src-non-bootstrapped/scala/quoted/internal/Expr.scala @@ -8,14 +8,14 @@ object Expr: /** A term quote is desugared by the compiler into a call to this method */ @compileTimeOnly("Illegal reference to `scala.quoted.internal.Expr.quote`") - def quote[T](x: T): QuoteContext ?=> scala.quoted.Expr[T] = ??? + def quote[T](x: T): Quotes ?=> scala.quoted.Expr[T] = ??? /** A term splice is desugared by the compiler into a call to this method */ @compileTimeOnly("Illegal reference to `scala.quoted.internal.Expr.splice`") - def splice[T](x: QuoteContext ?=> scala.quoted.Expr[T]): T = ??? + def splice[T](x: Quotes ?=> scala.quoted.Expr[T]): T = ??? /** A term splice nested within a quote is desugared by the compiler into a call to this method. - * `ctx` is the `QuoteContext` that the quote of this splice uses. + * `ctx` is the `Quotes` that the quote of this splice uses. */ @compileTimeOnly("Illegal reference to `scala.quoted.internal.Expr.nestedSplice`") - def nestedSplice[T](ctx: QuoteContext)(x: ctx.Nested ?=> scala.quoted.Expr[T]): T = ??? + def nestedSplice[T](ctx: Quotes)(x: ctx.Nested ?=> scala.quoted.Expr[T]): T = ??? diff --git a/library/src/scala/quoted/Const.scala b/library/src/scala/quoted/Const.scala index cdbb4e33a731..66a299911ae0 100644 --- a/library/src/scala/quoted/Const.scala +++ b/library/src/scala/quoted/Const.scala @@ -14,7 +14,7 @@ object Const { * } * ``` */ - def unapply[T](expr: Expr[T])(using qctx: QuoteContext): Option[T] = { + def unapply[T](expr: Expr[T])(using Quotes): Option[T] = { import qctx.reflect._ def rec(tree: Term): Option[T] = tree match { case Literal(c) => Some(c.value.asInstanceOf[T]) diff --git a/library/src/scala/quoted/Consts.scala b/library/src/scala/quoted/Consts.scala index 46db54f52f53..bf32e9217738 100644 --- a/library/src/scala/quoted/Consts.scala +++ b/library/src/scala/quoted/Consts.scala @@ -8,14 +8,14 @@ object Consts { * Usage: * ```scala * inline def sum(args: Int*): Int = ${ sumExpr('args) } - * def sumExpr(argsExpr: Expr[Seq[Int]])(usingusing QuoteContext): Expr[Int] = argsExpr match + * def sumExpr(argsExpr: Expr[Seq[Int]])(usingusing Quotes): Expr[Int] = argsExpr match * case Varargs(Consts(args)) => * // args: Seq[Int] * ... * } * ``` */ - def unapply[T](exprs: Seq[Expr[T]])(using qctx: QuoteContext): Option[Seq[T]] = + def unapply[T](exprs: Seq[Expr[T]])(using Quotes): Option[Seq[T]] = exprs.foldRight(Option(List.empty[T])) { (elem, acc) => (elem, acc) match { case (Const(value), Some(lst)) => Some(value :: lst) diff --git a/library/src/scala/quoted/QuoteContext.scala b/library/src/scala/quoted/Quotes.scala similarity index 99% rename from library/src/scala/quoted/QuoteContext.scala rename to library/src/scala/quoted/Quotes.scala index f545fe91831d..855faff274b4 100644 --- a/library/src/scala/quoted/QuoteContext.scala +++ b/library/src/scala/quoted/Quotes.scala @@ -8,9 +8,9 @@ import scala.reflect.TypeTest * It contains the low-level Typed AST API metaprogramming API. * This API does not have the static type guarantiees that `Expr` and `Type` provide. * - * @param tasty Typed AST API. Usage: `def f(qctx: QuoteContext) = { import qctx.reflect._; ... }`. + * @param tasty Typed AST API. Usage: `def f(qctx: Quotes) = { import qctx.reflect._; ... }`. */ -trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching => +trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching => // Extension methods for `Expr[T]` extension [T](self: Expr[T]): @@ -35,29 +35,29 @@ trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching => * Returns `None` if the expression does not contain a value or contains side effects. * Otherwise returns the `Some` of the value. */ - def unlift(using unlift: Unliftable[T]): Option[T] = - unlift.fromExpr(self)(using QuoteContext.this) + def unlift(using Unliftable[T]): Option[T] = + summon[Unliftable[T]].fromExpr(self)(using Quotes.this) /** Return the unlifted value of this expression. * * Emits an error and throws if the expression does not contain a value or contains side effects. * Otherwise returns the value. */ - def unliftOrError(using unlift: Unliftable[T]): T = + def unliftOrError(using Unliftable[T]): T = def reportError = val msg = s"Expected a known value. \n\nThe value of: ${self.show}\ncould not be unlifted using $unlift" - report.throwError(msg, self)(using QuoteContext.this) - unlift.fromExpr(self)(using QuoteContext.this).getOrElse(reportError) + report.throwError(msg, self)(using Quotes.this) + summon[Unliftable[T]].fromExpr(self)(using Quotes.this).getOrElse(reportError) end extension // Extension methods for `Expr[Any]` that take another explicit type parameter extension [X](self: Expr[Any]): /** Checks is the `quoted.Expr[?]` is valid expression of type `X` */ - def isExprOf(using tp: scala.quoted.Type[X]): Boolean + def isExprOf(using Type[X]): Boolean /** Convert this to an `quoted.Expr[X]` if this expression is a valid expression of type `X` or throws */ - def asExprOf(using tp: scala.quoted.Type[X]): scala.quoted.Expr[X] + def asExprOf(using Type[X]): Expr[X] end extension /** Low-level Typed AST API metaprogramming API. @@ -213,12 +213,12 @@ trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching => def isExpr: Boolean /** Convert this tree to an `quoted.Expr[Any]` if the tree is a valid expression or throws */ - def asExpr: scala.quoted.Expr[Any] + def asExpr: Expr[Any] end extension /** Convert this tree to an `quoted.Expr[T]` if the tree is a valid expression or throws */ extension [T](self: Tree) - def asExprOf(using scala.quoted.Type[T]): scala.quoted.Expr[T] + def asExprOf(using Type[T]): Expr[T] extension [ThisTree <: Tree](self: ThisTree): /** Changes the owner of the symbols in the tree */ @@ -1235,7 +1235,7 @@ trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching => trait TypeTreeModule { this: TypeTree.type => /** Returns the tree of type or kind (TypeTree) of T */ - def of[T <: AnyKind](using tp: scala.quoted.Type[T]): TypeTree + def of[T <: AnyKind](using Type[T]): TypeTree } given TypeTreeMethods as TypeTreeMethods = TypeTreeMethodsImpl @@ -1822,7 +1822,7 @@ trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching => trait TypeReprModule { this: TypeRepr.type => /** Returns the type or kind (TypeRepr) of T */ - def of[T <: AnyKind](using tp: scala.quoted.Type[T]): TypeRepr + def of[T <: AnyKind](using Type[T]): TypeRepr /** Returns the type constructor of the runtime (erased) class */ def typeConstructorOf(clazz: Class[?]): TypeRepr @@ -1852,7 +1852,7 @@ trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching => * '{ val x: t = ... } * ``` */ - def asType: scala.quoted.Type[?] + def asType: Type[?] /** Is `self` type the same as `that` type? * This is the case iff `self <:< that` and `that <:< self`. @@ -3694,20 +3694,20 @@ trait QuoteContext { self: runtime.QuoteUnpickler & runtime.QuoteMatching => } - /** Type of a QuoteContext provided by a splice within a quote that took this context. + /** Type of a Quotes provided by a splice within a quote that took this context. * It is only required if working with the reflection API. * * Usually it is infered by the quotes an splices typing. But sometimes it is necessary * to explicitly state that a context is nested as in the following example: * * ```scala - * def run(using qctx: QuoteContext)(tree: qctx.reflect.Tree): Unit = + * def run(using Quotes)(tree: qctx.reflect.Tree): Unit = * def nested()(using qctx.Nested): Expr[Int] = '{ ${ makeExpr(tree) } + 1 } * '{ ${ nested() } + 2 } - * def makeExpr(using qctx: QuoteContext)(tree: qctx.reflect.Tree): Expr[Int] = ??? + * def makeExpr(using Quotes)(tree: qctx.reflect.Tree): Expr[Int] = ??? * ``` */ - type Nested = QuoteContext { + type Nested = Quotes { val reflect: self.reflect.type } diff --git a/library/src/scala/quoted/Unlifted.scala b/library/src/scala/quoted/Unlifted.scala index a939b52f23e4..d19bbcc8bf3e 100644 --- a/library/src/scala/quoted/Unlifted.scala +++ b/library/src/scala/quoted/Unlifted.scala @@ -12,22 +12,22 @@ object Unlifted { * } * ``` */ - def unapply[T](expr: Expr[T])(using unlift: Unliftable[T], qxtc: QuoteContext): Option[T] = - unlift.fromExpr(expr) + def unapply[T](expr: Expr[T])(using Unliftable[T])(using Quotes): Option[T] = + summon[Unliftable[T]].fromExpr(expr) /** Matches literal sequence of literal constant value expressions and return a sequence of values. * * Usage: * ```scala * inline def sum(args: Int*): Int = ${ sumExpr('args) } - * def sumExpr(argsExpr: Expr[Seq[Int]])(using QuoteContext): Expr[Int] = argsExpr match + * def sumExpr(argsExpr: Expr[Seq[Int]])(using Quotes): Expr[Int] = argsExpr match * case Varargs(Unlifted(args)) => * // args: Seq[Int] * ... * } * ``` */ - def unapply[T](exprs: Seq[Expr[T]])(using unlift: Unliftable[T], qctx: QuoteContext): Option[Seq[T]] = + def unapply[T](exprs: Seq[Expr[T]])(using unlift: Unliftable[T], qctx: Quotes): Option[Seq[T]] = exprs.foldRight(Option(List.empty[T])) { (elem, acc) => (elem, acc) match { case (Unlifted(value), Some(lst)) => Some(value :: lst) diff --git a/library/src/scala/quoted/Varargs.scala b/library/src/scala/quoted/Varargs.scala index 5638783a8505..114c062170a3 100644 --- a/library/src/scala/quoted/Varargs.scala +++ b/library/src/scala/quoted/Varargs.scala @@ -15,7 +15,7 @@ object Varargs { * '{ List(${Varargs(List(1, 2, 3))}: _*) } // equvalent to '{ List(1, 2, 3) } * ``` */ - def apply[T](xs: Seq[Expr[T]])(using tp: Type[T], qctx: QuoteContext): Expr[Seq[T]] = { + def apply[T](xs: Seq[Expr[T]])(using Type[T])(using Quotes): Expr[Seq[T]] = { import qctx.reflect._ Repeated(xs.map(Term.of).toList, TypeTree.of[T]).asExpr.asInstanceOf[Expr[Seq[T]]] } @@ -25,14 +25,14 @@ object Varargs { * Usage: * ```scala * inline def sum(args: Int*): Int = ${ sumExpr('args) } - * def sumExpr(argsExpr: Expr[Seq[Int]])(using QuoteContext): Expr[Int] = argsExpr match + * def sumExpr(argsExpr: Expr[Seq[Int]])(using Quotes): Expr[Int] = argsExpr match * case Varargs(argVarargs) => * // argVarargs: Seq[Expr[Int]] * ... * } * ``` */ - def unapply[T](expr: Expr[Seq[T]])(using qctx: QuoteContext): Option[Seq[Expr[T]]] = { + def unapply[T](expr: Expr[Seq[T]])(using Quotes): Option[Seq[Expr[T]]] = { import qctx.reflect._ def rec(tree: Term): Option[Seq[Expr[T]]] = tree match { case Typed(Repeated(elems, _), _) => Some(elems.map(x => x.asExpr.asInstanceOf[Expr[T]])) diff --git a/library/src/scala/quoted/qctx.scala b/library/src/scala/quoted/qctx.scala index 62582d5aa888..22039764d928 100644 --- a/library/src/scala/quoted/qctx.scala +++ b/library/src/scala/quoted/qctx.scala @@ -1,4 +1,4 @@ package scala.quoted -/** Current QuoteContext in scope */ -def qctx(using qctx: QuoteContext): qctx.type = qctx +/** Current Quotes in scope */ +def qctx(using q: Quotes): q.type = q diff --git a/library/src/scala/quoted/report.scala b/library/src/scala/quoted/report.scala index 2c42a2bc4124..98374189870d 100644 --- a/library/src/scala/quoted/report.scala +++ b/library/src/scala/quoted/report.scala @@ -3,33 +3,33 @@ package scala.quoted object report: /** Report an error at the position of the macro expansion */ - def error(msg: => String)(using qctx: QuoteContext): Unit = + def error(msg: => String)(using Quotes): Unit = import qctx.reflect._ Reporting.error(msg, Position.ofMacroExpansion) /** Report an error at the on the position of `expr` */ - def error(msg: => String, expr: Expr[Any])(using qctx: QuoteContext): Unit = + def error(msg: => String, expr: Expr[Any])(using Quotes): Unit = import qctx.reflect._ Reporting.error(msg, Term.of(expr).pos) /** Report an error at the position of the macro expansion and throws a StopMacroExpansion */ - def throwError(msg: => String)(using qctx: QuoteContext): Nothing = { + def throwError(msg: => String)(using Quotes): Nothing = { error(msg) throw new runtime.StopMacroExpansion } /** Report an error at the on the position of `expr` and throws a StopMacroExpansion */ - def throwError(msg: => String, expr: Expr[Any])(using qctx: QuoteContext): Nothing = { + def throwError(msg: => String, expr: Expr[Any])(using Quotes): Nothing = { error(msg, expr) throw new runtime.StopMacroExpansion } /** Report a warning */ - def warning(msg: => String)(using qctx: QuoteContext): Unit = + def warning(msg: => String)(using Quotes): Unit = import qctx.reflect._ Reporting.warning(msg, Position.ofMacroExpansion) /** Report a warning at the on the position of `expr` */ - def warning(msg: => String, expr: Expr[Any])(using qctx: QuoteContext): Unit = + def warning(msg: => String, expr: Expr[Any])(using Quotes): Unit = import qctx.reflect._ Reporting.warning(msg, Term.of(expr).pos) diff --git a/library/src/scala/quoted/runtime/Expr.scala b/library/src/scala/quoted/runtime/Expr.scala index 46301efa2268..15a5518c4a8c 100644 --- a/library/src/scala/quoted/runtime/Expr.scala +++ b/library/src/scala/quoted/runtime/Expr.scala @@ -8,14 +8,14 @@ object Expr: /** A term quote is desugared by the compiler into a call to this method */ @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.quote`") - def quote[T](x: T): QuoteContext ?=> scala.quoted.Expr[T] = ??? + def quote[T](x: T): Quotes ?=> scala.quoted.Expr[T] = ??? /** A term splice is desugared by the compiler into a call to this method */ @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.splice`") - def splice[T](x: QuoteContext ?=> scala.quoted.Expr[T]): T = ??? + def splice[T](x: Quotes ?=> scala.quoted.Expr[T]): T = ??? /** A term splice nested within a quote is desugared by the compiler into a call to this method. - * `ctx` is the `QuoteContext` that the quote of this splice uses. + * `ctx` is the `Quotes` that the quote of this splice uses. */ @compileTimeOnly("Illegal reference to `scala.quoted.runtime.Expr.nestedSplice`") - def nestedSplice[T](ctx: QuoteContext)(x: ctx.Nested ?=> scala.quoted.Expr[T]): T = ??? + def nestedSplice[T](q: Quotes)(x: q.Nested ?=> scala.quoted.Expr[T]): T = ??? diff --git a/library/src/scala/quoted/runtime/QuoteMatching.scala b/library/src/scala/quoted/runtime/QuoteMatching.scala index 27e0b1656de8..853e119955de 100644 --- a/library/src/scala/quoted/runtime/QuoteMatching.scala +++ b/library/src/scala/quoted/runtime/QuoteMatching.scala @@ -1,8 +1,8 @@ package scala.quoted.runtime -import scala.quoted.{QuoteContext, Expr, Type} +import scala.quoted.{Expr, Type} -/** Part of the QuoteContext interface that needs to be implemented by the compiler but is not visible to users */ +/** Part of the Quotes interface that needs to be implemented by the compiler but is not visible to users */ trait QuoteMatching: val ExprMatch: ExprMatchModule @@ -26,7 +26,7 @@ trait QuoteMatching: * @param scrutinee `Expr[Any]` on which we are pattern matching * @param pattern `Expr[Any]` containing the pattern tree * @param hasTypeSplices `Boolean` notify if the pattern has type splices - * @param qctx the current QuoteContext + * @param qctx the current Quotes * @return None if it did not match, `Some(tup)` if it matched where `tup` contains `Expr[Ti]`` */ def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutinee: Expr[Any])(using pattern: Expr[Any]): Option[Tup] @@ -41,7 +41,7 @@ trait QuoteMatching: * @param scrutinee `Type[?]` on which we are pattern matching * @param pattern `Type[?]` containing the pattern tree * @param hasTypeSplices `Boolean` notify if the pattern has type splices - * @param qctx the current QuoteContext + * @param qctx the current Quotes * @return None if it did not match, `Some(tup)` if it matched where `tup` contains `Type[Ti]`` */ def unapply[TypeBindings <: Tuple, Tup <: Tuple](scrutinee: Type[?])(using pattern: Type[?]): Option[Tup] diff --git a/library/src/scala/quoted/runtime/QuoteUnpickler.scala b/library/src/scala/quoted/runtime/QuoteUnpickler.scala index 07f57a843fcd..2d8ef54eb9e6 100644 --- a/library/src/scala/quoted/runtime/QuoteUnpickler.scala +++ b/library/src/scala/quoted/runtime/QuoteUnpickler.scala @@ -1,17 +1,17 @@ package scala.quoted.runtime -import scala.quoted.{QuoteContext, Expr, Type} +import scala.quoted.{Quotes, Expr, Type} -/** Part of the QuoteContext interface that needs to be implemented by the compiler but is not visible to users */ +/** Part of the Quotes interface that needs to be implemented by the compiler but is not visible to users */ trait QuoteUnpickler: /** Unpickle `repr` which represents a pickled `Expr` tree, * replacing splice nodes with `holes` */ - def unpickleExpr[T](pickled: String | List[String], typeHole: (Int, Seq[Any]) => Type[?], termHole: (Int, Seq[Any], QuoteContext) => Expr[?]): scala.quoted.Expr[T] + def unpickleExpr[T](pickled: String | List[String], typeHole: (Int, Seq[Any]) => Type[?], termHole: (Int, Seq[Any], Quotes) => Expr[?]): scala.quoted.Expr[T] /** Unpickle `repr` which represents a pickled `Type` tree, * replacing splice nodes with `holes` */ - def unpickleType[T <: AnyKind](pickled: String | List[String], typeHole: (Int, Seq[Any]) => Type[?], termHole: (Int, Seq[Any], QuoteContext) => Expr[?]): scala.quoted.Type[T] + def unpickleType[T <: AnyKind](pickled: String | List[String], typeHole: (Int, Seq[Any]) => Type[?], termHole: (Int, Seq[Any], Quotes) => Expr[?]): scala.quoted.Type[T] 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 c9f2f7f5157a..058c42510c28 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 @@ -41,7 +41,7 @@ object Main { code } - def powerCode(n: Int, x: Expr[Double])(using QuoteContext): Expr[Double] = + def powerCode(n: Int, x: Expr[Double])(using Quotes): 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.") diff --git a/sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala b/sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala index e6503fddc2ce..80d5c543547b 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala +++ b/sbt-dotty/sbt-test/sbt-dotty/tasty-inspector-example-project/app/Main.scala @@ -10,7 +10,7 @@ import java.nio.file.{Path, Files, Paths, FileSystems} object Main extends App { val inspector = new TastyInspector { - protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = { + protected def processCompilationUnit(using Quotes)(root: qctx.reflect.Tree): Unit = { import qctx.reflect._ val tastyStr = root.show diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/Macro.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/Macro.scala index abc5619f4808..ed9e14a59728 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/Macro.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/Macro.scala @@ -4,7 +4,7 @@ object Macro { inline def f(): Unit = ${ macroImplementation } - def macroImplementation(using QuoteContext): Expr[Unit] = { + def macroImplementation(using Quotes): Expr[Unit] = { '{ println("Implementation in Macro") } } diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/MacroCompileError.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/MacroCompileError.scala index 3fe67ccc13e8..4f7bdaa43efa 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/MacroCompileError.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/MacroCompileError.scala @@ -4,7 +4,7 @@ object Macro { inline def f(): Unit = ${ macroImplementation } - def macroImplementation(using qctx: QuoteContext): Expr[Unit] = { + def macroImplementation(using Quotes): Expr[Unit] = { import qctx.reflect._ error("some error", rootPosition) '{ println("Implementation in MacroCompileError") } diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/MacroRuntimeError.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/MacroRuntimeError.scala index 69aef00d8ee0..2be43fa2fcab 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/MacroRuntimeError.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-1/changes/MacroRuntimeError.scala @@ -4,7 +4,7 @@ object Macro { inline def f(): Unit = ${ macroImplementation } - def macroImplementation(using qctx: QuoteContext): Expr[Unit] = { + def macroImplementation(using Quotes): Expr[Unit] = { '{ ??? } } diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/Macro.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/Macro.scala index 1e8ffe26af6b..58dc14c26f00 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/Macro.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/Macro.scala @@ -4,7 +4,7 @@ object Macro { inline def f(): Unit = ${ macroImplementation } - def macroImplementation(using QuoteContext): Expr[Unit] = + def macroImplementation(using Quotes): Expr[Unit] = MacroRuntime.impl() diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntime.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntime.scala index 049626fa3810..6fdc60019eb6 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntime.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntime.scala @@ -2,7 +2,7 @@ import scala.quoted._ object MacroRuntime { - def impl()(using QuoteContext): Expr[Unit] = { + def impl()(using Quotes): Expr[Unit] = { '{ println("Implementation in Macro") } } diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeCompileError.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeCompileError.scala index b2783d55488c..c0f1eb93795f 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeCompileError.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeCompileError.scala @@ -2,7 +2,7 @@ import scala.quoted._ object MacroRuntime { - def impl()(using qctx: QuoteContext): Expr[Unit] = { + def impl()(using Quotes): Expr[Unit] = { import qctx.reflect._ error("some error", rootPosition) '{ println("Implementation in MacroCompileError") } diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeRuntimeError.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeRuntimeError.scala index 41e823c63cda..caa79c3d24b5 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeRuntimeError.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeRuntimeError.scala @@ -2,7 +2,7 @@ import scala.quoted._ object MacroRuntime { - def impl()(using qctx: QuoteContext): Expr[Unit] = { + def impl()(using Quotes): Expr[Unit] = { '{ ??? } } diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-3/Macros.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-3/Macros.scala index a586bb70b5ca..4f2ae0ce586e 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-3/Macros.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-3/Macros.scala @@ -4,7 +4,7 @@ object Macros { inline def foo: A = ${ fooImpl } - def fooImpl(using qctx: QuoteContext): Expr[A] = { + def fooImpl(using Quotes): Expr[A] = { new B().f '{ new A; } } diff --git a/scala3doc/src/dotty/dokka/tasty/SymOps.scala b/scala3doc/src/dotty/dokka/tasty/SymOps.scala index d4843c3a4ae2..97664bfe1e59 100644 --- a/scala3doc/src/dotty/dokka/tasty/SymOps.scala +++ b/scala3doc/src/dotty/dokka/tasty/SymOps.scala @@ -10,7 +10,7 @@ import dotty.dokka.model.api.Modifier import scala.quoted._ -class SymOps[Q <: QuoteContext](val q: Q): +class SymOps[Q <: Quotes](val q: Q): import q.reflect._ given Q = q diff --git a/scala3doc/src/dotty/dokka/tasty/SyntheticSupport.scala b/scala3doc/src/dotty/dokka/tasty/SyntheticSupport.scala index a3f03af65481..da7accc67369 100644 --- a/scala3doc/src/dotty/dokka/tasty/SyntheticSupport.scala +++ b/scala3doc/src/dotty/dokka/tasty/SyntheticSupport.scala @@ -12,15 +12,15 @@ trait SyntheticsSupport: def isCompiletimeAppliedType: Boolean = hackIsCompiletimeAppliedType(using qctx)(t) - def hackIsTupleType(using QuoteContext)(rtpe: qctx.reflect.TypeRepr): Boolean = + def hackIsTupleType(using Quotes)(rtpe: qctx.reflect.TypeRepr): Boolean = import dotty.tools.dotc - given ctx as dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuoteContextImpl].ctx + given ctx as dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx val tpe = rtpe.asInstanceOf[dotc.core.Types.Type] ctx.definitions.isTupleType(tpe) - def hackIsCompiletimeAppliedType(using QuoteContext)(rtpe: qctx.reflect.TypeRepr): Boolean = + def hackIsCompiletimeAppliedType(using Quotes)(rtpe: qctx.reflect.TypeRepr): Boolean = import dotty.tools.dotc - given ctx as dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuoteContextImpl].ctx + given ctx as dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx val tpe = rtpe.asInstanceOf[dotc.core.Types.Type] ctx.definitions.isCompiletimeAppliedType(tpe.typeSymbol) @@ -52,10 +52,10 @@ trait SyntheticsSupport: } // TODO: #49 Remove it after TASTY-Reflect release with published flag Extension - def hackIsInfix(using QuoteContext)(rsym: qctx.reflect.Symbol): Boolean = { + def hackIsInfix(using Quotes)(rsym: qctx.reflect.Symbol): Boolean = { import qctx.reflect._ import dotty.tools.dotc - given ctx as dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuoteContextImpl].ctx + given ctx as dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx val sym = rsym.asInstanceOf[dotc.core.Symbols.Symbol] ctx.definitions.isInfix(sym) } @@ -63,10 +63,10 @@ trait SyntheticsSupport: They are valdefs that describe case companion objects and cases from enum. TASTY crashed when calling _.tree on them. */ - def hackGetAllMembers(using QuoteContext)(rsym: qctx.reflect.Symbol): List[qctx.reflect.Symbol] = { + def hackGetAllMembers(using Quotes)(rsym: qctx.reflect.Symbol): List[qctx.reflect.Symbol] = { import qctx.reflect._ import dotty.tools.dotc - given ctx as dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuoteContextImpl].ctx + given ctx as dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx val sym = rsym.asInstanceOf[dotc.core.Symbols.Symbol] sym.typeRef.appliedTo(sym.typeParams.map(_.typeRef)).allMembers.iterator.map(_.symbol) .collect { @@ -77,10 +77,10 @@ trait SyntheticsSupport: }.toList } - def hackGetSupertypes(using QuoteContext)(rdef: qctx.reflect.ClassDef) = { + def hackGetSupertypes(using Quotes)(rdef: qctx.reflect.ClassDef) = { import qctx.reflect._ import dotty.tools.dotc - given dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuoteContextImpl].ctx + given dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx val classdef = rdef.asInstanceOf[dotc.ast.tpd.TypeDef] val ref = classdef.symbol.info.asInstanceOf[dotc.core.Types.ClassInfo].appliedRef val baseTypes: List[(dotc.core.Symbols.Symbol, dotc.core.Types.Type)] = @@ -88,12 +88,12 @@ trait SyntheticsSupport: baseTypes.asInstanceOf[List[(Symbol, TypeRepr)]] } - def getSupertypes(using QuoteContext)(c: ClassDef) = hackGetSupertypes(c).tail + def getSupertypes(using Quotes)(c: ClassDef) = hackGetSupertypes(c).tail def typeForClass(c: ClassDef): TypeRepr = import qctx.reflect._ import dotty.tools.dotc - given dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuoteContextImpl].ctx + given dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx val cSym = c.symbol.asInstanceOf[dotc.core.Symbols.Symbol] cSym.typeRef.appliedTo(cSym.typeParams.map(_.typeRef)).asInstanceOf[TypeRepr] diff --git a/scala3doc/src/dotty/dokka/tasty/TastyParser.scala b/scala3doc/src/dotty/dokka/tasty/TastyParser.scala index 699b8a7b2764..f660a7222884 100644 --- a/scala3doc/src/dotty/dokka/tasty/TastyParser.scala +++ b/scala3doc/src/dotty/dokka/tasty/TastyParser.scala @@ -14,7 +14,7 @@ import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.properties.PropertyContainerKt._ import org.jetbrains.dokka.model.properties.{WithExtraProperties} -import quoted.QuoteContext +import quoted.Quotes import scala.tasty.inspector.TastyInspector import dotty.dokka.model.api.withNewMembers import dotty.dokka.tasty.comments.MemberLookup @@ -43,7 +43,7 @@ case class SbtDokkaTastyInspector( import dotty.tools.dotc.core.Mode import dotty.tools.dotc.core.Phases.Phase import dotty.tools.dotc.fromtasty._ - import scala.quoted.runtime.impl.QuoteContextImpl + import scala.quoted.runtime.impl.QuotesImpl val parser: Parser = null @@ -87,7 +87,7 @@ case class SbtDokkaTastyInspector( override def phaseName: String = "tastyInspector" override def run(implicit ctx: Context): Unit = - val qctx = QuoteContextImpl() + val qctx = QuotesImpl() self.processCompilationUnit(using qctx)(ctx.compilationUnit.tpdTree.asInstanceOf[qctx.reflect.Tree]) end TastyInspectorPhase @@ -101,11 +101,11 @@ trait DokkaBaseTastyInspector: private val topLevels = Seq.newBuilder[Documentable] - def processCompilationUnit(using qctx: QuoteContext)(root: qctx.reflect.Tree): Unit = - val parser = new TastyParser(qctx, this, config) + def processCompilationUnit(using q: Quotes)(root: q.reflect.Tree): Unit = + val parser = new TastyParser(q, this, config) def driFor(link: String): Option[DRI] = - val symOps = new SymOps[qctx.type](qctx) + val symOps = new SymOps[q.type](q) import symOps._ Try(QueryParser(link).readQuery()).toOption.flatMap(q => MemberLookup.lookupOpt(q, None).map{ case (sym, _) => sym.dri} @@ -167,7 +167,7 @@ trait DokkaBaseTastyInspector: ) /** Parses a single Tasty compilation unit. */ -case class TastyParser(qctx: QuoteContext, inspector: DokkaBaseTastyInspector, config: DottyDokkaConfig) +case class TastyParser(qctx: Quotes, inspector: DokkaBaseTastyInspector, config: DottyDokkaConfig) extends ScaladocSupport with BasicSupport with TypesSupport with ClassLikeSupport with SyntheticsSupport with PackageSupport with NameNormalizer: import qctx.reflect._ diff --git a/scala3doc/src/dotty/dokka/tasty/comments/Comments.scala b/scala3doc/src/dotty/dokka/tasty/comments/Comments.scala index 0d52be0bb2df..8cf0c474c4df 100644 --- a/scala3doc/src/dotty/dokka/tasty/comments/Comments.scala +++ b/scala3doc/src/dotty/dokka/tasty/comments/Comments.scala @@ -10,7 +10,7 @@ import com.vladsch.flexmark.util.options.MutableDataSet import scala.quoted._ -class Repr(val qctx: QuoteContext)(val sym: qctx.reflect.Symbol) +class Repr(val qctx: Quotes)(val sym: qctx.reflect.Symbol) case class Comment ( body: dkkd.DocTag, diff --git a/scala3doc/src/dotty/dokka/tasty/comments/MemberLookup.scala b/scala3doc/src/dotty/dokka/tasty/comments/MemberLookup.scala index 7757b42932ee..c2082b93bf9a 100644 --- a/scala3doc/src/dotty/dokka/tasty/comments/MemberLookup.scala +++ b/scala3doc/src/dotty/dokka/tasty/comments/MemberLookup.scala @@ -4,12 +4,12 @@ import scala.quoted._ trait MemberLookup { - def lookup(using QuoteContext)( + def lookup(using Quotes)( query: Query, owner: qctx.reflect.Symbol, ): Option[(qctx.reflect.Symbol, String)] = lookupOpt(query, Some(owner)) - def lookupOpt(using QuoteContext)( + def lookupOpt(using Quotes)( query: Query, ownerOpt: Option[qctx.reflect.Symbol], ): Option[(qctx.reflect.Symbol, String)] = @@ -59,24 +59,24 @@ trait MemberLookup { println(s"[WARN] Unable to find a link for ${query} ${ownerOpt.fold("")(o => "in " + o.name)}") None - private def hackMembersOf(using QuoteContext)(rsym: qctx.reflect.Symbol) = { + private def hackMembersOf(using Quotes)(rsym: qctx.reflect.Symbol) = { import qctx.reflect._ import dotty.tools.dotc - given dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuoteContextImpl].ctx + given dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx val sym = rsym.asInstanceOf[dotc.core.Symbols.Symbol] val members = sym.info.decls.iterator.filter(_.isCompleted) // println(s"members of ${sym.show} : ${members.map(_.show).mkString(", ")}") members.asInstanceOf[Iterator[Symbol]] } - private def hackIsNotAbsent(using QuoteContext)(rsym: qctx.reflect.Symbol) = { + private def hackIsNotAbsent(using Quotes)(rsym: qctx.reflect.Symbol) = { import dotty.tools.dotc - given dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuoteContextImpl].ctx + given dotc.core.Contexts.Context = qctx.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx val sym = rsym.asInstanceOf[dotc.core.Symbols.Symbol] sym.isCompleted } - private def localLookup(using QuoteContext)(query: String, owner: qctx.reflect.Symbol): Option[qctx.reflect.Symbol] = { + private def localLookup(using Quotes)(query: String, owner: qctx.reflect.Symbol): Option[qctx.reflect.Symbol] = { import qctx.reflect._ inline def whenExists(s: Symbol)(otherwise: => Option[Symbol]): Option[Symbol] = @@ -129,7 +129,7 @@ trait MemberLookup { } } - private def downwardLookup(using QuoteContext)(query: List[String], owner: qctx.reflect.Symbol): Option[qctx.reflect.Symbol] = + private def downwardLookup(using Quotes)(query: List[String], owner: qctx.reflect.Symbol): Option[qctx.reflect.Symbol] = query match { case Nil => None case q :: Nil => localLookup(q, owner) diff --git a/scala3doc/test/dotty/dokka/tasty/comments/MemberLookupTests.scala b/scala3doc/test/dotty/dokka/tasty/comments/MemberLookupTests.scala index dd9100fafbef..d7dbbd1d0dcd 100644 --- a/scala3doc/test/dotty/dokka/tasty/comments/MemberLookupTests.scala +++ b/scala3doc/test/dotty/dokka/tasty/comments/MemberLookupTests.scala @@ -1,12 +1,12 @@ package dotty.dokka.tasty.comments -import scala.quoted.QuoteContext +import scala.quoted.Quotes import org.junit.{Test, Rule} import org.junit.Assert.{assertSame, assertTrue} import dotty.dokka.BuildInfo -class LookupTestCases[Q <: QuoteContext](val q: QuoteContext) { +class LookupTestCases[Q <: Quotes](val q: Quotes) { def testAll(): Unit = { testOwnerlessLookup() @@ -105,12 +105,12 @@ class MemberLookupTests { class Inspector extends TastyInspector: var alreadyRan: Boolean = false - override def processCompilationUnit(using ctx: quoted.QuoteContext)(root: ctx.reflect.Tree): Unit = + override def processCompilationUnit(using ctx: quoted.Quotes)(root: ctx.reflect.Tree): Unit = if !alreadyRan then this.test() alreadyRan = true - def test()(using q: QuoteContext): Unit = { + def test()(using q: Quotes): Unit = { import dotty.dokka.tasty.comments.MemberLookup val cases = LookupTestCases[q.type](q) diff --git a/staging/src/scala/quoted/staging/ExprCompilationUnit.scala b/staging/src/scala/quoted/staging/ExprCompilationUnit.scala index 39f650f11ce1..6f95c252fd9d 100644 --- a/staging/src/scala/quoted/staging/ExprCompilationUnit.scala +++ b/staging/src/scala/quoted/staging/ExprCompilationUnit.scala @@ -5,4 +5,4 @@ import dotty.tools.dotc.CompilationUnit import dotty.tools.dotc.util.NoSource /** Compilation unit containing the contents of a quoted expression */ -private class ExprCompilationUnit(val exprBuilder: QuoteContext => Expr[_]) extends CompilationUnit(NoSource) +private class ExprCompilationUnit(val exprBuilder: Quotes => Expr[_]) extends CompilationUnit(NoSource) diff --git a/staging/src/scala/quoted/staging/QuoteCompiler.scala b/staging/src/scala/quoted/staging/QuoteCompiler.scala index 6c8c40ace3aa..637d02a5492e 100644 --- a/staging/src/scala/quoted/staging/QuoteCompiler.scala +++ b/staging/src/scala/quoted/staging/QuoteCompiler.scala @@ -21,11 +21,11 @@ import dotty.tools.dotc.util.Spans.Span import dotty.tools.dotc.util.SourceFile import dotty.tools.io.{Path, VirtualFile} -import scala.quoted.runtime.impl.QuoteContextImpl +import scala.quoted.runtime.impl.QuotesImpl import scala.annotation.tailrec import scala.concurrent.Promise -import scala.quoted.{Expr, QuoteContext, Type} +import scala.quoted.{Expr, Quotes, Type} /** Compiler that takes the contents of a quoted expression `expr` and produces * a class file with `class ' { def apply: Object = expr }`. @@ -70,7 +70,7 @@ private class QuoteCompiler extends Compiler: val quoted = given Context = unitCtx.withOwner(meth) - val qctx = QuoteContextImpl() + val qctx = QuotesImpl() val quoted = PickledQuotes.quotedExprToTree(exprUnit.exprBuilder.apply(qctx)) checkEscapedVariables(quoted, meth) end quoted @@ -104,7 +104,7 @@ private class QuoteCompiler extends Compiler: /** Unpickle and optionally compile the expression. * Returns either `Left` with name of the classfile generated or `Right` with the value contained in the expression. */ - def compileExpr(exprBuilder: QuoteContext => Expr[_]): Either[String, Any] = + def compileExpr(exprBuilder: Quotes => Expr[_]): Either[String, Any] = val units = new ExprCompilationUnit(exprBuilder) :: Nil compileUnits(units) result diff --git a/staging/src/scala/quoted/staging/QuoteDriver.scala b/staging/src/scala/quoted/staging/QuoteDriver.scala index 2f1fd628f839..505657fdbbb5 100644 --- a/staging/src/scala/quoted/staging/QuoteDriver.scala +++ b/staging/src/scala/quoted/staging/QuoteDriver.scala @@ -22,7 +22,7 @@ private class QuoteDriver(appClassloader: ClassLoader) extends Driver: private[this] val contextBase: ContextBase = new ContextBase - def run[T](exprBuilder: QuoteContext => Expr[T], settings: Toolbox.Settings): T = + def run[T](exprBuilder: Quotes => Expr[T], settings: Toolbox.Settings): T = val outDir: AbstractFile = settings.outDir match case Some(out) => diff --git a/staging/src/scala/quoted/staging/Toolbox.scala b/staging/src/scala/quoted/staging/Toolbox.scala index 3763bd9c49bb..e8fa611455c6 100644 --- a/staging/src/scala/quoted/staging/Toolbox.scala +++ b/staging/src/scala/quoted/staging/Toolbox.scala @@ -7,7 +7,7 @@ import scala.quoted.runtime.impl.ScopeException @implicitNotFound("Could not find implicit scala.quoted.staging.Toolbox.\n\nDefault toolbox can be instantiated with:\n `given scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader)`\n\n") trait Toolbox: - def run[T](expr: QuoteContext => Expr[T]): T + def run[T](expr: Quotes => Expr[T]): T object Toolbox: @@ -30,7 +30,7 @@ object Toolbox: private[this] var running = false - def run[T](exprBuilder: QuoteContext => Expr[T]): T = synchronized { + def run[T](exprBuilder: Quotes => Expr[T]): T = synchronized { try if (running) // detected nested run throw new ScopeException("Cannot call `scala.quoted.staging.run(...)` within a another `run(...)`") diff --git a/staging/src/scala/quoted/staging/staging.scala b/staging/src/scala/quoted/staging/staging.scala index a4be3ca9c783..ef3bcc832397 100644 --- a/staging/src/scala/quoted/staging/staging.scala +++ b/staging/src/scala/quoted/staging/staging.scala @@ -3,45 +3,45 @@ 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. + * It provides a new Quotes that is only valid within the scope the argument. * * Usage: * ``` - * val e: T = run { // (using qctx: QuoteContext) => + * val e: T = run { // (using Quotes) => * 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`. + * This method should not be called in a context where there is already has a `Quotes` + * such as within a `run` or a `withQuotes`. */ - def run[T](expr: QuoteContext ?=> Expr[T])(using toolbox: Toolbox): T = toolbox.run(expr(using _)) + def run[T](expr: Quotes ?=> Expr[T])(using toolbox: Toolbox): T = toolbox.run(expr(using _)) /** 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 { // (using qctx: QuoteContext) => + * val e: T = withQuotes { // (using Quotes) => * 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`. + * This method should not be called in a context where there is already has a `Quotes` + * such as within a `run` or a `withQuotes`. */ - def withQuoteContext[T](thunk: QuoteContext ?=> T)(using toolbox: Toolbox): T = + def withQuotes[T](thunk: Quotes ?=> T)(using toolbox: Toolbox): T = val noResult = new Object var result: T = noResult.asInstanceOf[T] - def dummyRun(using QuoteContext): Expr[Unit] = { + def dummyRun(using Quotes): Expr[Unit] = { result = thunk '{} } toolbox.run(dummyRun(using _)) assert(result != noResult) // toolbox.run should have thrown an exception result - end withQuoteContext + end withQuotes end staging diff --git a/staging/test-resources/repl-staging/i6007 b/staging/test-resources/repl-staging/i6007 index e8efbbcf9d9c..e4a1bf0fb232 100644 --- a/staging/test-resources/repl-staging/i6007 +++ b/staging/test-resources/repl-staging/i6007 @@ -2,9 +2,9 @@ scala> import scala.quoted._ scala> import scala.quoted.staging._ scala> implicit def toolbox: Toolbox = Toolbox.make(getClass.getClassLoader) def toolbox: quoted.staging.Toolbox -scala> def v(using QuoteContext) = '{ (if true then Some(1) else None).map(v => v+1) } -def v(using x$1: quoted.QuoteContext): quoted.Expr[Option[Int]] -scala> scala.quoted.staging.withQuoteContext(v.show) +scala> def v(using Quotes) = '{ (if true then Some(1) else None).map(v => v+1) } +def v(using x$1: quoted.Quotes): quoted.Expr[Option[Int]] +scala> scala.quoted.staging.withQuotes(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.staging.run(v) val res1: Option[Int] = Some(2) diff --git a/staging/test-resources/repl-staging/i6263 b/staging/test-resources/repl-staging/i6263 index 2dd3e41cc695..e7c03b29015e 100644 --- a/staging/test-resources/repl-staging/i6263 +++ b/staging/test-resources/repl-staging/i6263 @@ -4,9 +4,9 @@ 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") } +scala> withQuotes { fn("foo") } ok -scala> withQuoteContext { fn((1,2)) } +scala> withQuotes { fn((1,2)) } ok -scala> withQuoteContext { fn(1) } +scala> withQuotes { fn(1) } ok diff --git a/stdlib-bootstrapped-tasty-tests/test/BootstrappedStdLibTASYyTest.scala b/stdlib-bootstrapped-tasty-tests/test/BootstrappedStdLibTASYyTest.scala index f963c68da1e8..51df7617e96d 100644 --- a/stdlib-bootstrapped-tasty-tests/test/BootstrappedStdLibTASYyTest.scala +++ b/stdlib-bootstrapped-tasty-tests/test/BootstrappedStdLibTASYyTest.scala @@ -102,7 +102,7 @@ object BootstrappedStdLibTASYyTest: def loadWithTastyInspector(blacklisted: Set[String]): Unit = val inspector = new scala.tasty.inspector.TastyInspector { - def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = + def processCompilationUnit(using Quotes)(root: qctx.reflect.Tree): Unit = root.showExtractors // Check that we can traverse the full tree () } diff --git a/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala b/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala index 2d1396eafada..99a2837a1d65 100644 --- a/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala +++ b/tasty-inspector/src/scala/tasty/inspector/TastyInspector.scala @@ -1,7 +1,7 @@ package scala.tasty.inspector import scala.quoted._ -import scala.quoted.runtime.impl.QuoteContextImpl +import scala.quoted.runtime.impl.QuotesImpl import dotty.tools.dotc.Compiler import dotty.tools.dotc.Driver @@ -20,10 +20,10 @@ trait TastyInspector: self => /** Process a TASTy file using TASTy reflect */ - protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit + protected def processCompilationUnit(using Quotes)(root: qctx.reflect.Tree): Unit /** Called after all compilation units are processed */ - protected def postProcess(using QuoteContext): Unit = () + protected def postProcess(using Quotes): Unit = () /** Load and process TASTy files using TASTy reflect * @@ -90,7 +90,7 @@ trait TastyInspector: override def phaseName: String = "tastyInspector" override def run(implicit ctx: Context): Unit = - val qctx = QuoteContextImpl() + val qctx = QuotesImpl() self.processCompilationUnit(using qctx)(ctx.compilationUnit.tpdTree.asInstanceOf[qctx.reflect.Tree]) end TastyInspectorPhase @@ -100,7 +100,7 @@ trait TastyInspector: override def phaseName: String = "tastyInspectorFinish" override def runOn(units: List[CompilationUnit])(using Context): List[CompilationUnit] = - val qctx = QuoteContextImpl() + val qctx = QuotesImpl() self.postProcess(using qctx) units diff --git a/tests/bench/power-macro/PowerMacro.scala b/tests/bench/power-macro/PowerMacro.scala index c43345969989..80936d29e69e 100644 --- a/tests/bench/power-macro/PowerMacro.scala +++ b/tests/bench/power-macro/PowerMacro.scala @@ -4,10 +4,10 @@ object PowerMacro { inline def power(inline n: Long, x: Double) = ${ powerCode('n, 'x) } - def powerCode(n: Expr[Long], x: Expr[Double])(using QuoteContext): Expr[Double] = + def powerCode(n: Expr[Long], x: Expr[Double])(using Quotes): Expr[Double] = powerCode(n.unliftOrError, x) - def powerCode(n: Long, x: Expr[Double])(using QuoteContext): Expr[Double] = + def powerCode(n: Long, x: Expr[Double])(using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n % 2 == 0) '{ val y = $x * $x; ${powerCode(n / 2, 'y)} } else '{ $x * ${powerCode(n - 1, x)} } diff --git a/tests/bench/string-interpolation-macro/Macro.scala b/tests/bench/string-interpolation-macro/Macro.scala index 92d9a2cbe6fa..9b2f2f208108 100644 --- a/tests/bench/string-interpolation-macro/Macro.scala +++ b/tests/bench/string-interpolation-macro/Macro.scala @@ -5,7 +5,7 @@ object Macro { extension (inline sc: StringContext): inline def x(inline args: Int*): String = ${ code('sc, 'args) } - def code(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Int]])(using QuoteContext): Expr[String] = + def code(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Int]])(using Quotes): Expr[String] = var res: Expr[String] = null for _ <- 0 to 5_000 do (strCtxExpr, argsExpr) match { 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 1ad6fa566907..67e93c47db4e 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 @@ -3,7 +3,7 @@ import scala.quoted._ object Macros { inline def foo(i: => Int): Int = ${ fooImpl('i) } - def fooImpl(i: Expr[Int])(using QuoteContext): Expr[Int] = { + def fooImpl(i: Expr[Int])(using Quotes): Expr[Int] = { given Toolbox = Toolbox.make(getClass.getClassLoader) val y: Int = run(i) y diff --git a/tests/disabled/pos-macros/i3898c/quoted_1.scala b/tests/disabled/pos-macros/i3898c/quoted_1.scala index a09baa5e9f6b..78d88158c05c 100644 --- a/tests/disabled/pos-macros/i3898c/quoted_1.scala +++ b/tests/disabled/pos-macros/i3898c/quoted_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macro { inline def ff(x: Int, inline y: Int): String = ${impl('x)} - def impl(x: Expr[Int])(using QuoteContext): Expr[String] = '{""} + def impl(x: Expr[Int])(using Quotes): Expr[String] = '{""} } diff --git a/tests/disabled/pos-macros/i3898c/quoted_2.scala b/tests/disabled/pos-macros/i3898c/quoted_2.scala index b52af983c1d7..dc4f70fa1ad8 100644 --- a/tests/disabled/pos-macros/i3898c/quoted_2.scala +++ b/tests/disabled/pos-macros/i3898c/quoted_2.scala @@ -1,5 +1,5 @@ import scala.quoted._ -def test(using QuoteContext) = { +def test(using Quotes) = { val a = '{ def z: Int = 5 Macro.ff(z, 5) diff --git a/tests/disabled/pos-macros/i7853/SummonJsonEncoderTest_2.scala b/tests/disabled/pos-macros/i7853/SummonJsonEncoderTest_2.scala index 674500966c90..ad31a52c8ae5 100644 --- a/tests/disabled/pos-macros/i7853/SummonJsonEncoderTest_2.scala +++ b/tests/disabled/pos-macros/i7853/SummonJsonEncoderTest_2.scala @@ -6,7 +6,7 @@ object SummonJsonEncoderTest { inline def encodeAndMessAroundType[T](value: =>T): String = ${ encodeAndMessAroundTypeImpl('value) } - def encodeAndMessAroundTypeImpl[T: Type](value: Expr[T])(using qctx: QuoteContext): Expr[String] = { + def encodeAndMessAroundTypeImpl[T: Type](value: Expr[T])(using Quotes): Expr[String] = { import qctx.reflect._ val mirrorExpr = Expr.summon[Mirror.Of[T]] match { diff --git a/tests/disabled/run-macros/1.scala b/tests/disabled/run-macros/1.scala index 482d105c0595..e918760ee0e2 100644 --- a/tests/disabled/run-macros/1.scala +++ b/tests/disabled/run-macros/1.scala @@ -7,6 +7,6 @@ object Macro { inline def foo[X[_]](implicit inline m: Mirror { type MirroredType = X }): Int = ${ fooImpl } - def fooImpl[X[_]](implicit m: Mirror { type MirroredType = X }, qc: QuoteContext): Expr[Int] = + def fooImpl[X[_]](implicit m: Mirror { type MirroredType = X }, qc: Quotes): Expr[Int] = '{ 1 } } diff --git a/tests/disabled/run-staging/quote-macro-in-splice/quoted_1.scala b/tests/disabled/run-staging/quote-macro-in-splice/quoted_1.scala index 6dd7658f5083..eebc3448cdbe 100644 --- a/tests/disabled/run-staging/quote-macro-in-splice/quoted_1.scala +++ b/tests/disabled/run-staging/quote-macro-in-splice/quoted_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macros { - def impl(x: Expr[Int])(using QuoteContext): Expr[Int] = '{ $x + 1 } + def impl(x: Expr[Int])(using Quotes): Expr[Int] = '{ $x + 1 } } diff --git a/tests/disabled/run-staging/quote-macro-in-splice/quoted_2.scala b/tests/disabled/run-staging/quote-macro-in-splice/quoted_2.scala index a8dd1960d56c..329e32a9c910 100644 --- a/tests/disabled/run-staging/quote-macro-in-splice/quoted_2.scala +++ b/tests/disabled/run-staging/quote-macro-in-splice/quoted_2.scala @@ -4,7 +4,7 @@ import Macros._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val x = '{ val y = 1 ${ diff --git a/tests/neg-custom-args/fatal-warnings/quote-simple-hole.scala b/tests/neg-custom-args/fatal-warnings/quote-simple-hole.scala index 626b4d76787f..35308cc36161 100644 --- a/tests/neg-custom-args/fatal-warnings/quote-simple-hole.scala +++ b/tests/neg-custom-args/fatal-warnings/quote-simple-hole.scala @@ -1,6 +1,6 @@ -import scala.quoted.QuoteContext +import scala.quoted.Quotes -def test(using QuoteContext) = { +def test(using Quotes) = { val x = '{0} val y = '{ // error: Canceled splice directly inside a quote. '{ ${ XYZ } } is equivalent to XYZ. $x diff --git a/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala b/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala index 12614de4eac1..5eb0a288e6b3 100644 --- a/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala +++ b/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala @@ -4,7 +4,7 @@ import scala.util.FromDigits import scala.quoted._ object BigFloatFromDigitsImpl: - def apply(digits: Expr[String])(using QuoteContext): Expr[BigFloat] = + def apply(digits: Expr[String])(using Quotes): Expr[BigFloat] = digits match case Const(ds) => try diff --git a/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala b/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala index b7c78d2bd441..2ab330d46b2c 100644 --- a/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala +++ b/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala @@ -4,7 +4,7 @@ import scala.quoted._ import Even._ object EvenFromDigitsImpl: - def apply(digits: Expr[String])(using QuoteContext): Expr[Even] = digits match { + def apply(digits: Expr[String])(using Quotes): Expr[Even] = digits match { case Const(ds) => val ev = try evenFromDigits(ds) diff --git a/tests/neg-macros/beta-reduce-inline-result/Macro_1.scala b/tests/neg-macros/beta-reduce-inline-result/Macro_1.scala index bb78a02f5b60..748f2c4d5a41 100644 --- a/tests/neg-macros/beta-reduce-inline-result/Macro_1.scala +++ b/tests/neg-macros/beta-reduce-inline-result/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def betaReduce[Arg,Result](inline fn: Arg=>Result)(inline arg: Arg): Result = ${ betaReduceImpl('{ fn })('{ arg }) } - def betaReduceImpl[Arg: Type, Result: Type](fn: Expr[Arg=>Result])(arg: Expr[Arg])(using qctx: QuoteContext): Expr[Result] = + def betaReduceImpl[Arg: Type, Result: Type](fn: Expr[Arg=>Result])(arg: Expr[Arg])(using Quotes): Expr[Result] = Expr.betaReduce('{$fn($arg)}) } diff --git a/tests/neg-macros/delegate-match-1/Macro_1.scala b/tests/neg-macros/delegate-match-1/Macro_1.scala index 782fe8b2f4e3..00b51d19540c 100644 --- a/tests/neg-macros/delegate-match-1/Macro_1.scala +++ b/tests/neg-macros/delegate-match-1/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ inline def f: Any = ${ fImpl } -private def fImpl(using qctx: QuoteContext): Expr[Unit] = { +private def fImpl(using Quotes): Expr[Unit] = { import qctx.reflect._ Implicits.search(TypeRepr.of[A]) match { case x: ImplicitSearchSuccess => diff --git a/tests/neg-macros/delegate-match-2/Macro_1.scala b/tests/neg-macros/delegate-match-2/Macro_1.scala index e40f2f608e1d..ddeafd23e0c1 100644 --- a/tests/neg-macros/delegate-match-2/Macro_1.scala +++ b/tests/neg-macros/delegate-match-2/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ inline def f: Any = ${ fImpl } -private def fImpl (using qctx: QuoteContext) : Expr[Unit] = { +private def fImpl (using Quotes) : Expr[Unit] = { import qctx.reflect._ Implicits.search(TypeRepr.of[A]) match { case x: ImplicitSearchSuccess => diff --git a/tests/neg-macros/delegate-match-3/Macro_1.scala b/tests/neg-macros/delegate-match-3/Macro_1.scala index 3167e3152d4f..fa568f7b5e4c 100644 --- a/tests/neg-macros/delegate-match-3/Macro_1.scala +++ b/tests/neg-macros/delegate-match-3/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ inline def f: Any = ${ fImpl } -private def fImpl(using qctx: QuoteContext) : Expr[Unit] = { +private def fImpl(using Quotes) : Expr[Unit] = { import qctx.reflect._ Implicits.search(TypeRepr.of[A]) match { case x: ImplicitSearchSuccess => diff --git a/tests/neg-macros/i4044a.scala b/tests/neg-macros/i4044a.scala index c603386ba609..4424149488d2 100644 --- a/tests/neg-macros/i4044a.scala +++ b/tests/neg-macros/i4044a.scala @@ -1,16 +1,16 @@ import scala.quoted._ -def test(using QuoteContext) = { +def test(using Quotes) = { val a = '{1} '{ - val qctx: QuoteContext = ??? + val qctx: Quotes = ??? given qctx.type = qctx a // error $a '{$a} // error '{ - val qctx: QuoteContext = ??? + val qctx: Quotes = ??? given qctx.type = qctx '{$a} // error } diff --git a/tests/neg-macros/i4044b.scala b/tests/neg-macros/i4044b.scala index a81343c7c465..f8ebf884bbe2 100644 --- a/tests/neg-macros/i4044b.scala +++ b/tests/neg-macros/i4044b.scala @@ -1,22 +1,22 @@ import scala.quoted._ -def test(using QuoteContext) = { +def test(using Quotes) = { '{ - val qctx: QuoteContext = ??? + val qctx: Quotes = ??? given x1 as qctx.type = qctx val b = '{3} '{ - val qctx: QuoteContext = ??? + val qctx: Quotes = ??? given x2 as qctx.type = qctx b // error ${b} ${ '{b} } // error '{ - val qctx: QuoteContext = ??? + val qctx: Quotes = ??? given qctx.type = qctx '{$b} // error } diff --git a/tests/neg-macros/i4846.scala b/tests/neg-macros/i4846.scala index 0f53b55121d0..e8b666e10232 100644 --- a/tests/neg-macros/i4846.scala +++ b/tests/neg-macros/i4846.scala @@ -9,5 +9,5 @@ object Test { '{ '{ 'x } } // error ) } - def fooImpl(a: Int, b: Expr[Int], c: Expr[QuoteContext ?=> Expr[Int]], d: Expr[QuoteContext ?=> Expr[QuoteContext ?=> Expr[Int]]]): Expr[Int] = ??? + def fooImpl(a: Int, b: Expr[Int], c: Expr[Quotes ?=> Expr[Int]], d: Expr[Quotes ?=> Expr[Quotes ?=> Expr[Int]]]): Expr[Int] = ??? } diff --git a/tests/neg-macros/i5547.scala b/tests/neg-macros/i5547.scala index 36a36214063c..0f895e65d779 100644 --- a/tests/neg-macros/i5547.scala +++ b/tests/neg-macros/i5547.scala @@ -4,6 +4,6 @@ object scalatest { inline def assert2(condition: => Boolean): Unit = ${ assertImpl('condition, Expr("")) } // error - def assertImpl(condition: Expr[Boolean], clue: Expr[Any])(using QuoteContext): Expr[Unit] = + def assertImpl(condition: Expr[Boolean], clue: Expr[Any])(using Quotes): Expr[Unit] = '{} } diff --git a/tests/neg-macros/i5840.scala b/tests/neg-macros/i5840.scala index 05bbee5755c9..21adfa138b57 100644 --- a/tests/neg-macros/i5840.scala +++ b/tests/neg-macros/i5840.scala @@ -1,9 +1,9 @@ import scala.quoted._ object Test { - type Contextual[T] = QuoteContext ?=> T + type Contextual[T] = Quotes ?=> T - inline def i5_1[T](n: T)(implicit thisCtx: QuoteContext): T = ${ foo('n) } // OK + inline def i5_1[T](n: T)(implicit thisCtx: Quotes): T = ${ foo('n) } // OK inline def i5_2[T](n: T): Contextual[T] = ${ foo('n) } // error: Macros using `X ?=> Y` return types are not yet supported diff --git a/tests/neg-macros/i5954b.scala b/tests/neg-macros/i5954b.scala index c6cd22f7c261..86f5340ca63d 100644 --- a/tests/neg-macros/i5954b.scala +++ b/tests/neg-macros/i5954b.scala @@ -5,7 +5,7 @@ abstract class MatcherFactory1[A] { object MatcherFactory1 { import scala.quoted._ - def impl[T](self: Expr[MatcherFactory1[T]#AndNotWord])(using QuoteContext) = + def impl[T](self: Expr[MatcherFactory1[T]#AndNotWord])(using Quotes) = '{ val a: Any = $self } // error: access to type T from wrong staging level } diff --git a/tests/neg-macros/i5954c.scala b/tests/neg-macros/i5954c.scala index 8941701f8c06..94182d430d1d 100644 --- a/tests/neg-macros/i5954c.scala +++ b/tests/neg-macros/i5954c.scala @@ -5,7 +5,7 @@ abstract class MatcherFactory1 { object MatcherFactory1 { import scala.quoted._ - def impl[T](self: Expr[MatcherFactory1#AndNotWord[T]])(using QuoteContext) = + def impl[T](self: Expr[MatcherFactory1#AndNotWord[T]])(using Quotes) = '{ val a: Any = $self } // error: access to type T from wrong staging level } diff --git a/tests/neg-macros/i6432/Macro_1.scala b/tests/neg-macros/i6432/Macro_1.scala index 27cebe1290a2..039b5863d030 100644 --- a/tests/neg-macros/i6432/Macro_1.scala +++ b/tests/neg-macros/i6432/Macro_1.scala @@ -5,7 +5,7 @@ import scala.quoted._ object Macro { extension (inline sc: StringContext) inline def foo(args: String*): Unit = ${ impl('sc) } - def impl(sc: Expr[StringContext])(using qctx: QuoteContext) : Expr[Unit] = { + def impl(sc: Expr[StringContext])(using Quotes) : Expr[Unit] = { import qctx.reflect._ sc match { case '{ StringContext(${Varargs(parts)}: _*) } => diff --git a/tests/neg-macros/i6432b/Macro_1.scala b/tests/neg-macros/i6432b/Macro_1.scala index 27cebe1290a2..039b5863d030 100644 --- a/tests/neg-macros/i6432b/Macro_1.scala +++ b/tests/neg-macros/i6432b/Macro_1.scala @@ -5,7 +5,7 @@ import scala.quoted._ object Macro { extension (inline sc: StringContext) inline def foo(args: String*): Unit = ${ impl('sc) } - def impl(sc: Expr[StringContext])(using qctx: QuoteContext) : Expr[Unit] = { + def impl(sc: Expr[StringContext])(using Quotes) : Expr[Unit] = { import qctx.reflect._ sc match { case '{ StringContext(${Varargs(parts)}: _*) } => diff --git a/tests/neg-macros/i6436.check b/tests/neg-macros/i6436.check index 5fbefd8dc6e4..401217e747f4 100644 --- a/tests/neg-macros/i6436.check +++ b/tests/neg-macros/i6436.check @@ -1,7 +1,7 @@ -- Error: tests/neg-macros/i6436.scala:5:9 ----------------------------------------------------------------------------- 5 | case '{ StringContext(${Varargs(parts)}: _*) } => // error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | no implicit argument of type scala.quoted.QuoteContext was found + | no implicit argument of type scala.quoted.Quotes was found -- [E006] Not Found Error: tests/neg-macros/i6436.scala:6:34 ----------------------------------------------------------- 6 | val ps: Seq[Expr[String]] = parts // error | ^^^^^ diff --git a/tests/neg-macros/i6530b.scala b/tests/neg-macros/i6530b.scala index c8d0113ee67f..93462b2e302f 100644 --- a/tests/neg-macros/i6530b.scala +++ b/tests/neg-macros/i6530b.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Foo { - def program(using QuoteContext) = '{ + def program(using Quotes) = '{ val tpe: quoted.Type[Int] = ??? val expr: quoted.Expr[Int] = ??? diff --git a/tests/neg-macros/i6739.scala b/tests/neg-macros/i6739.scala index 177f701d4e76..c1a749c04fd6 100644 --- a/tests/neg-macros/i6739.scala +++ b/tests/neg-macros/i6739.scala @@ -3,4 +3,4 @@ import scala.quoted._ inline def assert(expr: => Boolean): Unit = ${ assertImpl('expr) } // error: Macro cannot be implemented with an `inline` method -inline def assertImpl(expr: Expr[Boolean])(using QuoteContext): Expr[Unit] = '{ println("Hello World") } +inline def assertImpl(expr: Expr[Boolean])(using Quotes): Expr[Unit] = '{ println("Hello World") } diff --git a/tests/neg-macros/i6762.scala b/tests/neg-macros/i6762.scala index c5b7bc7b487a..c5f1fb7c86b3 100644 --- a/tests/neg-macros/i6762.scala +++ b/tests/neg-macros/i6762.scala @@ -2,4 +2,4 @@ import scala.quoted._ type G[X] case class Foo[T](x: T) -def f(word: String)(using QuoteContext): Expr[Foo[G[String]]] = '{Foo(${Expr(word)})} // error // error +def f(word: String)(using Quotes): Expr[Foo[G[String]]] = '{Foo(${Expr(word)})} // error // error diff --git a/tests/neg-macros/i6976/Macro_1.scala b/tests/neg-macros/i6976/Macro_1.scala index 4245d2f2591a..18ecfb72a694 100644 --- a/tests/neg-macros/i6976/Macro_1.scala +++ b/tests/neg-macros/i6976/Macro_1.scala @@ -5,7 +5,7 @@ import scala.quoted._ object macros { inline def mcr(x: => Any) = ${mcrImpl('x)} - def mcrImpl(body: Expr[Any])(using ctx: QuoteContext) : Expr[Any] = { + def mcrImpl(body: Expr[Any])(using ctx: Quotes) : Expr[Any] = { import ctx.reflect._ Term.of(body) match { case Block(_, _) => '{2} } } diff --git a/tests/neg-macros/i6997.scala b/tests/neg-macros/i6997.scala index f48f8a8af2e6..b5ed4e9b3ae6 100644 --- a/tests/neg-macros/i6997.scala +++ b/tests/neg-macros/i6997.scala @@ -1,7 +1,7 @@ import scala.quoted._ class Foo { - def mcrImpl(body: Expr[Any])(using t: Type[_ <: Any])(using ctx: QuoteContext): Expr[Any] = '{ + def mcrImpl(body: Expr[Any])(using t: Type[_ <: Any])(using ctx: Quotes): Expr[Any] = '{ val tmp = ???.asInstanceOf[t.Underlying] // error // error tmp } diff --git a/tests/neg-macros/i6997b.scala b/tests/neg-macros/i6997b.scala index 52c9ed0f9e20..1726cb1b6473 100644 --- a/tests/neg-macros/i6997b.scala +++ b/tests/neg-macros/i6997b.scala @@ -4,7 +4,7 @@ import scala.quoted._ inline def mcr(x: => Any): Any = ${mcrImpl('x)} -def mcrImpl(body: Expr[Any])(using ctx: QuoteContext): Expr[Any] = { +def mcrImpl(body: Expr[Any])(using ctx: Quotes): Expr[Any] = { val '{$x: $t} = body // error '{ val tmp: $t = $x.asInstanceOf[$t] // error // error diff --git a/tests/neg-macros/i7013.scala b/tests/neg-macros/i7013.scala index 8892522ad508..22cbb307116a 100644 --- a/tests/neg-macros/i7013.scala +++ b/tests/neg-macros/i7013.scala @@ -1,6 +1,6 @@ import quoted._ -def foo()(using QuoteContext) = { +def foo()(using Quotes) = { class C Type[C] // error } diff --git a/tests/neg-macros/i7013b.scala b/tests/neg-macros/i7013b.scala index 917df1683f62..9ccdfe8e6b4f 100644 --- a/tests/neg-macros/i7013b.scala +++ b/tests/neg-macros/i7013b.scala @@ -2,7 +2,7 @@ import quoted._ class Foo { class Bar - def foo()(using QuoteContext) = { + def foo()(using Quotes) = { Type[Bar] // error } } diff --git a/tests/neg-macros/i7013c.scala b/tests/neg-macros/i7013c.scala index 32a02f77c876..d7e19653307b 100644 --- a/tests/neg-macros/i7013c.scala +++ b/tests/neg-macros/i7013c.scala @@ -1,6 +1,6 @@ import quoted._ -def foo()(using QuoteContext) = { +def foo()(using Quotes) = { type C Type[C] // error } diff --git a/tests/neg-macros/i7048e.scala b/tests/neg-macros/i7048e.scala index 7bce976792f8..70f1709037db 100644 --- a/tests/neg-macros/i7048e.scala +++ b/tests/neg-macros/i7048e.scala @@ -7,7 +7,7 @@ abstract class Test { val getT: Type[T] = T // need this to avoid getting `null` given Type[T] = getT - def foo(using QuoteContext): Expr[Any] = { + def foo(using Quotes): Expr[Any] = { val r = '{Option.empty[T]} // error: is not stable diff --git a/tests/neg-macros/i7052.scala b/tests/neg-macros/i7052.scala index 83cce3f13748..c2d6c021316f 100644 --- a/tests/neg-macros/i7052.scala +++ b/tests/neg-macros/i7052.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Test { - def foo(str: String)(using QuoteContext) = '{ + def foo(str: String)(using Quotes) = '{ @deprecated(str, "") // error def bar = ??? } diff --git a/tests/neg-macros/i7052b.scala b/tests/neg-macros/i7052b.scala index d15024092bcb..e60dc57fc05c 100644 --- a/tests/neg-macros/i7052b.scala +++ b/tests/neg-macros/i7052b.scala @@ -1,7 +1,7 @@ import scala.quoted._ class Test { - def foo(str: String)(using QuoteContext) = '{ - val qctx: QuoteContext = ??? + def foo(str: String)(using Quotes) = '{ + val qctx: Quotes = ??? given qctx.type = qctx '{ @deprecated(str, "") // error diff --git a/tests/neg-macros/i7121.scala b/tests/neg-macros/i7121.scala index 2ce78f8822e6..5a0a3852e70f 100644 --- a/tests/neg-macros/i7121.scala +++ b/tests/neg-macros/i7121.scala @@ -3,7 +3,7 @@ import scala.quoted._ class annot1[T](x: Expr[T]) extends scala.annotation.Annotation class annot2[T: Type](x: T) extends scala.annotation.Annotation -class Test()(implicit qtx: QuoteContext) { +class Test()(implicit qtx: Quotes) { @annot1('{4}) // error def foo(str: String) = () diff --git a/tests/neg-macros/i7142/Macro_1.scala b/tests/neg-macros/i7142/Macro_1.scala index 6791ad1ed7d3..3bb81b5d6d1e 100644 --- a/tests/neg-macros/i7142/Macro_1.scala +++ b/tests/neg-macros/i7142/Macro_1.scala @@ -1,7 +1,7 @@ package macros import scala.quoted._ -def oops(using QuoteContext) = { +def oops(using Quotes) = { var v = '{0}; val q = '{ (x: Int) => ${ v = '{x}; v } } '{$q($v)} diff --git a/tests/neg-macros/i7142b/Macro_1.scala b/tests/neg-macros/i7142b/Macro_1.scala index c7bde0e7a030..677dcb3acf5e 100644 --- a/tests/neg-macros/i7142b/Macro_1.scala +++ b/tests/neg-macros/i7142b/Macro_1.scala @@ -2,7 +2,7 @@ package macros import scala.quoted._ import scala.util.control.NonLocalReturns._ -def oops(using QuoteContext): Expr[Int] = +def oops(using Quotes): Expr[Int] = returning('{ { (x: Int) => ${ throwReturn('x) }} apply 0 }) inline def test = ${oops} diff --git a/tests/neg-macros/i7142c/Macro_1.scala b/tests/neg-macros/i7142c/Macro_1.scala index b2d5cc1b413c..a16eb6b6f3ef 100644 --- a/tests/neg-macros/i7142c/Macro_1.scala +++ b/tests/neg-macros/i7142c/Macro_1.scala @@ -1,7 +1,7 @@ package macros import scala.quoted._ -def oops(using QuoteContext) = { +def oops(using Quotes) = { var v = '{0}; val q = '{ val x: Int = 8; ${ v = '{x}; v } } v diff --git a/tests/neg-macros/i7142d/Macro_1.scala b/tests/neg-macros/i7142d/Macro_1.scala index f4be5eeba997..579a12da8d77 100644 --- a/tests/neg-macros/i7142d/Macro_1.scala +++ b/tests/neg-macros/i7142d/Macro_1.scala @@ -1,7 +1,7 @@ package macros import scala.quoted._ -def oops(using QuoteContext) = { +def oops(using Quotes) = { var v = '{0}; val q = '{ ??? match { case x => ${ v = '{x}; v } } } v diff --git a/tests/neg-macros/i7142e/Macro_1.scala b/tests/neg-macros/i7142e/Macro_1.scala index ee0aa824fb93..119340dd3d70 100644 --- a/tests/neg-macros/i7142e/Macro_1.scala +++ b/tests/neg-macros/i7142e/Macro_1.scala @@ -1,7 +1,7 @@ package macros import scala.quoted._ -def oops(using QuoteContext) = { +def oops(using Quotes) = { var v = '{0}; val q = '{ def x: Int = 8; ${ v = '{x}; v } } v diff --git a/tests/neg-macros/i7142f/Macro_1.scala b/tests/neg-macros/i7142f/Macro_1.scala index 2fd075e04741..137618e6c15b 100644 --- a/tests/neg-macros/i7142f/Macro_1.scala +++ b/tests/neg-macros/i7142f/Macro_1.scala @@ -1,7 +1,7 @@ package macros import scala.quoted._ -def oops(using QuoteContext) = { +def oops(using Quotes) = { var v = '{0}; val q = '{ def f(x: Int): Int = ${ v = '{x}; v } } v diff --git a/tests/neg-macros/i7142g/Macro_1.scala b/tests/neg-macros/i7142g/Macro_1.scala index 33d67d35b527..67fdef81a4ba 100644 --- a/tests/neg-macros/i7142g/Macro_1.scala +++ b/tests/neg-macros/i7142g/Macro_1.scala @@ -1,7 +1,7 @@ package macros import scala.quoted._ -def oops(using QuoteContext) = { +def oops(using Quotes) = { var v = '{}; val q = '{ var x: Int = 8; ${ v = '{x = 9}; v } } v diff --git a/tests/neg-macros/i7142h/Macro_1.scala b/tests/neg-macros/i7142h/Macro_1.scala index 03a5d7af1594..e61b8788266e 100644 --- a/tests/neg-macros/i7142h/Macro_1.scala +++ b/tests/neg-macros/i7142h/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ var saved = Option.empty[Expr[Int]] -def oops(using QuoteContext) = { +def oops(using Quotes) = { if (saved.isEmpty) '{ (x: Int) => ${ saved = Some('{x}); 'x } } else saved.get } diff --git a/tests/neg-macros/i7264d.scala b/tests/neg-macros/i7264d.scala index 010538b8ee77..457709de6c58 100644 --- a/tests/neg-macros/i7264d.scala +++ b/tests/neg-macros/i7264d.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def f[T2: Type](e: Expr[T2])(using QuoteContext) = e match { + def f[T2: Type](e: Expr[T2])(using Quotes) = e match { case '{ $x: *:[Int, Any] } => // error: Type argument Any does not conform to upper bound Tuple } diff --git a/tests/neg-macros/i7407.scala b/tests/neg-macros/i7407.scala index 8aebb7e38b53..ddf23ac9a57b 100644 --- a/tests/neg-macros/i7407.scala +++ b/tests/neg-macros/i7407.scala @@ -1,2 +1,2 @@ -def qc(using ctx: scala.quoted.QuoteContext) = println(ctx) +def qc(using ctx: scala.quoted.Quotes) = println(ctx) inline def g = qc // error: no implicit argument diff --git a/tests/neg-macros/i7603.scala b/tests/neg-macros/i7603.scala index dd543ebfdbcd..cb430b648963 100644 --- a/tests/neg-macros/i7603.scala +++ b/tests/neg-macros/i7603.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def f[T2: Type](e: Expr[T2])(using QuoteContext) = e match { + def f[T2: Type](e: Expr[T2])(using Quotes) = e match { case '{ $x: ${'[List[$t]]} } => // error case '{ $x: ${y @ '[List[$t]]} } => // error // error } diff --git a/tests/neg-macros/i7618.scala b/tests/neg-macros/i7618.scala index 47e268d1703f..3c28caf68564 100644 --- a/tests/neg-macros/i7618.scala +++ b/tests/neg-macros/i7618.scala @@ -12,7 +12,7 @@ enum Exp { object Compiler { import Exp._ - inline def compile(e: Exp, env: Map[String, Expr[Int]])(using ctx: QuoteContext): Expr[Int] = inline e match { + inline def compile(e: Exp, env: Map[String, Expr[Int]])(using ctx: Quotes): Expr[Int] = inline e match { case Num(n) => Expr(n) case Plus(e1, e2) => @@ -31,6 +31,6 @@ object Example { val exp = Plus(Plus(Num(2), Var("x")), Num(4)) val letExp = Let("x", Num(3), exp) - Compiler.compile(letExp, Map.empty)(using QuoteContext.macroContext) // error // error + Compiler.compile(letExp, Map.empty)(using Quotes.macroContext) // error // error } } diff --git a/tests/neg-macros/i7618b.scala b/tests/neg-macros/i7618b.scala index fa77f75374f9..817618a54810 100644 --- a/tests/neg-macros/i7618b.scala +++ b/tests/neg-macros/i7618b.scala @@ -12,7 +12,7 @@ enum Exp { object Compiler { import Exp._ - inline def compile(e: Exp, env: Map[String, Expr[Int]])(using ctx: QuoteContext): Expr[Int] = inline e match { + inline def compile(e: Exp, env: Map[String, Expr[Int]])(using ctx: Quotes): Expr[Int] = inline e match { case Num(n) => Expr(n) case Plus(e1, e2) => @@ -31,6 +31,6 @@ object Example { val exp = Plus(Plus(Num(2), Var("x")), Num(4)) val letExp = Let("x", Num(3), exp) - Compiler.compile(letExp, Map.empty)(using (??? : QuoteContext)) // error + Compiler.compile(letExp, Map.empty)(using (??? : Quotes)) // error } } diff --git a/tests/neg-macros/i7698.scala b/tests/neg-macros/i7698.scala index 64c07cf31e25..bc1feba16121 100644 --- a/tests/neg-macros/i7698.scala +++ b/tests/neg-macros/i7698.scala @@ -4,7 +4,7 @@ trait Show[T] { def show(x: T): String } -def showInterpolatorImpl(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext): Expr[String] = +def showInterpolatorImpl(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes): Expr[String] = import qctx.reflect._ Term.of(argsExpr) match case '{ $arg: $t } => // error diff --git a/tests/neg-macros/i7839.scala b/tests/neg-macros/i7839.scala index 60536771b2bd..d353f2e633bc 100644 --- a/tests/neg-macros/i7839.scala +++ b/tests/neg-macros/i7839.scala @@ -3,4 +3,4 @@ import scala.quoted._ inline def transform(using dummyImplicit: DummyImplicit): Unit = ${ transformImpl } // error -def transformImpl(using dummyImplicit: DummyImplicit)(using QuoteContext): Expr[Unit] = ??? +def transformImpl(using dummyImplicit: DummyImplicit)(using Quotes): Expr[Unit] = ??? diff --git a/tests/neg-macros/i7892.scala b/tests/neg-macros/i7892.scala index b738761a2a88..b4f3e5fc9441 100644 --- a/tests/neg-macros/i7892.scala +++ b/tests/neg-macros/i7892.scala @@ -4,7 +4,7 @@ package x { class CExprResult1[T] } -def run(using qctx: QuoteContext): Unit = { +def run(using Quotes) = { val cpsLeft: x.CExprResult1[?] = ??? run1(cpsLeft) // error } diff --git a/tests/neg-macros/i7919.scala b/tests/neg-macros/i7919.scala index 49588f9c1f3e..66893ec6d173 100644 --- a/tests/neg-macros/i7919.scala +++ b/tests/neg-macros/i7919.scala @@ -1,7 +1,7 @@ import scala.quoted._ object Test { - def staged[T](using qctx: QuoteContext) = { + def staged[T](using Quotes) = { import qctx.reflect._ given typeT as Type[T] // error val tt = TypeRepr.of[T] diff --git a/tests/neg-macros/i8052.scala b/tests/neg-macros/i8052.scala index acb40dd85f40..d73cbacd6bfe 100644 --- a/tests/neg-macros/i8052.scala +++ b/tests/neg-macros/i8052.scala @@ -8,7 +8,7 @@ object Macro2 { } object TC { - def derived[T: Type](ev: Expr[Mirror.Of[T]])(using qctx: QuoteContext): Expr[TC[T]] = '{ + def derived[T: Type](ev: Expr[Mirror.Of[T]])(using Quotes): Expr[TC[T]] = '{ new TC[T] { def encode(): Unit = $ev match { case '{ $m: Mirror.ProductOf[T] } => ??? // error diff --git a/tests/neg-macros/i8749.scala b/tests/neg-macros/i8749.scala index fb3c5b9b666f..591a6809e268 100644 --- a/tests/neg-macros/i8749.scala +++ b/tests/neg-macros/i8749.scala @@ -4,6 +4,6 @@ object FunObject { def fun(t: String => String) = t } -def test(using QuoteContext)(x: Expr[String => String]) = +def test(using Quotes)(x: Expr[String => String]) = x match case '{ FunObject.fun(($arg: String) => $out) } => // error diff --git a/tests/neg-macros/i8871.scala b/tests/neg-macros/i8871.scala index 676010941faa..db4c6729eef2 100644 --- a/tests/neg-macros/i8871.scala +++ b/tests/neg-macros/i8871.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Macro { - def impl[A : Type](using qctx: QuoteContext): Unit = { + def impl[A : Type](using Quotes): Unit = { import qctx.reflect._ val tpe = TypeRepr.of[A].asType.asInstanceOf[Type[_ <: AnyRef]] '{ (a: ${tpe}) => ???} // error diff --git a/tests/neg-macros/i8871b.scala b/tests/neg-macros/i8871b.scala index c61ff5850f8d..d9ff47eb0776 100644 --- a/tests/neg-macros/i8871b.scala +++ b/tests/neg-macros/i8871b.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Macro { - def impl[A : Type](using qctx: QuoteContext): Unit = { + def impl[A : Type](using Quotes) = { import qctx.reflect._ val tpe/*: Type[? <: AnyKind]*/ = TypeRepr.of[A].asType '{ f[$tpe] } // error diff --git a/tests/neg-macros/i9014/Macros_1.scala b/tests/neg-macros/i9014/Macros_1.scala index 72d45c144b22..f546cc4d6a44 100644 --- a/tests/neg-macros/i9014/Macros_1.scala +++ b/tests/neg-macros/i9014/Macros_1.scala @@ -1,4 +1,4 @@ import scala.quoted._ trait Bar inline given Bar = ${ impl } -def impl(using qctx: QuoteContext): Expr[Bar] = report.throwError("Failed to expand!") +def impl(using Quotes): Expr[Bar] = report.throwError("Failed to expand!") diff --git a/tests/neg-macros/i9801/Macro_1.scala b/tests/neg-macros/i9801/Macro_1.scala index 7ecfb3f9d2b3..5dc4f0c3b1a2 100644 --- a/tests/neg-macros/i9801/Macro_1.scala +++ b/tests/neg-macros/i9801/Macro_1.scala @@ -10,7 +10,7 @@ def triggerStackOverflow(n: Int): Expr[Double] = { inline def loop(inline prog: Double): Double = ${impl('prog)} -def impl(prog: Expr[Double])(using QuoteContext) : Expr[Double] = +def impl(prog: Expr[Double])(using Quotes) : Expr[Double] = import qctx.reflect._ try { triggerStackOverflow(0) diff --git a/tests/neg-macros/i9801b/Macro_1.scala b/tests/neg-macros/i9801b/Macro_1.scala index 87360ff06093..caaeb1ee251b 100644 --- a/tests/neg-macros/i9801b/Macro_1.scala +++ b/tests/neg-macros/i9801b/Macro_1.scala @@ -10,5 +10,5 @@ def triggerStackOverflow(n: Int): Expr[Double] = { inline def loop(inline prog: Double): Double = ${impl('prog)} -def impl(prog: Expr[Double])(using QuoteContext) : Expr[Double] = +def impl(prog: Expr[Double])(using Quotes) : Expr[Double] = triggerStackOverflow(0) diff --git a/tests/neg-macros/i9972/Test_2.scala b/tests/neg-macros/i9972/Test_2.scala index 6ba96eddec4e..15599c80538f 100644 --- a/tests/neg-macros/i9972/Test_2.scala +++ b/tests/neg-macros/i9972/Test_2.scala @@ -7,6 +7,6 @@ case class T[A <: AnyKind](s: String) object T { implicit inline def derived[A <: AnyKind]: T[A] = ${ reprImpl[A] } - def reprImpl[A <: AnyKind](using t: Type[A])(using ctx: QuoteContext): Expr[T[A]] = + def reprImpl[A <: AnyKind](using t: Type[A])(using ctx: Quotes): Expr[T[A]] = '{ T[A]("") } } diff --git a/tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala b/tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala index c5e84154e1e9..80212dc3106f 100644 --- a/tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala +++ b/tests/neg-macros/inline-macro-staged-interpreter/Macro_1.scala @@ -6,7 +6,7 @@ object E { inline def eval[T](inline x: E[T]): T = ${ impl('x) } - def impl[T: Type](x: Expr[E[T]]) (using QuoteContext): Expr[T] = x.unliftOrError.lift + def impl[T: Type](x: Expr[E[T]]) (using Quotes): Expr[T] = x.unliftOrError.lift implicit def ev1[T: Type]: Unliftable[E[T]] = new Unliftable { def fromExpr(x: Expr[E[T]]) = x match { @@ -17,29 +17,29 @@ object E { } object Value { - def unapply[T](expr: Expr[T])(using Unliftable[T], QuoteContext): Option[T] = expr.unlift + def unapply[T](expr: Expr[T])(using Unliftable[T], Quotes): Option[T] = expr.unlift } } trait E[T] { - def lift (using QuoteContext): Expr[T] + def lift (using Quotes): Expr[T] } case class I(n: Int) extends E[Int] { - def lift (using QuoteContext): Expr[Int] = Expr(n) + def lift (using Quotes): Expr[Int] = Expr(n) } case class Plus[T](x: E[T], y: E[T])(implicit op: Plus2[T]) extends E[T] { - def lift (using QuoteContext): Expr[T] = op(x.lift, y.lift) + def lift (using Quotes): Expr[T] = op(x.lift, y.lift) } trait Op2[T] { - def apply(x: Expr[T], y: Expr[T]) (using QuoteContext): Expr[T] + def apply(x: Expr[T], y: Expr[T]) (using Quotes): Expr[T] } trait Plus2[T] extends Op2[T] object Plus2 { implicit case object IPlus extends Plus2[Int] { - def apply(x: Expr[Int], y: Expr[Int]) (using QuoteContext): Expr[Int] = '{$x + $y} + def apply(x: Expr[Int], y: Expr[Int]) (using Quotes): Expr[Int] = '{$x + $y} } } diff --git a/tests/neg-macros/inline-option/Macro_1.scala b/tests/neg-macros/inline-option/Macro_1.scala index 0dd31dc14443..5c72f72a80f5 100644 --- a/tests/neg-macros/inline-option/Macro_1.scala +++ b/tests/neg-macros/inline-option/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Macro { - def impl(opt: Expr[Option[Int]]) (using QuoteContext): Expr[Int] = opt.unliftOrError match { + def impl(opt: Expr[Option[Int]]) (using Quotes): Expr[Int] = opt.unliftOrError match { case Some(i) => Expr(i) case None => '{-1} } diff --git a/tests/neg-macros/inline-quote.scala b/tests/neg-macros/inline-quote.scala index 1a94609d4c9c..57e97cd1ab22 100644 --- a/tests/neg-macros/inline-quote.scala +++ b/tests/neg-macros/inline-quote.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Test { - inline def foo(x: Expr[Int])(using QuoteContext): Expr[Int] = '{ // error + inline def foo(x: Expr[Int])(using Quotes): Expr[Int] = '{ // error println("foo") ${ ${??? : Expr[Int]} diff --git a/tests/neg-macros/inline-tuples-1/Macro_1.scala b/tests/neg-macros/inline-tuples-1/Macro_1.scala index b28eae0e6d4c..ea67c9351426 100644 --- a/tests/neg-macros/inline-tuples-1/Macro_1.scala +++ b/tests/neg-macros/inline-tuples-1/Macro_1.scala @@ -2,26 +2,26 @@ import scala.quoted._ object Macros { - def tup1(tup: Expr[Tuple1[Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup2(tup: Expr[Tuple2[Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup1(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup2(tup: Expr[Tuple2[Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) } diff --git a/tests/neg-macros/macro-class-not-found-1/Foo.scala b/tests/neg-macros/macro-class-not-found-1/Foo.scala index 3c1c9d650e07..554f41549544 100644 --- a/tests/neg-macros/macro-class-not-found-1/Foo.scala +++ b/tests/neg-macros/macro-class-not-found-1/Foo.scala @@ -4,7 +4,7 @@ object Foo { inline def myMacro(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using QuoteContext): Expr[Unit] = + def aMacroImplementation(using Quotes): Expr[Unit] = throw new NoClassDefFoundError() } diff --git a/tests/neg-macros/macro-class-not-found-2/Foo.scala b/tests/neg-macros/macro-class-not-found-2/Foo.scala index 0ff06e4372dd..930eb7c56ed5 100644 --- a/tests/neg-macros/macro-class-not-found-2/Foo.scala +++ b/tests/neg-macros/macro-class-not-found-2/Foo.scala @@ -4,7 +4,7 @@ object Foo { inline def myMacro(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using QuoteContext): Expr[Unit] = + def aMacroImplementation(using Quotes): Expr[Unit] = throw new NoClassDefFoundError("this.is.not.a.Class") } diff --git a/tests/neg-macros/macro-cycle1.scala b/tests/neg-macros/macro-cycle1.scala index 008187fe6db8..8fe07c05b738 100644 --- a/tests/neg-macros/macro-cycle1.scala +++ b/tests/neg-macros/macro-cycle1.scala @@ -1,6 +1,6 @@ -import scala.quoted.{Expr, QuoteContext} +import scala.quoted.{Expr, Quotes} object Test { - def fooImpl(using QuoteContext): Expr[Unit] = '{println("hi")} + def fooImpl(using Quotes): Expr[Unit] = '{println("hi")} inline def foo: Unit = ${fooImpl} diff --git a/tests/neg-macros/macros-in-same-project-1.scala b/tests/neg-macros/macros-in-same-project-1.scala index ed0e6558e2a5..4291d1738eb1 100644 --- a/tests/neg-macros/macros-in-same-project-1.scala +++ b/tests/neg-macros/macros-in-same-project-1.scala @@ -7,6 +7,6 @@ object Bar { inline def myMacro(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using QuoteContext): Expr[Unit] = '{} + def aMacroImplementation(using Quotes): Expr[Unit] = '{} } diff --git a/tests/neg-macros/macros-in-same-project-2.scala b/tests/neg-macros/macros-in-same-project-2.scala index ff9cd1e89e6e..14b8ffc17773 100644 --- a/tests/neg-macros/macros-in-same-project-2.scala +++ b/tests/neg-macros/macros-in-same-project-2.scala @@ -8,6 +8,6 @@ object Bar { inline def myMacro(): Unit = myMacro2() inline def myMacro2(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using QuoteContext): Expr[Unit] = '{} + def aMacroImplementation(using Quotes): Expr[Unit] = '{} } diff --git a/tests/neg-macros/macros-in-same-project-4/Bar.scala b/tests/neg-macros/macros-in-same-project-4/Bar.scala index 373fa488989e..7e27c915b791 100644 --- a/tests/neg-macros/macros-in-same-project-4/Bar.scala +++ b/tests/neg-macros/macros-in-same-project-4/Bar.scala @@ -5,5 +5,5 @@ object Bar { Foo.myMacro() - def hello()(using QuoteContext): Expr[Unit] = '{ println("Hello") } + def hello()(using Quotes): Expr[Unit] = '{ println("Hello") } } diff --git a/tests/neg-macros/macros-in-same-project-4/Foo.scala b/tests/neg-macros/macros-in-same-project-4/Foo.scala index 7993b3a428b6..ab32b37e1e2f 100644 --- a/tests/neg-macros/macros-in-same-project-4/Foo.scala +++ b/tests/neg-macros/macros-in-same-project-4/Foo.scala @@ -4,6 +4,6 @@ object Foo { inline def myMacro(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using QuoteContext): Expr[Unit] = Bar.hello() + def aMacroImplementation(using Quotes): Expr[Unit] = Bar.hello() } diff --git a/tests/neg-macros/macros-in-same-project-5/Bar.scala b/tests/neg-macros/macros-in-same-project-5/Bar.scala index f955f6c82f17..adba4358f853 100644 --- a/tests/neg-macros/macros-in-same-project-5/Bar.scala +++ b/tests/neg-macros/macros-in-same-project-5/Bar.scala @@ -4,7 +4,7 @@ object Bar { Foo.myMacro() // error - def aMacroImplementation(using QuoteContext): Expr[Unit] = Bar.hello() + def aMacroImplementation(using Quotes): Expr[Unit] = Bar.hello() - def hello()(using QuoteContext): Expr[Unit] = '{ println("Hello") } + def hello()(using Quotes): Expr[Unit] = '{ println("Hello") } } diff --git a/tests/neg-macros/macros-in-same-project-6/Foo.scala b/tests/neg-macros/macros-in-same-project-6/Foo.scala index fbc55db03e72..d6161a468897 100644 --- a/tests/neg-macros/macros-in-same-project-6/Foo.scala +++ b/tests/neg-macros/macros-in-same-project-6/Foo.scala @@ -4,7 +4,7 @@ object Foo { inline def myMacro(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using qctx: QuoteContext) : Expr[Unit] = { + def aMacroImplementation(using Quotes) : Expr[Unit] = { import qctx.reflect._ Reporting.error("some error", Position.ofMacroExpansion) throw new NoClassDefFoundError("Bar$") diff --git a/tests/neg-macros/quote-0.scala b/tests/neg-macros/quote-0.scala index 3e1cccf8bd86..022eb5e5b3af 100644 --- a/tests/neg-macros/quote-0.scala +++ b/tests/neg-macros/quote-0.scala @@ -1,11 +1,11 @@ import scala.quoted._ -def test(using QuoteContext) = { +def test(using Quotes) = { val x: Int = 0 '{ - val qctx: QuoteContext = ??? + val qctx: Quotes = ??? given qctx.type = qctx '{x + 1} // error: wrong staging level diff --git a/tests/neg-macros/quote-1.scala b/tests/neg-macros/quote-1.scala index 0409266f1194..daabf4f00bc3 100644 --- a/tests/neg-macros/quote-1.scala +++ b/tests/neg-macros/quote-1.scala @@ -2,11 +2,11 @@ import scala.quoted._ class Test { - def f[T](t: Type[T], x: Expr[T])(using QuoteContext) = '{ + def f[T](t: Type[T], x: Expr[T])(using Quotes) = '{ val z2 = $x // error // error: wrong staging level } - def g[T](implicit t: Type[T], x: Expr[T], qctx: QuoteContext) = '{ + def g[T](implicit t: Type[T], x: Expr[T], qctx: Quotes) = '{ val z2 = $x // ok } diff --git a/tests/neg-macros/quote-complex-top-splice.scala b/tests/neg-macros/quote-complex-top-splice.scala index 34abedb796ec..baa412174774 100644 --- a/tests/neg-macros/quote-complex-top-splice.scala +++ b/tests/neg-macros/quote-complex-top-splice.scala @@ -28,6 +28,6 @@ object Test { impl(1) } - def impl(i: Int)(using QuoteContext): Expr[Unit] = '{} + def impl(i: Int)(using Quotes): Expr[Unit] = '{} } diff --git a/tests/neg-macros/quote-error-2/Macro_1.scala b/tests/neg-macros/quote-error-2/Macro_1.scala index 9afe78f87bfc..a1ee53e3e80c 100644 --- a/tests/neg-macros/quote-error-2/Macro_1.scala +++ b/tests/neg-macros/quote-error-2/Macro_1.scala @@ -2,10 +2,10 @@ import quoted._ object Macro_1 { inline def foo(inline b: Boolean): Unit = ${ fooImpl('b) } - def fooImpl(b: Expr[Boolean])(using QuoteContext): Expr[Unit] = + def fooImpl(b: Expr[Boolean])(using Quotes): Expr[Unit] = '{println(${msg(b.unliftOrError)})} - def msg(b: Boolean)(using qctx: QuoteContext): Expr[String] = + def msg(b: Boolean)(using Quotes): Expr[String] = if (b) '{"foo(true)"} else { report.error("foo cannot be called with false"); '{ ??? } } diff --git a/tests/neg-macros/quote-error/Macro_1.scala b/tests/neg-macros/quote-error/Macro_1.scala index 6ab431895c09..586138d07eb0 100644 --- a/tests/neg-macros/quote-error/Macro_1.scala +++ b/tests/neg-macros/quote-error/Macro_1.scala @@ -2,7 +2,7 @@ import quoted._ object Macro_1 { inline def foo(inline b: Boolean): Unit = ${fooImpl('b)} - def fooImpl(b: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = + def fooImpl(b: Expr[Boolean])(using Quotes) : Expr[Unit] = if (b.unliftOrError) '{println("foo(true)")} else { report.error("foo cannot be called with false"); '{ ??? } } } diff --git a/tests/neg-macros/quote-exception/Macro_1.scala b/tests/neg-macros/quote-exception/Macro_1.scala index 6f8b84864765..1ab799afce14 100644 --- a/tests/neg-macros/quote-exception/Macro_1.scala +++ b/tests/neg-macros/quote-exception/Macro_1.scala @@ -2,7 +2,7 @@ import quoted._ object Macro_1 { inline def foo(inline b: Boolean): Unit = ${fooImpl('b)} - def fooImpl(b: Expr[Boolean]) (using QuoteContext): Expr[Unit] = + def fooImpl(b: Expr[Boolean]) (using Quotes): Expr[Unit] = if (b.unliftOrError) '{println("foo(true)")} else ??? } diff --git a/tests/neg-macros/quote-interpolator-core-old.scala b/tests/neg-macros/quote-interpolator-core-old.scala index 8ee0160e606e..bb99ff40b180 100644 --- a/tests/neg-macros/quote-interpolator-core-old.scala +++ b/tests/neg-macros/quote-interpolator-core-old.scala @@ -11,12 +11,12 @@ object FInterpolation { // ... } - private def liftSeq(args: Seq[Expr[Any]])(using QuoteContext): Expr[Seq[Any]] = args match { + private def liftSeq(args: Seq[Expr[Any]])(using Quotes): Expr[Seq[Any]] = args match { case x :: xs => '{ ($x) +: ${liftSeq(xs)} } case Nil => '{Seq(): Seq[Any]} } - def fInterpolation(sc: StringContext, args: Seq[Expr[Any]])(using QuoteContext): Expr[String] = { + def fInterpolation(sc: StringContext, args: Seq[Expr[Any]])(using Quotes): Expr[String] = { val str: Expr[String] = Expr(sc.parts.mkString("")) val args1: Expr[Seq[Any]] = liftSeq(args) '{ $str.format($args1: _*) } diff --git a/tests/neg-macros/quote-macro-2-splices.scala b/tests/neg-macros/quote-macro-2-splices.scala index f297ed154644..1b25ecce07c9 100644 --- a/tests/neg-macros/quote-macro-2-splices.scala +++ b/tests/neg-macros/quote-macro-2-splices.scala @@ -7,5 +7,5 @@ object Macro { else ${ bar(false) } } - def bar(b: Boolean)(using QuoteContext): Expr[Int] = if (b) '{1} else '{0} + def bar(b: Boolean)(using Quotes): Expr[Int] = if (b) '{1} else '{0} } diff --git a/tests/neg-macros/quote-macro-complex-arg-0.scala b/tests/neg-macros/quote-macro-complex-arg-0.scala index a1079aab4b39..da11de825897 100644 --- a/tests/neg-macros/quote-macro-complex-arg-0.scala +++ b/tests/neg-macros/quote-macro-complex-arg-0.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Macros { inline def foo(inline i: Int, dummy: Int, j: Int): Int = ${ bar(i + 1, 'j) } // error: i + 1 is not a parameter or field reference - def bar(x: Int, y: Expr[Int])(using QuoteContext): Expr[Int] = '{ ${Expr(x)} + $y } + def bar(x: Int, y: Expr[Int])(using Quotes): Expr[Int] = '{ ${Expr(x)} + $y } } diff --git a/tests/neg-macros/quote-open-patterns-stages.scala b/tests/neg-macros/quote-open-patterns-stages.scala index 5d14851bbbbd..7adf28174bd1 100644 --- a/tests/neg-macros/quote-open-patterns-stages.scala +++ b/tests/neg-macros/quote-open-patterns-stages.scala @@ -1,5 +1,5 @@ import scala.quoted._ -def f(using QuoteContext)(x: Expr[Any]) = x match { +def f(using Quotes)(x: Expr[Any]) = x match { case '{ identity($y(x)) } => // error: access to value x from wrong staging level } diff --git a/tests/neg-macros/quote-open-patterns-typer.scala b/tests/neg-macros/quote-open-patterns-typer.scala index 4c0dc8b62a1d..4380aa9fb4ff 100644 --- a/tests/neg-macros/quote-open-patterns-typer.scala +++ b/tests/neg-macros/quote-open-patterns-typer.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def f(using QuoteContext)(x: Expr[Any]) = x match { +def f(using Quotes)(x: Expr[Any]) = x match { case '{ val a: Int = 3; $y(identity(a)) } => // error: Exprected an identifier case '{ identity($y()) } => // error: Missing arguments for open pattern } diff --git a/tests/neg-macros/quote-pattern-implemnetation-restrictions.scala b/tests/neg-macros/quote-pattern-implemnetation-restrictions.scala index 2138c02d6fa4..88876cc7d922 100644 --- a/tests/neg-macros/quote-pattern-implemnetation-restrictions.scala +++ b/tests/neg-macros/quote-pattern-implemnetation-restrictions.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def f(x: Expr[Any])(using QuoteContext) = +def f(x: Expr[Any])(using Quotes) = x match { case '{ class Foo; () } => // error case '{ object Foo; () } => // error diff --git a/tests/neg-macros/quote-spliceNonStaged.scala b/tests/neg-macros/quote-spliceNonStaged.scala index f1df505f31c5..ac5e9a4696bc 100644 --- a/tests/neg-macros/quote-spliceNonStaged.scala +++ b/tests/neg-macros/quote-spliceNonStaged.scala @@ -2,6 +2,6 @@ package quotes import scala.quoted._ object Quotes_1 { - def printHello(using QuoteContext): Expr[Unit] = '{ println("Hello") } + def printHello(using Quotes): Expr[Unit] = '{ println("Hello") } $printHello // error } diff --git a/tests/neg-macros/quote-this-a.scala b/tests/neg-macros/quote-this-a.scala index 281aaea81a9b..7a41fbbc612e 100644 --- a/tests/neg-macros/quote-this-a.scala +++ b/tests/neg-macros/quote-this-a.scala @@ -2,7 +2,7 @@ import scala.quoted._ class Foo { - def f(using QuoteContext): Unit = '{ + def f(using Quotes): Unit = '{ def bar[T](x: T): T = x bar[ this.type // error diff --git a/tests/neg-macros/quote-this-b.scala b/tests/neg-macros/quote-this-b.scala index cb066b5adb0d..14f47c4b3735 100644 --- a/tests/neg-macros/quote-this-b.scala +++ b/tests/neg-macros/quote-this-b.scala @@ -6,5 +6,5 @@ class Foo { } object Foo { - def impl[T](x: Any)(using QuoteContext): Expr[Unit] = '{} + def impl[T](x: Any)(using Quotes): Expr[Unit] = '{} } diff --git a/tests/neg-macros/quote-this-c.scala b/tests/neg-macros/quote-this-c.scala index 8022bd6360ce..fb842a7aba70 100644 --- a/tests/neg-macros/quote-this-c.scala +++ b/tests/neg-macros/quote-this-c.scala @@ -3,13 +3,13 @@ import scala.quoted._ class Foo { inline def i(): Unit = ${ Foo.impl[Any]('{ - val x: QuoteContext = ??? + val x: Quotes = ??? given x.type = x 'this // error }) } inline def j(that: Foo): Unit = ${ Foo.impl[Any]('{ - val x: QuoteContext = ??? + val x: Quotes = ??? given x.type = x 'that // error }) } @@ -17,5 +17,5 @@ class Foo { } object Foo { - def impl[T](x: Any)(using QuoteContext): Expr[Unit] = '{} + def impl[T](x: Any)(using Quotes): Expr[Unit] = '{} } diff --git a/tests/neg-macros/quote-whitebox/Macro_1.scala b/tests/neg-macros/quote-whitebox/Macro_1.scala index 8b34d3346394..995d9c9870f0 100644 --- a/tests/neg-macros/quote-whitebox/Macro_1.scala +++ b/tests/neg-macros/quote-whitebox/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Macros { transparent inline def defaultOf(inline str: String): Any = ${ defaultOfImpl('str) } - def defaultOfImpl(str: Expr[String]) (using QuoteContext): Expr[Any] = str.unliftOrError match { + def defaultOfImpl(str: Expr[String]) (using Quotes): Expr[Any] = str.unliftOrError match { case "int" => '{1} case "string" => '{"a"} } diff --git a/tests/neg-macros/quotedPatterns-1.scala b/tests/neg-macros/quotedPatterns-1.scala index 42181a663381..b46919375dd1 100644 --- a/tests/neg-macros/quotedPatterns-1.scala +++ b/tests/neg-macros/quotedPatterns-1.scala @@ -1,5 +1,5 @@ object Test { - def test(x: quoted.Expr[Int])(using scala.quoted.QuoteContext) = x match { + def test(x: quoted.Expr[Int])(using scala.quoted.Quotes) = x match { case '{ val a = '{ println($y) }; 0 } => ??? // error: Not found: y case _ => } diff --git a/tests/neg-macros/quotedPatterns-2.scala b/tests/neg-macros/quotedPatterns-2.scala index 9ef43d58ab2d..3d9d912957ab 100644 --- a/tests/neg-macros/quotedPatterns-2.scala +++ b/tests/neg-macros/quotedPatterns-2.scala @@ -1,5 +1,5 @@ object Test { - def test(x: quoted.Expr[Int])(using scala.quoted.QuoteContext) = x match { + def test(x: quoted.Expr[Int])(using scala.quoted.Quotes) = x match { case '{ val a = 4; '{ a }; $y } => y // error // error: access to value a from wrong staging level case _ => } diff --git a/tests/neg-macros/quotedPatterns-3.scala b/tests/neg-macros/quotedPatterns-3.scala index 2506ec22ebc4..300119160e2c 100644 --- a/tests/neg-macros/quotedPatterns-3.scala +++ b/tests/neg-macros/quotedPatterns-3.scala @@ -1,5 +1,5 @@ object Test { - def test(x: quoted.Expr[Int])(using scala.quoted.QuoteContext) = x match { + def test(x: quoted.Expr[Int])(using scala.quoted.Quotes) = x match { case '{ val `$y`: Int = 2; 1 } => // error y // error: Not found: y case '{ ((`$y`: Int) => 3); 2 } => // error diff --git a/tests/neg-macros/quotedPatterns-5.scala b/tests/neg-macros/quotedPatterns-5.scala index cb70648b6ced..6d474fa3e338 100644 --- a/tests/neg-macros/quotedPatterns-5.scala +++ b/tests/neg-macros/quotedPatterns-5.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Test { - def test(x: quoted.Expr[Int])(using QuoteContext): Unit = x match { + def test(x: quoted.Expr[Int])(using Quotes): Unit = x match { case '{ type t; 4 } => Type.of[t] case '{ type t; poly[t]($x); 4 } => // error: duplicate pattern variable: t case '{ type `t`; poly[`t`]($x); 4 } => diff --git a/tests/neg-macros/quotedPatterns-6.scala b/tests/neg-macros/quotedPatterns-6.scala index ba4698213b37..0ee7581732a5 100644 --- a/tests/neg-macros/quotedPatterns-6.scala +++ b/tests/neg-macros/quotedPatterns-6.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Test { - def test(x: quoted.Expr[Int])(using QuoteContext) = x match { + def test(x: quoted.Expr[Int])(using Quotes) = x match { case '{ poly[${Foo(t)}]($x); 4 } => ??? // error case '{ type t; poly[${Foo(y: Type[`t`])}]($x); 4 } => ??? // error case _ => diff --git a/tests/neg-macros/reflect-inline/assert_1.scala b/tests/neg-macros/reflect-inline/assert_1.scala index 863cd9be32be..139818b8547e 100644 --- a/tests/neg-macros/reflect-inline/assert_1.scala +++ b/tests/neg-macros/reflect-inline/assert_1.scala @@ -4,7 +4,7 @@ object api { extension (inline x: String) inline def stripMargin2: String = ${ stripImpl('x) } - private def stripImpl(x: Expr[String])(using qctx: QuoteContext): Expr[String] = + private def stripImpl(x: Expr[String])(using Quotes): Expr[String] = Expr(x.unliftOrError.stripMargin) } diff --git a/tests/neg-macros/splice-in-top-level-splice-1.scala b/tests/neg-macros/splice-in-top-level-splice-1.scala index ba9b8a9ef618..63c503caeeb3 100644 --- a/tests/neg-macros/splice-in-top-level-splice-1.scala +++ b/tests/neg-macros/splice-in-top-level-splice-1.scala @@ -2,6 +2,6 @@ import scala.quoted._ object Foo { inline def foo(): Int = ${bar(${x})} // error - def x(using QuoteContext): Expr[Int] = '{1} - def bar(i: Int)(using QuoteContext): Expr[Int] = Expr(i) + def x(using Quotes): Expr[Int] = '{1} + def bar(i: Int)(using Quotes): Expr[Int] = Expr(i) } diff --git a/tests/neg-macros/splice-in-top-level-splice-2.scala b/tests/neg-macros/splice-in-top-level-splice-2.scala index 21e38ed219ac..33bb3fddcdc1 100644 --- a/tests/neg-macros/splice-in-top-level-splice-2.scala +++ b/tests/neg-macros/splice-in-top-level-splice-2.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Foo { inline def foo(): Int = ${$x} // error - def x(using QuoteContext): Expr[Expr[Int]] = '{ '{1} } + def x(using Quotes): Expr[Expr[Int]] = '{ '{1} } } diff --git a/tests/neg-macros/splice-non-expr.scala b/tests/neg-macros/splice-non-expr.scala index 758fb129bcd6..3f9b32642415 100644 --- a/tests/neg-macros/splice-non-expr.scala +++ b/tests/neg-macros/splice-non-expr.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def test(using QuoteContext) = '{ + def test(using Quotes) = '{ ${3} // error ${new Object} // error ${"abc"} // error diff --git a/tests/neg-macros/tasty-macro-assert-1/quoted_1.scala b/tests/neg-macros/tasty-macro-assert-1/quoted_1.scala index 80705144d1b2..7c9c8305436c 100644 --- a/tests/neg-macros/tasty-macro-assert-1/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-assert-1/quoted_1.scala @@ -12,7 +12,7 @@ object Asserts { inline def macroAssert(inline cond: Boolean): Unit = ${impl('cond)} - def impl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { + def impl(cond: Expr[Boolean])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(cond) diff --git a/tests/neg-macros/tasty-macro-assert-2/quoted_1.scala b/tests/neg-macros/tasty-macro-assert-2/quoted_1.scala index 1874f51559ae..89ee1aead477 100644 --- a/tests/neg-macros/tasty-macro-assert-2/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-assert-2/quoted_1.scala @@ -12,7 +12,7 @@ object Asserts { inline def macroAssert(inline cond: Boolean): Unit = ${ impl('cond) } - def impl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { + def impl(cond: Expr[Boolean])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(cond) diff --git a/tests/neg-macros/tasty-macro-error/quoted_1.scala b/tests/neg-macros/tasty-macro-error/quoted_1.scala index 7fb38746e70e..4a8807ede821 100644 --- a/tests/neg-macros/tasty-macro-error/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-error/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def fun(x: Any): Unit = ${ impl('x) } - def impl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def impl(x: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ Reporting.error("here is the the argument is " + Term.of(x).underlyingArgument.show, Term.of(x).underlyingArgument.pos) '{} diff --git a/tests/neg-macros/tasty-macro-positions/quoted_1.scala b/tests/neg-macros/tasty-macro-positions/quoted_1.scala index 7be2c8ac083f..4d3a2d9f6c1e 100644 --- a/tests/neg-macros/tasty-macro-positions/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-positions/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def fun(x: Any): Unit = ${ impl('x) } - def impl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def impl(x: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val pos = Term.of(x).underlyingArgument.pos Reporting.error("here is the the argument is " + Term.of(x).underlyingArgument.show, pos) diff --git a/tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala b/tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala index e51b682c75ce..241fa408a967 100644 --- a/tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala +++ b/tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala @@ -9,7 +9,7 @@ object Macro { object FIntepolator { - def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = { + def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes) : Expr[String] = { import qctx.reflect._ Reporting.error("there are no parts", Term.of(strCtxExpr).underlyingArgument.pos) '{ ($strCtxExpr).s($argsExpr: _*) } diff --git a/tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala b/tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala index ea7187c55449..084ad4b17ef9 100644 --- a/tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala +++ b/tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala @@ -8,7 +8,7 @@ object Macro { } object FIntepolator { - def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = { + def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes) : Expr[String] = { import qctx.reflect._ Reporting.error("there are no args", Term.of(argsExpr).underlyingArgument.pos) '{ ($strCtxExpr).s($argsExpr: _*) } diff --git a/tests/neg-macros/toexproftuple.scala b/tests/neg-macros/toexproftuple.scala index 70b7a0f2ba57..13b61d1ad86f 100644 --- a/tests/neg-macros/toexproftuple.scala +++ b/tests/neg-macros/toexproftuple.scala @@ -1,7 +1,7 @@ import scala.quoted._, scala.deriving._ inline def mcr: Any = ${mcrImpl} -def mcrImpl(using ctx: QuoteContext): Expr[Any] = { +def mcrImpl(using ctx: Quotes): Expr[Any] = { val tpl: (Expr[1], Expr[2], Expr[3]) = ('{1}, '{2}, '{3}) '{val res: (1, 3, 3) = ${Expr.ofTuple(tpl)}; res} // error diff --git a/tests/neg-macros/type-splice-in-val-pattern.scala b/tests/neg-macros/type-splice-in-val-pattern.scala index ba4a3d1d04ba..20d16bea9910 100644 --- a/tests/neg-macros/type-splice-in-val-pattern.scala +++ b/tests/neg-macros/type-splice-in-val-pattern.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Foo { - def f(using q: QuoteContext) = { + def f(using q: Quotes) = { val t: Type[Int] = ??? val '[ *:[$t] ] = ??? // error } diff --git a/tests/neg-staging/i5941/macro_1.scala b/tests/neg-staging/i5941/macro_1.scala index 167d7b7bc8a0..636e810461f0 100644 --- a/tests/neg-staging/i5941/macro_1.scala +++ b/tests/neg-staging/i5941/macro_1.scala @@ -11,7 +11,7 @@ object Lens { def set(t: T, s: S): S = _set(t)(s) } - def impl[S: Type, T: Type](getter: Expr[S => T])(using qctx: QuoteContext): Expr[Lens[S, T]] = { + def impl[S: Type, T: Type](getter: Expr[S => T])(using Quotes): Expr[Lens[S, T]] = { implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(this.getClass.getClassLoader) import qctx.reflect._ import util._ diff --git a/tests/neg-staging/quote-run-in-macro-1/quoted_1.scala b/tests/neg-staging/quote-run-in-macro-1/quoted_1.scala index 24bf36bae830..56038ab2b3aa 100644 --- a/tests/neg-staging/quote-run-in-macro-1/quoted_1.scala +++ b/tests/neg-staging/quote-run-in-macro-1/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { given Toolbox = Toolbox.make(getClass.getClassLoader) inline def foo(i: => Int): Int = ${ fooImpl('i) } - def fooImpl(i: Expr[Int])(using QuoteContext): Expr[Int] = { + def fooImpl(i: Expr[Int])(using Quotes): Expr[Int] = { val y: Int = run(i) Expr(y) } diff --git a/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala b/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala index b7c78d2bd441..2ab330d46b2c 100644 --- a/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala +++ b/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala @@ -4,7 +4,7 @@ import scala.quoted._ import Even._ object EvenFromDigitsImpl: - def apply(digits: Expr[String])(using QuoteContext): Expr[Even] = digits match { + def apply(digits: Expr[String])(using Quotes): Expr[Even] = digits match { case Const(ds) => val ev = try evenFromDigits(ds) diff --git a/tests/patmat/i6255.scala b/tests/patmat/i6255.scala index 5c515e988694..7e48b8d0984d 100644 --- a/tests/patmat/i6255.scala +++ b/tests/patmat/i6255.scala @@ -1,5 +1,5 @@ class Foo { - def foo(x: quoted.Expr[Int])(using scala.quoted.QuoteContext): Unit = x match { + def foo(x: quoted.Expr[Int])(using scala.quoted.Quotes): Unit = x match { case '{ 1 } => case '{ 2 } => case _ => diff --git a/tests/patmat/i6255b.scala b/tests/patmat/i6255b.scala index 25bc213b56b5..a5c52c8f28dc 100644 --- a/tests/patmat/i6255b.scala +++ b/tests/patmat/i6255b.scala @@ -1,5 +1,5 @@ class Foo { - def foo(x: quoted.Expr[Int])(using scala.quoted.QuoteContext): Unit = x match { + def foo(x: quoted.Expr[Int])(using scala.quoted.Quotes): Unit = x match { case '{ 1 } => case '{ 2 } => } diff --git a/tests/patmat/i9489.scala b/tests/patmat/i9489.scala index 482d7be7b950..ef24a4b4c553 100644 --- a/tests/patmat/i9489.scala +++ b/tests/patmat/i9489.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def summonTypedType[T : Type](using QuoteContext): String = Type.of[T] match { +def summonTypedType[T : Type](using Quotes): String = Type.of[T] match { case '[Boolean] => "Boolean" case '[Byte] => "Byte" case _ => "Other" diff --git a/tests/patmat/i9489b.scala b/tests/patmat/i9489b.scala index 832e01d1b184..c75b125122ad 100644 --- a/tests/patmat/i9489b.scala +++ b/tests/patmat/i9489b.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def summonTypedType[T : Type](using QuoteContext): String = '{ ??? : T } match { +def summonTypedType[T : Type](using Quotes): String = '{ ??? : T } match { case '{ $_ : Boolean } => "Boolean" case '{ $_ : Byte } => "Byte" case _ => "Other" diff --git a/tests/pending/pos/cps-async-failure.scala b/tests/pending/pos/cps-async-failure.scala index e15375c2166b..55a6e42b7de9 100644 --- a/tests/pending/pos/cps-async-failure.scala +++ b/tests/pending/pos/cps-async-failure.scala @@ -37,7 +37,7 @@ class FC[F[_]]() trait Base[F[_]:Type,CT:Type] // Both :Type context bounds are necessary for failure extends Cps with Root[F, CT] with App[F, CT]: - implicit val qctx: QuoteContext + implicit val qctx: Quotes trait Root[F[_], CT]: this: Base[F, CT] => diff --git a/tests/pending/run/tasty-comments/quoted_1.scala b/tests/pending/run/tasty-comments/quoted_1.scala index d352083e694d..eb23494dd30c 100644 --- a/tests/pending/run/tasty-comments/quoted_1.scala +++ b/tests/pending/run/tasty-comments/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { inline def printComment[T](t: => T): Unit = ${ impl('t) } - def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { + def impl[T](x: Expr[T])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(x) diff --git a/tests/pos-custom-args/semanticdb/inline-unapply/Macro_1.scala b/tests/pos-custom-args/semanticdb/inline-unapply/Macro_1.scala index 2d49b71383e3..dc431c14ef14 100644 --- a/tests/pos-custom-args/semanticdb/inline-unapply/Macro_1.scala +++ b/tests/pos-custom-args/semanticdb/inline-unapply/Macro_1.scala @@ -4,5 +4,5 @@ object Succ: inline def unapply(n: Int): Option[Int] = ${ impl('n) } - private def impl(n: Expr[Int])(using QuoteContext): Expr[Option[Int]] = + private def impl(n: Expr[Int])(using Quotes): Expr[Option[Int]] = '{ if $n == 0 then None else Some($n - 1)} diff --git a/tests/pos-custom-args/semanticdb/macro-pos/example_1.scala b/tests/pos-custom-args/semanticdb/macro-pos/example_1.scala index 340cd14c1d49..f7750d9f0795 100644 --- a/tests/pos-custom-args/semanticdb/macro-pos/example_1.scala +++ b/tests/pos-custom-args/semanticdb/macro-pos/example_1.scala @@ -1,5 +1,5 @@ import quoted._ object CodeImpl { - def codeExpr(using qctx: QuoteContext): Expr[String] = '{""} + def codeExpr(using Quotes): Expr[String] = '{""} } diff --git a/tests/pos-macros/f64Pow5Split/Macro.scala b/tests/pos-macros/f64Pow5Split/Macro.scala index 5232ad792d1f..0e9fd5e84616 100644 --- a/tests/pos-macros/f64Pow5Split/Macro.scala +++ b/tests/pos-macros/f64Pow5Split/Macro.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Macro { inline def f64Pow5Split: Array[Long] = ${ f64Pow5SplitExpr } - private def f64Pow5SplitExpr(using QuoteContext): Expr[Array[Long]] = Expr { + private def f64Pow5SplitExpr(using Quotes): Expr[Array[Long]] = Expr { val ss = new Array[Long](652) var pow5 = BigInt(1) var i = 0 diff --git a/tests/pos-macros/i10050.scala b/tests/pos-macros/i10050.scala index eb4a6f628a9c..5a80ce7aa7cf 100644 --- a/tests/pos-macros/i10050.scala +++ b/tests/pos-macros/i10050.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def test[T: Type](x: Expr[Any])(using QuoteContext): Unit = +def test[T: Type](x: Expr[Any])(using Quotes): Unit = x match case '{ $x: T } => // match using outer `T` diff --git a/tests/pos-macros/i10107b/Macro_1.scala b/tests/pos-macros/i10107b/Macro_1.scala index 67e67edd854c..6fecabf4d1a6 100644 --- a/tests/pos-macros/i10107b/Macro_1.scala +++ b/tests/pos-macros/i10107b/Macro_1.scala @@ -1,7 +1,7 @@ import scala.quoted._ inline def isTrue: Boolean = ${ isTrueImpl } -def isTrueImpl(using qctx: QuoteContext) = { +def isTrueImpl(using Quotes) = { Expr(true) } diff --git a/tests/pos-macros/i10151/Macro_1.scala b/tests/pos-macros/i10151/Macro_1.scala index 02aae2ed8091..3fc243923f76 100644 --- a/tests/pos-macros/i10151/Macro_1.scala +++ b/tests/pos-macros/i10151/Macro_1.scala @@ -21,7 +21,7 @@ object X: processImpl[T]('f) } - def processImpl[T:Type](f:Expr[T])(using qctx: QuoteContext):Expr[CB[T]] = + def processImpl[T:Type](f:Expr[T])(using Quotes):Expr[CB[T]] = import qctx.reflect._ def transform(term:Term):Term = diff --git a/tests/pos-macros/i10211/Macro_1.scala b/tests/pos-macros/i10211/Macro_1.scala index 9f5ff9e4008a..ee949a0716dd 100644 --- a/tests/pos-macros/i10211/Macro_1.scala +++ b/tests/pos-macros/i10211/Macro_1.scala @@ -35,7 +35,7 @@ object X: processImpl[T]('f) } - def processImpl[T:Type](f:Expr[T])(using qctx: QuoteContext):Expr[CB[T]] = + def processImpl[T:Type](f:Expr[T])(using Quotes):Expr[CB[T]] = import qctx.reflect._ def transform(term:Term):Term = diff --git a/tests/pos-macros/i3898/quoted_1.scala b/tests/pos-macros/i3898/quoted_1.scala index c30e7b099ed7..2b8870420795 100644 --- a/tests/pos-macros/i3898/quoted_1.scala +++ b/tests/pos-macros/i3898/quoted_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macro { inline def ff(args: Any*): String = ${impl('args)} - def impl(args: Expr[Seq[Any]])(using QuoteContext): Expr[String] = '{""} + def impl(args: Expr[Seq[Any]])(using Quotes): Expr[String] = '{""} } diff --git a/tests/pos-macros/i3898b/quoted_1.scala b/tests/pos-macros/i3898b/quoted_1.scala index a09baa5e9f6b..78d88158c05c 100644 --- a/tests/pos-macros/i3898b/quoted_1.scala +++ b/tests/pos-macros/i3898b/quoted_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macro { inline def ff(x: Int, inline y: Int): String = ${impl('x)} - def impl(x: Expr[Int])(using QuoteContext): Expr[String] = '{""} + def impl(x: Expr[Int])(using Quotes): Expr[String] = '{""} } diff --git a/tests/pos-macros/i3912-1/i3912_1.scala b/tests/pos-macros/i3912-1/i3912_1.scala index f8b4331b1423..949c4fb6fc8b 100644 --- a/tests/pos-macros/i3912-1/i3912_1.scala +++ b/tests/pos-macros/i3912-1/i3912_1.scala @@ -3,5 +3,5 @@ import scala.quoted._ object Macros { inline def foo(): Int = { ${ impl() } } - def impl()(using QuoteContext): Expr[Int] = '{1} + def impl()(using Quotes): Expr[Int] = '{1} } \ No newline at end of file diff --git a/tests/pos-macros/i3912-2/i3912_1.scala b/tests/pos-macros/i3912-2/i3912_1.scala index aae33694311f..7c8e6af936d3 100644 --- a/tests/pos-macros/i3912-2/i3912_1.scala +++ b/tests/pos-macros/i3912-2/i3912_1.scala @@ -3,5 +3,5 @@ import scala.quoted._ object Macros { inline def foo2(): Unit = ${ impl() } - def impl()(using QuoteContext): Expr[Int] = '{1} + def impl()(using Quotes): Expr[Int] = '{1} } \ No newline at end of file diff --git a/tests/pos-macros/i3912-3/i3912_1.scala b/tests/pos-macros/i3912-3/i3912_1.scala index 31637ec31b91..5af4c931b05a 100644 --- a/tests/pos-macros/i3912-3/i3912_1.scala +++ b/tests/pos-macros/i3912-3/i3912_1.scala @@ -7,5 +7,5 @@ object Macros { } } - def impl()(using QuoteContext): Expr[Int] = '{1} + def impl()(using Quotes): Expr[Int] = '{1} } \ No newline at end of file diff --git a/tests/pos-macros/i4023/Test_2.scala b/tests/pos-macros/i4023/Test_2.scala index 135f83d5afd2..b9866007fade 100644 --- a/tests/pos-macros/i4023/Test_2.scala +++ b/tests/pos-macros/i4023/Test_2.scala @@ -1,3 +1,3 @@ -def test(using quoted.QuoteContext) = { +def test(using quoted.Quotes) = { Macro.ff(3) } diff --git a/tests/pos-macros/i4023b/Macro_1.scala b/tests/pos-macros/i4023b/Macro_1.scala index 3c4cf7774a54..223758cf393d 100644 --- a/tests/pos-macros/i4023b/Macro_1.scala +++ b/tests/pos-macros/i4023b/Macro_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macro { inline def ff[T](implicit t: Type[T]): Int = ${ impl[T] } - def impl[T](using QuoteContext): Expr[Int] = '{4} + def impl[T](using Quotes): Expr[Int] = '{4} } diff --git a/tests/pos-macros/i4023b/Test_2.scala b/tests/pos-macros/i4023b/Test_2.scala index c6c976437049..acf954964b73 100644 --- a/tests/pos-macros/i4023b/Test_2.scala +++ b/tests/pos-macros/i4023b/Test_2.scala @@ -1,4 +1,4 @@ object Test { - given quoted.QuoteContext = ??? + given quoted.Quotes = ??? Macro.ff[Int] } diff --git a/tests/pos-macros/i4023c/Macro_1.scala b/tests/pos-macros/i4023c/Macro_1.scala index 3a6e8d52f090..31bdc14379ad 100644 --- a/tests/pos-macros/i4023c/Macro_1.scala +++ b/tests/pos-macros/i4023c/Macro_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macro { inline def ff[T](x: T): T = ${ impl('x) } - def impl[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = '{ $x: T } + def impl[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ $x: T } } diff --git a/tests/pos-macros/i4350.scala b/tests/pos-macros/i4350.scala index 0e3e1648e366..f8a642de360d 100644 --- a/tests/pos-macros/i4350.scala +++ b/tests/pos-macros/i4350.scala @@ -1,5 +1,5 @@ import scala.quoted._ -class Foo[T: Type](using QuoteContext) { +class Foo[T: Type](using Quotes) { '{null.asInstanceOf[T]} } diff --git a/tests/pos-macros/i4380a.scala b/tests/pos-macros/i4380a.scala index 442e3b5e7481..ed015ef4b13c 100644 --- a/tests/pos-macros/i4380a.scala +++ b/tests/pos-macros/i4380a.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Test { trait Producer[A] { self => - def step(k: (A => Expr[Unit]))(using QuoteContext): Expr[Unit] + def step(k: (A => Expr[Unit]))(using Quotes): Expr[Unit] } trait Foo[A] @@ -13,7 +13,7 @@ object Test { stream match { case Bar(producer, nestedf) => { new Producer[Expr[A]] { - def step(k: Expr[A] => Expr[Unit])(using QuoteContext): Expr[Unit] = '{ + def step(k: Expr[A] => Expr[Unit])(using Quotes): Expr[Unit] = '{ val adv: Unit => Unit = { _ => ${producer.step((el) => nestedf(el))} } } } diff --git a/tests/pos-macros/i4380b.scala b/tests/pos-macros/i4380b.scala index 92f0041fb449..f24b17a558b7 100644 --- a/tests/pos-macros/i4380b.scala +++ b/tests/pos-macros/i4380b.scala @@ -1,6 +1,6 @@ import scala.quoted._ -class Test(using qctx: QuoteContext) { +class Test(using Quotes) { def step(k: (String => Expr[Unit])): Expr[Unit] = '{} def meth(): Unit = '{ (i: Int) => ${ step(el => '{} ) } diff --git a/tests/pos-macros/i4396a.scala b/tests/pos-macros/i4396a.scala index c1b8004e8e66..8a8e0190a6bf 100644 --- a/tests/pos-macros/i4396a.scala +++ b/tests/pos-macros/i4396a.scala @@ -1,4 +1,4 @@ import scala.quoted._ -def test(using QuoteContext) = { +def test(using Quotes) = { '{ Option(4) match { case Some(a) => a; case None => 1 }} } diff --git a/tests/pos-macros/i4396b.scala b/tests/pos-macros/i4396b.scala index d6d886e93df7..e1195dac7ab5 100644 --- a/tests/pos-macros/i4396b.scala +++ b/tests/pos-macros/i4396b.scala @@ -1,4 +1,4 @@ import scala.quoted._ -def test(using QuoteContext) = { +def test(using Quotes) = { '{ case class Foo() } } \ No newline at end of file diff --git a/tests/pos-macros/i4414.scala b/tests/pos-macros/i4414.scala index 0517942a555b..b0e3b06d9460 100644 --- a/tests/pos-macros/i4414.scala +++ b/tests/pos-macros/i4414.scala @@ -1,7 +1,7 @@ import scala.quoted._ object Test { - given QuoteContext = ??? + given Quotes = ??? def a[A: Type](): Unit = { b[Expr[A]]() diff --git a/tests/pos-macros/i4514.scala b/tests/pos-macros/i4514.scala index 904683b1e0f6..e13e47a407f4 100644 --- a/tests/pos-macros/i4514.scala +++ b/tests/pos-macros/i4514.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Foo { inline def foo[X](x: X): Unit = ${fooImpl('x)} - def fooImpl[X: Type](x: X)(using QuoteContext): Expr[Unit] = '{} + def fooImpl[X: Type](x: X)(using Quotes): Expr[Unit] = '{} } diff --git a/tests/pos-macros/i4539.scala b/tests/pos-macros/i4539.scala index 8e5f94c60a3b..a1a6bf98359d 100644 --- a/tests/pos-macros/i4539.scala +++ b/tests/pos-macros/i4539.scala @@ -1,5 +1,5 @@ import scala.quoted._ -def test(using QuoteContext) = { +def test(using Quotes) = { val q = Type.of[String] Type.of[String] } diff --git a/tests/pos-macros/i4539b.scala b/tests/pos-macros/i4539b.scala index e2646f75248a..8cf1b40352ab 100644 --- a/tests/pos-macros/i4539b.scala +++ b/tests/pos-macros/i4539b.scala @@ -1,5 +1,5 @@ import scala.quoted._ -def test(using QuoteContext): Unit = { +def test(using Quotes): Unit = { def f = { { Type.of[String] diff --git a/tests/pos-macros/i4734/Macro_1.scala b/tests/pos-macros/i4734/Macro_1.scala index cffa353a0975..aff918025a77 100644 --- a/tests/pos-macros/i4734/Macro_1.scala +++ b/tests/pos-macros/i4734/Macro_1.scala @@ -5,7 +5,7 @@ object Macros { inline def unrolledForeach(f: Int => Int): Int = ${unrolledForeachImpl('f)} - def unrolledForeachImpl(f: Expr[Int => Int])(using QuoteContext): Expr[Int] = '{ + def unrolledForeachImpl(f: Expr[Int => Int])(using Quotes): Expr[Int] = '{ val size: Int = 5 ($f)(3) } diff --git a/tests/pos-macros/i4773.scala b/tests/pos-macros/i4773.scala index 2445a291a4db..188d36642d1c 100644 --- a/tests/pos-macros/i4773.scala +++ b/tests/pos-macros/i4773.scala @@ -2,6 +2,6 @@ import scala.quoted._ object Foo { inline def foo2(): Unit = ${foo2Impl()} - def foo2Impl()(using QuoteContext): Expr[Unit] = '{} + def foo2Impl()(using Quotes): Expr[Unit] = '{} inline def foo(): Unit = foo2() } diff --git a/tests/pos-macros/i4774a.scala b/tests/pos-macros/i4774a.scala index d525451a3e63..c117c7dcd0d9 100644 --- a/tests/pos-macros/i4774a.scala +++ b/tests/pos-macros/i4774a.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Test { - def loop[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = '{ + def loop[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ val y: T = $x ${loop('y)} } diff --git a/tests/pos-macros/i4774b.scala b/tests/pos-macros/i4774b.scala index f16197dc0b3f..e384f8edcccf 100644 --- a/tests/pos-macros/i4774b.scala +++ b/tests/pos-macros/i4774b.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Test { - def loop[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = '{ + def loop[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ val y: t.Underlying = $x; ${loop[t.Underlying]( 'y diff --git a/tests/pos-macros/i4774c.scala b/tests/pos-macros/i4774c.scala index cbc2bf7be250..3fba38cdecc9 100644 --- a/tests/pos-macros/i4774c.scala +++ b/tests/pos-macros/i4774c.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Test { - def loop[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = '{ val y = $x; ${loop('y)} } + def loop[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ val y = $x; ${loop('y)} } } diff --git a/tests/pos-macros/i4774d.scala b/tests/pos-macros/i4774d.scala index 54de29d9e6b7..e9662c12d8e3 100644 --- a/tests/pos-macros/i4774d.scala +++ b/tests/pos-macros/i4774d.scala @@ -2,6 +2,6 @@ import scala.quoted._ object Test { - def loop[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = + def loop[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ val y: T = $x; ${loop('y)} } } diff --git a/tests/pos-macros/i4774e.scala b/tests/pos-macros/i4774e.scala index 2910c77d3780..df057bf326d2 100644 --- a/tests/pos-macros/i4774e.scala +++ b/tests/pos-macros/i4774e.scala @@ -2,9 +2,9 @@ import scala.quoted._ object Test { - def loop[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = + def loop[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ def y = $x; ${ loop('y) } } - def loop2[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = + def loop2[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ def y() = $x; ${ loop('{y()}) } } } diff --git a/tests/pos-macros/i4774f.scala b/tests/pos-macros/i4774f.scala index d782bfac6ebf..17174fc2a35a 100644 --- a/tests/pos-macros/i4774f.scala +++ b/tests/pos-macros/i4774f.scala @@ -2,9 +2,9 @@ import scala.quoted._ object Test { - def loop[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = + def loop[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ def y: T = $x; ${ loop('y) } } - def loop2[T](x: Expr[T])(implicit t: Type[T], qctx: QuoteContext): Expr[T] = + def loop2[T](x: Expr[T])(implicit t: Type[T], qctx: Quotes): Expr[T] = '{ def y(): T = $x; ${ loop2('{y()}) } } } diff --git a/tests/pos-macros/i4891.scala b/tests/pos-macros/i4891.scala index 4063f067e2c1..c0c58a65cc91 100644 --- a/tests/pos-macros/i4891.scala +++ b/tests/pos-macros/i4891.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Test { - def foo(using QuoteContext): Expr[Option[String]] = '{None} + def foo(using Quotes): Expr[Option[String]] = '{None} } diff --git a/tests/pos-macros/i5547.scala b/tests/pos-macros/i5547.scala index eca00b42d96f..646039635847 100644 --- a/tests/pos-macros/i5547.scala +++ b/tests/pos-macros/i5547.scala @@ -4,6 +4,6 @@ object scalatest { inline def assert1(condition: => Boolean): Unit = ${assertImpl('condition, '{""})} - def assertImpl(condition: Expr[Boolean], clue: Expr[Any])(using QuoteContext): Expr[Unit] = + def assertImpl(condition: Expr[Boolean], clue: Expr[Any])(using Quotes): Expr[Unit] = '{} } diff --git a/tests/pos-macros/i5954.scala b/tests/pos-macros/i5954.scala index 9cde97ca02cc..6632dfb8e2db 100644 --- a/tests/pos-macros/i5954.scala +++ b/tests/pos-macros/i5954.scala @@ -5,11 +5,11 @@ abstract class MatcherFactory1 { object MatcherFactory1 { import scala.quoted._ - def impl(self: Expr[MatcherFactory1#AndNotWord])(using QuoteContext) = + def impl(self: Expr[MatcherFactory1#AndNotWord])(using Quotes) = '{ val a: Any = $self } - def impl2[T: Type](a: MatcherFactory1)(self: Expr[T])(implicit ev: T =:= a.AndNotWord, qctx: QuoteContext) = + def impl2[T: Type](a: MatcherFactory1)(self: Expr[T])(implicit ev: T =:= a.AndNotWord, qctx: Quotes) = '{ val a: Any = $self } } diff --git a/tests/pos-macros/i5954b.scala b/tests/pos-macros/i5954b.scala index 8ebb4b28aaa4..8f3fcb8b2657 100644 --- a/tests/pos-macros/i5954b.scala +++ b/tests/pos-macros/i5954b.scala @@ -5,11 +5,11 @@ abstract class MatcherFactory1 { object MatcherFactory1 { import scala.quoted._ - def impl(self: Expr[MatcherFactory1#AndNotWord[Int]])(using QuoteContext) = + def impl(self: Expr[MatcherFactory1#AndNotWord[Int]])(using Quotes) = '{ val a: Any = $self } - def impl[T: Type](self: Expr[MatcherFactory1#AndNotWord[T]])(using QuoteContext) = + def impl[T: Type](self: Expr[MatcherFactory1#AndNotWord[T]])(using Quotes) = '{ val a: Any = $self } } diff --git a/tests/pos-macros/i5954c.scala b/tests/pos-macros/i5954c.scala index 5b936144bdd7..2f40717740e8 100644 --- a/tests/pos-macros/i5954c.scala +++ b/tests/pos-macros/i5954c.scala @@ -5,11 +5,11 @@ abstract class MatcherFactory1[A] { object MatcherFactory1 { import scala.quoted._ - def impl(self: Expr[MatcherFactory1[Int]#AndNotWord])(using QuoteContext) = + def impl(self: Expr[MatcherFactory1[Int]#AndNotWord])(using Quotes) = '{ val a: Any = $self } - def impl[T: Type](self: Expr[MatcherFactory1[T]#AndNotWord])(using QuoteContext) = + def impl[T: Type](self: Expr[MatcherFactory1[T]#AndNotWord])(using Quotes) = '{ val a: Any = $self } } diff --git a/tests/pos-macros/i5954d.scala b/tests/pos-macros/i5954d.scala index 1ffde4481d41..f1d7506fd003 100644 --- a/tests/pos-macros/i5954d.scala +++ b/tests/pos-macros/i5954d.scala @@ -5,11 +5,11 @@ abstract class MatcherFactory1 { object MatcherFactory1 { import scala.quoted._ - def impl(self: Expr[MatcherFactory1#AndNotWord])(using QuoteContext) = + def impl(self: Expr[MatcherFactory1#AndNotWord])(using Quotes) = '{ val a: Any = $self } - def impl2[T: Type](a: MatcherFactory1)(self: Expr[T])(implicit ev: T =:= a.AndNotWord, qctx: QuoteContext) = + def impl2[T: Type](a: MatcherFactory1)(self: Expr[T])(implicit ev: T =:= a.AndNotWord, qctx: Quotes) = '{ val a: Any = $self } } diff --git a/tests/pos-macros/i5962.scala b/tests/pos-macros/i5962.scala index da9a5ccc1c67..973c3f42f155 100644 --- a/tests/pos-macros/i5962.scala +++ b/tests/pos-macros/i5962.scala @@ -6,7 +6,7 @@ class MatchFactory1[T, S[_]] { object MatcherFactory1 { - def impl[T: Type, S[_], M >: MatchFactory1[T, S] <: MatchFactory1[T, S] : Type](self: Expr[M])(implicit qctx: QuoteContext, tpS: Type[S[T]]) = + def impl[T: Type, S[_], M >: MatchFactory1[T, S] <: MatchFactory1[T, S] : Type](self: Expr[M])(implicit qctx: Quotes, tpS: Type[S[T]]) = '{ val a = ${self}; a.f } } diff --git a/tests/pos-macros/i6008.scala b/tests/pos-macros/i6008.scala index 12c7b94b9c37..9005a9625254 100644 --- a/tests/pos-macros/i6008.scala +++ b/tests/pos-macros/i6008.scala @@ -2,5 +2,5 @@ import scala.quoted._ class C { type T = Int - def fn(e : Expr[T])(using QuoteContext): Expr[T] = '{ println(); $e } + def fn(e : Expr[T])(using Quotes): Expr[T] = '{ println(); $e } } diff --git a/tests/pos-macros/i6140.scala b/tests/pos-macros/i6140.scala index 615822699411..4dba5cbbeba6 100644 --- a/tests/pos-macros/i6140.scala +++ b/tests/pos-macros/i6140.scala @@ -4,5 +4,5 @@ sealed trait Trait[T] { } object O { - def fn[T:Type](t : Trait[T])(using QuoteContext): Type[T] = Type.of[t.t] + def fn[T:Type](t : Trait[T])(using Quotes): Type[T] = Type.of[t.t] } diff --git a/tests/pos-macros/i6142.scala b/tests/pos-macros/i6142.scala index 63e0e8663f93..38b4a960be4f 100644 --- a/tests/pos-macros/i6142.scala +++ b/tests/pos-macros/i6142.scala @@ -1,7 +1,7 @@ import scala.quoted._ object O { - def foo(using QuoteContext) = { + def foo(using Quotes) = { type T implicit val _: scala.quoted.Type[T] = ??? Type.of[List[T]] diff --git a/tests/pos-macros/i6171/Macro_1.scala b/tests/pos-macros/i6171/Macro_1.scala index dac7d12ac367..d73158a007d2 100644 --- a/tests/pos-macros/i6171/Macro_1.scala +++ b/tests/pos-macros/i6171/Macro_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(x: => Any): Unit = ${ assertImpl('x) } - def assertImpl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(x: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ Term.of(x).underlyingArgument '{ () } diff --git a/tests/pos-macros/i6210/Macros_1.scala b/tests/pos-macros/i6210/Macros_1.scala index 33dab0edc75a..6c995b7c4b95 100644 --- a/tests/pos-macros/i6210/Macros_1.scala +++ b/tests/pos-macros/i6210/Macros_1.scala @@ -4,7 +4,7 @@ object Macro { inline def test[A, B]: Any = ${ impl[A, B] } - def impl[A : Type, B : Type](using QuoteContext): Expr[Any] = { + def impl[A : Type, B : Type](using Quotes): Expr[Any] = { val t = Type.of[Map[A, B]] '{ new Object().asInstanceOf[t.Underlying] diff --git a/tests/pos-macros/i6214.scala b/tests/pos-macros/i6214.scala index 3da36f7821b1..beb394a70950 100644 --- a/tests/pos-macros/i6214.scala +++ b/tests/pos-macros/i6214.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Test { - def res(x: quoted.Expr[Int])(using QuoteContext): quoted.Expr[Int] = x match { + def res(x: quoted.Expr[Int])(using Quotes): quoted.Expr[Int] = x match { case '{ val a: Int = $y; 1} => y // owner of `y` is `res` case _ => '{ val b: Int = ${val c = 2; Expr(c)}; 1} // owner of `c` is `b`, but that seems to be OK } diff --git a/tests/pos-macros/i6214b.scala b/tests/pos-macros/i6214b.scala index 0d54d689b13d..17b2c6764cd0 100644 --- a/tests/pos-macros/i6214b.scala +++ b/tests/pos-macros/i6214b.scala @@ -1,5 +1,5 @@ object Test { - def res(x: quoted.Expr[Int])(using scala.quoted.QuoteContext): quoted.Expr[Int] = x match { + def res(x: quoted.Expr[Int])(using scala.quoted.Quotes): quoted.Expr[Int] = x match { case '{ val a: Int = ${ Foo('{ val b: Int = $y; b }) }; a } => y // owner of y is res } object Foo { diff --git a/tests/pos-macros/i6253.scala b/tests/pos-macros/i6253.scala index 1720e62f1416..b5875c8db25e 100644 --- a/tests/pos-macros/i6253.scala +++ b/tests/pos-macros/i6253.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Macros { - def impl(self: Expr[StringContext])(using QuoteContext): Expr[String] = self match { + def impl(self: Expr[StringContext])(using Quotes): Expr[String] = self match { case '{ StringContext() } => '{""} case '{ StringContext($part1) } => part1 case '{ StringContext($part1, $part2) } => '{ $part1 + $part2 } diff --git a/tests/pos-macros/i6435.scala b/tests/pos-macros/i6435.scala index 6d11809c8f62..722677cd38c0 100644 --- a/tests/pos-macros/i6435.scala +++ b/tests/pos-macros/i6435.scala @@ -1,7 +1,7 @@ class Foo { import scala.quoted._ - def f(sc: quoted.Expr[StringContext])(using QuoteContext): Unit = { + def f(sc: quoted.Expr[StringContext])(using Quotes): Unit = { val '{ StringContext(${parts}: _*) } = sc val ps0: Expr[Seq[String]] = parts diff --git a/tests/pos-macros/i6535/Macro_1.scala b/tests/pos-macros/i6535/Macro_1.scala index ec4b6addaff2..c0119bbd963c 100644 --- a/tests/pos-macros/i6535/Macro_1.scala +++ b/tests/pos-macros/i6535/Macro_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition) } - def assertImpl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean])(using Quotes) : Expr[Unit] = { import qctx.reflect._ import util._ import ValDef.let diff --git a/tests/pos-macros/i6588.scala b/tests/pos-macros/i6588.scala index d323360d2909..214dd999ff63 100644 --- a/tests/pos-macros/i6588.scala +++ b/tests/pos-macros/i6588.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def foo[T:Type]: Int = 10 -def main(using QuoteContext) = { +def main(using Quotes) = { type S = Int foo[S] foo[Int] diff --git a/tests/pos-macros/i6783.scala b/tests/pos-macros/i6783.scala index c0a1b46188bd..35a199fdb2bc 100644 --- a/tests/pos-macros/i6783.scala +++ b/tests/pos-macros/i6783.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def testImpl(f: Expr[(Int, Int) => Int])(using QuoteContext): Expr[Int] = Expr.betaReduce('{$f(1, 2)}) +def testImpl(f: Expr[(Int, Int) => Int])(using Quotes): Expr[Int] = Expr.betaReduce('{$f(1, 2)}) inline def test(f: (Int, Int) => Int) = ${ testImpl('f) diff --git a/tests/pos-macros/i6803b/Macro_1.scala b/tests/pos-macros/i6803b/Macro_1.scala index b7d392939446..7266c8999047 100644 --- a/tests/pos-macros/i6803b/Macro_1.scala +++ b/tests/pos-macros/i6803b/Macro_1.scala @@ -8,7 +8,7 @@ object AsObject { object LineNo { def unsafe(i: Int): LineNo = new LineNo(i) inline given x as LineNo = ${impl} - private def impl(using qctx: QuoteContext) : Expr[LineNo] = { + private def impl(using Quotes) : Expr[LineNo] = { import qctx.reflect._ '{unsafe(${Expr(Position.ofMacroExpansion.startLine)})} } diff --git a/tests/pos-macros/i6997c.scala b/tests/pos-macros/i6997c.scala index 1bf1858330c9..443cb0de44a3 100644 --- a/tests/pos-macros/i6997c.scala +++ b/tests/pos-macros/i6997c.scala @@ -4,7 +4,7 @@ import scala.quoted._ inline def mcr(x: => Any): Any = ${mcrImpl('x)} -def mcrImpl(body: Expr[Any])(using ctx: QuoteContext): Expr[Any] = +def mcrImpl(body: Expr[Any])(using ctx: Quotes): Expr[Any] = body match case '{$x: t} => '{ diff --git a/tests/pos-macros/i6998.scala b/tests/pos-macros/i6998.scala index 41b34d785c23..dc0e0357099d 100644 --- a/tests/pos-macros/i6998.scala +++ b/tests/pos-macros/i6998.scala @@ -1,5 +1,5 @@ import scala.quoted._ -def foo(using QuoteContext) : Unit = { +def foo(using Quotes) : Unit = { val '{ $f : (Int => Double) } = ??? : Expr[Any] } diff --git a/tests/pos-macros/i7011/Macros_1.scala b/tests/pos-macros/i7011/Macros_1.scala index 48426d136a63..b7b916096119 100644 --- a/tests/pos-macros/i7011/Macros_1.scala +++ b/tests/pos-macros/i7011/Macros_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def mcr(body: => Any): Unit = ${mcrImpl('body)} -def mcrImpl[T](body: Expr[Any])(using QuoteContext) : Expr[Any] = { +def mcrImpl[T](body: Expr[Any])(using Quotes) : Expr[Any] = { import qctx.reflect._ val bTree = Term.of(body) diff --git a/tests/pos-macros/i7030/Macros_1.scala b/tests/pos-macros/i7030/Macros_1.scala index 1f149f3e67e5..fe4467fddb7d 100644 --- a/tests/pos-macros/i7030/Macros_1.scala +++ b/tests/pos-macros/i7030/Macros_1.scala @@ -1,11 +1,11 @@ import scala.quoted._ inline def inner(exprs: Any): Any = ${innerImpl('exprs)} -def innerImpl(exprs: Expr[Any])(using QuoteContext): Expr[Any] = +def innerImpl(exprs: Expr[Any])(using Quotes): Expr[Any] = '{$exprs ; ()} inline def outer(expr: => Any): Any = ${outerImpl('expr)} -def outerImpl(body: Expr[Any])(using QuoteContext): Expr[Any] = { +def outerImpl(body: Expr[Any])(using Quotes): Expr[Any] = { import qctx.reflect._ Term.of(body).underlyingArgument.asExpr } diff --git a/tests/pos-macros/i7046.scala b/tests/pos-macros/i7046.scala index ed25c29120fd..8f296ad0fb43 100644 --- a/tests/pos-macros/i7046.scala +++ b/tests/pos-macros/i7046.scala @@ -1,7 +1,7 @@ import scala.quoted._ inline def mcr: Any = ${mcrImpl} -def mcrImpl(using ctx: QuoteContext): Expr[Any] = { +def mcrImpl(using ctx: Quotes): Expr[Any] = { val tpl: Expr[1] = '{1} '{()} } diff --git a/tests/pos-macros/i7048.scala b/tests/pos-macros/i7048.scala index fba9ed619821..a9a889bb4853 100644 --- a/tests/pos-macros/i7048.scala +++ b/tests/pos-macros/i7048.scala @@ -7,7 +7,7 @@ trait IsExpr[T] { def f(x: Any): String = x.toString -def g[T](using e: IsExpr[T], tu: Type[e.Underlying]): QuoteContext ?=> Expr[String] = { +def g[T](using e: IsExpr[T], tu: Type[e.Underlying]): Quotes ?=> Expr[String] = { val underlying: Expr[e.Underlying] = e.expr '{f($underlying)} } diff --git a/tests/pos-macros/i7048b.scala b/tests/pos-macros/i7048b.scala index 140506a80836..e4e78c2ae5ea 100644 --- a/tests/pos-macros/i7048b.scala +++ b/tests/pos-macros/i7048b.scala @@ -6,7 +6,7 @@ trait IsExpr { val foo: IsExpr = ??? -def g()(using QuoteContext): Unit = { +def g()(using Quotes): Unit = { val a = Type.of[foo.Underlying] () } diff --git a/tests/pos-macros/i7048c.scala b/tests/pos-macros/i7048c.scala index 0a81a7aa853a..15c14e6a83d7 100644 --- a/tests/pos-macros/i7048c.scala +++ b/tests/pos-macros/i7048c.scala @@ -8,6 +8,6 @@ val foo: IsExpr = ??? def g(e: IsExpr)(using tu: Type[e.Underlying]): Unit = ??? -def mcrImpl(using QuoteContext): Unit = { +def mcrImpl(using Quotes): Unit = { g(foo) } diff --git a/tests/pos-macros/i7048d.scala b/tests/pos-macros/i7048d.scala index ad3577dc68f3..ee9ce70de927 100644 --- a/tests/pos-macros/i7048d.scala +++ b/tests/pos-macros/i7048d.scala @@ -8,6 +8,6 @@ val foo: IsExpr = ??? def g(e: IsExpr)(using tu: Type[e.Underlying]): Unit = ??? -def mcrImpl(using QuoteContext): Unit = { +def mcrImpl(using Quotes): Unit = { g(foo) } diff --git a/tests/pos-macros/i7048e.scala b/tests/pos-macros/i7048e.scala index 64b81a812d53..43636f199d89 100644 --- a/tests/pos-macros/i7048e.scala +++ b/tests/pos-macros/i7048e.scala @@ -7,7 +7,7 @@ abstract class Test { val getT: Type[T] = T // need this to avoid getting `null` given getT.type = getT - def foo(using QuoteContext): Expr[Any] = { + def foo(using Quotes): Expr[Any] = { val r = '{Option.empty[T]} diff --git a/tests/pos-macros/i7052.scala b/tests/pos-macros/i7052.scala index a06885ef7bc0..c6eaf7a01776 100644 --- a/tests/pos-macros/i7052.scala +++ b/tests/pos-macros/i7052.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Test { - def foo(str: Expr[String])(using QuoteContext) = '{ + def foo(str: Expr[String])(using Quotes) = '{ @deprecated($str, "") def bar = ??? } diff --git a/tests/pos-macros/i7110a/Macro_1.scala b/tests/pos-macros/i7110a/Macro_1.scala index d35f56ba36ce..98b2dbe09eba 100644 --- a/tests/pos-macros/i7110a/Macro_1.scala +++ b/tests/pos-macros/i7110a/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def m[R](sym: Symantics[R]) : R = ${ mImpl[R]('{sym}) } - def mImpl[R: Type](using qctx: QuoteContext)(sym: Expr[Symantics[R]]): Expr[R] = '{ + def mImpl[R: Type](using Quotes)(sym: Expr[Symantics[R]]): Expr[R] = '{ $sym.Meth(42) } } diff --git a/tests/pos-macros/i7110b/Macro_1.scala b/tests/pos-macros/i7110b/Macro_1.scala index 0587f403c450..9bc5998c4860 100644 --- a/tests/pos-macros/i7110b/Macro_1.scala +++ b/tests/pos-macros/i7110b/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def m[T](sym: Symantics {type R = T}) : T = ${ mImpl[T]('{sym}) } - def mImpl[T: Type](using qctx: QuoteContext)(sym: Expr[Symantics { type R = T }]): Expr[T] = '{ + def mImpl[T: Type](using Quotes)(sym: Expr[Symantics { type R = T }]): Expr[T] = '{ $sym.Meth(42) } } diff --git a/tests/pos-macros/i7110c/Macro_1.scala b/tests/pos-macros/i7110c/Macro_1.scala index b83e3aaf594a..119175f84ace 100644 --- a/tests/pos-macros/i7110c/Macro_1.scala +++ b/tests/pos-macros/i7110c/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def m[R](sym: Symantics[R]) : R = ${ mImpl[R]('{sym}) } - def mImpl[R: Type](using qctx: QuoteContext)(sym: Expr[Symantics[R]]): Expr[R] = '{ + def mImpl[R: Type](using Quotes)(sym: Expr[Symantics[R]]): Expr[R] = '{ $sym.Meth(42) } } diff --git a/tests/pos-macros/i7110d/Macro_1.scala b/tests/pos-macros/i7110d/Macro_1.scala index fe8a8cc002b8..fc1d8e1b0478 100644 --- a/tests/pos-macros/i7110d/Macro_1.scala +++ b/tests/pos-macros/i7110d/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def m(sym: Symantics) : Int = ${ mImpl('sym) } - def mImpl(using qctx: QuoteContext)(sym: Expr[Symantics]): Expr[Int] = '{ + def mImpl(using Quotes)(sym: Expr[Symantics]): Expr[Int] = '{ $sym.Meth(42) } } diff --git a/tests/pos-macros/i7110e/Macro_1.scala b/tests/pos-macros/i7110e/Macro_1.scala index eab74cdcfc1a..f9470255366d 100644 --- a/tests/pos-macros/i7110e/Macro_1.scala +++ b/tests/pos-macros/i7110e/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def m(sym: Symantics, x: Int) : Int = ${ mImpl('sym, 'x) } - def mImpl(using qctx: QuoteContext)(sym: Expr[Symantics], x: Expr[Int]): Expr[Int] = '{ + def mImpl(using Quotes)(sym: Expr[Symantics], x: Expr[Int]): Expr[Int] = '{ $sym.Meth($x) } } diff --git a/tests/pos-macros/i7110f/Macro_1.scala b/tests/pos-macros/i7110f/Macro_1.scala index d35f56ba36ce..98b2dbe09eba 100644 --- a/tests/pos-macros/i7110f/Macro_1.scala +++ b/tests/pos-macros/i7110f/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def m[R](sym: Symantics[R]) : R = ${ mImpl[R]('{sym}) } - def mImpl[R: Type](using qctx: QuoteContext)(sym: Expr[Symantics[R]]): Expr[R] = '{ + def mImpl[R: Type](using Quotes)(sym: Expr[Symantics[R]]): Expr[R] = '{ $sym.Meth(42) } } diff --git a/tests/pos-macros/i7204.scala b/tests/pos-macros/i7204.scala index 9ca2a30f1a3c..6e88e99bef46 100644 --- a/tests/pos-macros/i7204.scala +++ b/tests/pos-macros/i7204.scala @@ -1,7 +1,7 @@ import scala.quoted._ object Foo { - def impl(using qctx: QuoteContext) : Unit = { + def impl(using Quotes) : Unit = { import qctx.reflect._ val Select(_, _) = (??? : Term) } diff --git a/tests/pos-macros/i7262.scala b/tests/pos-macros/i7262.scala index 1c815425fcd1..23b0af1f3fde 100644 --- a/tests/pos-macros/i7262.scala +++ b/tests/pos-macros/i7262.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def f[T](t: Type[T])(using QuoteContext) = t match { + def f[T](t: Type[T])(using Quotes) = t match { case '[ Int *: EmptyTuple ] => } } diff --git a/tests/pos-macros/i7264.scala b/tests/pos-macros/i7264.scala index 0ffd14c94bb9..3e15b16d5a1b 100644 --- a/tests/pos-macros/i7264.scala +++ b/tests/pos-macros/i7264.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def f[T2](t: Type[T2])(using QuoteContext) = t match { + def f[T2](t: Type[T2])(using Quotes) = t match { case '[ *:[Int, t2] ] => Type.of[ *:[Int, t2] ] } diff --git a/tests/pos-macros/i7264b.scala b/tests/pos-macros/i7264b.scala index d6e43d5eba4f..feaee449e0ce 100644 --- a/tests/pos-macros/i7264b.scala +++ b/tests/pos-macros/i7264b.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def f[T2: Type](e: Expr[T2])(using QuoteContext) = e match { + def f[T2: Type](e: Expr[T2])(using Quotes) = e match { case '{ $x: *:[Int, t] } => Type.of[ *:[Int, t] ] } diff --git a/tests/pos-macros/i7264c.scala b/tests/pos-macros/i7264c.scala index 3cd9142a9286..c61e4e31535e 100644 --- a/tests/pos-macros/i7264c.scala +++ b/tests/pos-macros/i7264c.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def f[T2: Type](e: Expr[T2])(using QuoteContext) = e match { + def f[T2: Type](e: Expr[T2])(using Quotes) = e match { case '{ $x: t0 } => Type.of[t0] match case '[ *:[Int, t] ] => diff --git a/tests/pos-macros/i7322/Macro_1.scala b/tests/pos-macros/i7322/Macro_1.scala index 296733ab36cf..247a5643e4a4 100644 --- a/tests/pos-macros/i7322/Macro_1.scala +++ b/tests/pos-macros/i7322/Macro_1.scala @@ -1,7 +1,7 @@ -import scala.quoted.{ QuoteContext, Expr, Type } +import scala.quoted.{ Quotes, Expr, Type } trait M[T] { def f: Any } -inline def g[T: Type](em: Expr[M[T]])(using QuoteContext) = '{$em.f} \ No newline at end of file +inline def g[T: Type](em: Expr[M[T]])(using Quotes) = '{$em.f} \ No newline at end of file diff --git a/tests/pos-macros/i7322/Test_2.scala b/tests/pos-macros/i7322/Test_2.scala index 81ca4d803986..8a076d19e4d5 100644 --- a/tests/pos-macros/i7322/Test_2.scala +++ b/tests/pos-macros/i7322/Test_2.scala @@ -1,3 +1,3 @@ -import scala.quoted.{ QuoteContext, Expr } +import scala.quoted.{ Quotes, Expr } -def h(m: Expr[M[String]])(using QuoteContext): Expr[Any] = g(m) \ No newline at end of file +def h(m: Expr[M[String]])(using Quotes): Expr[Any] = g(m) \ No newline at end of file diff --git a/tests/pos-macros/i7342/Macro_1.scala b/tests/pos-macros/i7342/Macro_1.scala index dcbeb4759678..5f27b5437d8e 100644 --- a/tests/pos-macros/i7342/Macro_1.scala +++ b/tests/pos-macros/i7342/Macro_1.scala @@ -1,5 +1,5 @@ -import scala.quoted.{ QuoteContext, Expr } +import scala.quoted.{ Quotes, Expr } trait Foo -inline def g(em: Expr[Foo])(using QuoteContext) = '{$em} +inline def g(em: Expr[Foo])(using Quotes) = '{$em} diff --git a/tests/pos-macros/i7342/Macro_2.scala b/tests/pos-macros/i7342/Macro_2.scala index e51a08189301..00be61278c33 100644 --- a/tests/pos-macros/i7342/Macro_2.scala +++ b/tests/pos-macros/i7342/Macro_2.scala @@ -1,3 +1,3 @@ -import scala.quoted.{ QuoteContext, Expr } +import scala.quoted.{ Quotes, Expr } -def h(m: Expr[Foo])(using QuoteContext): Expr[Any] = g(m) +def h(m: Expr[Foo])(using Quotes): Expr[Any] = g(m) diff --git a/tests/pos-macros/i7343/Macro_1.scala b/tests/pos-macros/i7343/Macro_1.scala index 6e5b31c12e27..4dc9255ef595 100644 --- a/tests/pos-macros/i7343/Macro_1.scala +++ b/tests/pos-macros/i7343/Macro_1.scala @@ -1,7 +1,7 @@ -import scala.quoted.{ QuoteContext, Expr } +import scala.quoted.{ Quotes, Expr } trait M { def f: Any } -inline def g(em: Expr[M])(using QuoteContext) = '{$em.f} \ No newline at end of file +inline def g(em: Expr[M])(using Quotes) = '{$em.f} \ No newline at end of file diff --git a/tests/pos-macros/i7343/Test_2.scala b/tests/pos-macros/i7343/Test_2.scala index b3f482a0e0b6..e81abe265821 100644 --- a/tests/pos-macros/i7343/Test_2.scala +++ b/tests/pos-macros/i7343/Test_2.scala @@ -1,3 +1,3 @@ -import scala.quoted.{ QuoteContext, Expr } +import scala.quoted.{ Quotes, Expr } -def h(m: Expr[M])(using QuoteContext): Expr[Any] = g(m) \ No newline at end of file +def h(m: Expr[M])(using Quotes): Expr[Any] = g(m) \ No newline at end of file diff --git a/tests/pos-macros/i7343b/Macro_1.scala b/tests/pos-macros/i7343b/Macro_1.scala index 044a1f04382a..06df95f5c98e 100644 --- a/tests/pos-macros/i7343b/Macro_1.scala +++ b/tests/pos-macros/i7343b/Macro_1.scala @@ -1 +1 @@ -inline def g(using scala.quoted.QuoteContext) = '{1} +inline def g(using scala.quoted.Quotes) = '{1} diff --git a/tests/pos-macros/i7343b/Test_2.scala b/tests/pos-macros/i7343b/Test_2.scala index 045abb5e3be9..60d33844e265 100644 --- a/tests/pos-macros/i7343b/Test_2.scala +++ b/tests/pos-macros/i7343b/Test_2.scala @@ -1 +1 @@ -def h(using scala.quoted.QuoteContext) = g +def h(using scala.quoted.Quotes) = g diff --git a/tests/pos-macros/i7358.scala b/tests/pos-macros/i7358.scala index 1603bd6fbf49..0c8f18b1b84b 100644 --- a/tests/pos-macros/i7358.scala +++ b/tests/pos-macros/i7358.scala @@ -3,7 +3,7 @@ package test import scala.quoted._ import scala.compiletime._ -transparent inline def summonT[Tp <: Tuple](using QuoteContext): Tuple = inline erasedValue[Tp] match { +transparent inline def summonT[Tp <: Tuple](using Quotes): Tuple = inline erasedValue[Tp] match { case _ : EmptyTuple => Tuple() case _ : (hd *: tl) => { type H = hd @@ -13,4 +13,4 @@ transparent inline def summonT[Tp <: Tuple](using QuoteContext): Tuple = inline } } -def test[T : Type](using QuoteContext) = summonT[Tuple1[List[T]]] +def test[T : Type](using Quotes) = summonT[Tuple1[List[T]]] diff --git a/tests/pos-macros/i7405.scala b/tests/pos-macros/i7405.scala index 3afba665139c..ba5596c046f7 100644 --- a/tests/pos-macros/i7405.scala +++ b/tests/pos-macros/i7405.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def f(using QuoteContext): Expr[Any] = { + def f(using Quotes): Expr[Any] = { '{ type X = Int // Level 1 val x: X = ??? diff --git a/tests/pos-macros/i7405b.scala b/tests/pos-macros/i7405b.scala index 9c058b5c4438..c11dc9b91516 100644 --- a/tests/pos-macros/i7405b.scala +++ b/tests/pos-macros/i7405b.scala @@ -1,7 +1,7 @@ import scala.quoted._ class Foo { - def f(using QuoteContext): Expr[Any] = { + def f(using Quotes): Expr[Any] = { '{ trait X { type Y diff --git a/tests/pos-macros/i7513/Macro_1.scala b/tests/pos-macros/i7513/Macro_1.scala index 4752c85df4e4..e0add6b02552 100644 --- a/tests/pos-macros/i7513/Macro_1.scala +++ b/tests/pos-macros/i7513/Macro_1.scala @@ -5,7 +5,7 @@ trait Quoted { } inline def quote: Quoted = ${ quoteImpl } -def quoteImpl(using qctx: QuoteContext): Expr[Quoted] = '{ +def quoteImpl(using Quotes): Expr[Quoted] = '{ new Quoted { def foo = ??? } diff --git a/tests/pos-macros/i7513b/Macro_1.scala b/tests/pos-macros/i7513b/Macro_1.scala index c338f27b6f81..4b71f53de8e6 100644 --- a/tests/pos-macros/i7513b/Macro_1.scala +++ b/tests/pos-macros/i7513b/Macro_1.scala @@ -5,7 +5,7 @@ trait Quoted { } inline def quote: Quoted = ${ quoteImpl } -def quoteImpl(using qctx: QuoteContext): Expr[Quoted] = '{ +def quoteImpl(using Quotes): Expr[Quoted] = '{ new Quoted { val foo = ??? } diff --git a/tests/pos-macros/i7513c/Macro_1.scala b/tests/pos-macros/i7513c/Macro_1.scala index a0f99886c276..40504e3e24d4 100644 --- a/tests/pos-macros/i7513c/Macro_1.scala +++ b/tests/pos-macros/i7513c/Macro_1.scala @@ -6,7 +6,7 @@ object Macros { } inline def quote: Quoted = ${ quoteImpl } - def quoteImpl(using qctx: QuoteContext): Expr[Quoted] = '{ + def quoteImpl(using Quotes): Expr[Quoted] = '{ new Quoted { def foo = ??? } diff --git a/tests/pos-macros/i7519.scala b/tests/pos-macros/i7519.scala index 7e6c6322e5cb..c0af9b9971d3 100644 --- a/tests/pos-macros/i7519.scala +++ b/tests/pos-macros/i7519.scala @@ -7,7 +7,7 @@ object Test { class Quoted[T] inline def quote[T]: Quoted[T] = ${ quoteImpl[T] } - def quoteImpl[T: Type](using qctx: QuoteContext): Expr[Quoted[T]] = '{ + def quoteImpl[T: Type](using Quotes): Expr[Quoted[T]] = '{ new Quoted[T @Annot] } } diff --git a/tests/pos-macros/i7519b.scala b/tests/pos-macros/i7519b.scala index 63ac578b5a83..580a200a4589 100644 --- a/tests/pos-macros/i7519b.scala +++ b/tests/pos-macros/i7519b.scala @@ -7,7 +7,7 @@ class Quoted[T] inline def quote[T]: Quoted[T] = ${ quoteImpl[T] } -def quoteImpl[T: Type](using qctx: QuoteContext): Expr[Quoted[T]] = { +def quoteImpl[T: Type](using Quotes): Expr[Quoted[T]] = { val value: Expr[Int] = '{ 42 } '{ new Quoted[T @Annot($value)] } } diff --git a/tests/pos-macros/i7521.scala b/tests/pos-macros/i7521.scala index 3dfa925dedf5..66a6ebf22e06 100644 --- a/tests/pos-macros/i7521.scala +++ b/tests/pos-macros/i7521.scala @@ -3,7 +3,7 @@ import scala.annotation.StaticAnnotation object Test { inline def quote[T]: Unit = ${ quoteImpl[T] } - def quoteImpl[T: Type](using qctx: QuoteContext): Expr[Unit] = '{ + def quoteImpl[T: Type](using Quotes): Expr[Unit] = '{ class Annot extends StaticAnnotation var test: T @Annot = ??? } diff --git a/tests/pos-macros/i7887.scala b/tests/pos-macros/i7887.scala index 4fea06c24b4b..98c36bee20c0 100644 --- a/tests/pos-macros/i7887.scala +++ b/tests/pos-macros/i7887.scala @@ -1,4 +1,4 @@ -def typed[A](using t: quoted.Type[A], qctx: quoted.QuoteContext): Unit = { +def typed[A](using t: quoted.Type[A], qctx: quoted.Quotes): Unit = { import qctx.reflect._ '{ type T = A diff --git a/tests/pos-macros/i7997.scala b/tests/pos-macros/i7997.scala index bc90850e62a4..09036b23230e 100644 --- a/tests/pos-macros/i7997.scala +++ b/tests/pos-macros/i7997.scala @@ -1,4 +1,4 @@ import scala.quoted._ -def oops(using QuoteContext) = { +def oops(using Quotes) = { val q = '{ class Foo { val x = 3; ${ val v = 'x; '{} } }} } diff --git a/tests/pos-macros/i8045.scala b/tests/pos-macros/i8045.scala index cd12b4f4e771..b0056886f996 100644 --- a/tests/pos-macros/i8045.scala +++ b/tests/pos-macros/i8045.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Test - def run(using qctx: QuoteContext)(tree: qctx.reflect.Tree): Unit = + def run(using Quotes)(tree: qctx.reflect.Tree): Unit = '{ ${ makeExpr(tree) } + 1 } - def makeExpr(using qctx: QuoteContext)(tree: qctx.reflect.Tree): Expr[Int] = ??? + def makeExpr(using Quotes)(tree: qctx.reflect.Tree): Expr[Int] = ??? diff --git a/tests/pos-macros/i8045b.scala b/tests/pos-macros/i8045b.scala index 300353542ed9..d9fd435bf331 100644 --- a/tests/pos-macros/i8045b.scala +++ b/tests/pos-macros/i8045b.scala @@ -1,8 +1,8 @@ import scala.quoted._ object Test - def run(using qctx: QuoteContext)(tree: qctx.reflect.Tree): Unit = - def nested()(using qctx.Nested): Expr[Int] = + def run(using q: Quotes)(tree: q.reflect.Tree): Unit = + def nested()(using q.Nested): Expr[Int] = '{ ${ makeExpr(tree) } + 1 } '{ ${ nested() } + 2 } - def makeExpr(using qctx: QuoteContext)(tree: qctx.reflect.Tree): Expr[Int] = ??? + def makeExpr(using q: Quotes)(tree: q.reflect.Tree): Expr[Int] = ??? diff --git a/tests/pos-macros/i8052.scala b/tests/pos-macros/i8052.scala index 6bae471bdfd8..e671c52846a8 100644 --- a/tests/pos-macros/i8052.scala +++ b/tests/pos-macros/i8052.scala @@ -8,7 +8,7 @@ object Macro2 { } object TC { - def derived[T: Type](ev: Expr[Mirror.Of[T]])(using qctx: QuoteContext): Expr[TC[T]] = '{ + def derived[T: Type](ev: Expr[Mirror.Of[T]])(using Quotes): Expr[TC[T]] = '{ new TC[T] { def encode(): Unit = ${ ev match { diff --git a/tests/pos-macros/i8100.scala b/tests/pos-macros/i8100.scala index 5572c2201a96..898cfcd4e89c 100644 --- a/tests/pos-macros/i8100.scala +++ b/tests/pos-macros/i8100.scala @@ -4,7 +4,7 @@ class M { type E } -def f[T: Type](using QuoteContext) = +def f[T: Type](using Quotes) = Expr.summon[M] match case Some('{ $mm : tt }) => '{ diff --git a/tests/pos-macros/i8302.scala b/tests/pos-macros/i8302.scala index 2d02a04718fd..ba82894f83c6 100644 --- a/tests/pos-macros/i8302.scala +++ b/tests/pos-macros/i8302.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def foo[T](using qctx: QuoteContext, tpe: Type[T]): Expr[Any] = - '{ (using qctx: QuoteContext) => +def foo[T](using Quotes, Type[T]): Expr[Any] = + '{ (using q: Quotes) => type TT = T val t = Type.of[TT] ??? diff --git a/tests/pos-macros/i8325/Macro_1.scala b/tests/pos-macros/i8325/Macro_1.scala index 117388442a37..e8b08d126f11 100644 --- a/tests/pos-macros/i8325/Macro_1.scala +++ b/tests/pos-macros/i8325/Macro_1.scala @@ -11,7 +11,7 @@ object A: def pure[A](a:A):A = ??? - def transformImplExpr[A:Type](using qctx: QuoteContext)(expr: Expr[A]): Expr[A] = { + def transformImplExpr[A:Type](using Quotes)(expr: Expr[A]): Expr[A] = { import qctx.reflect._ Term.of(expr) match { case Inlined(x,y,z) => transformImplExpr(z.asExpr.asInstanceOf[Expr[A]]) diff --git a/tests/pos-macros/i8325b/Macro_1.scala b/tests/pos-macros/i8325b/Macro_1.scala index ceb1ed51c488..1fd7442d92c0 100644 --- a/tests/pos-macros/i8325b/Macro_1.scala +++ b/tests/pos-macros/i8325b/Macro_1.scala @@ -11,7 +11,7 @@ object A: def pure[A](a:A):A = ??? - def transformImplExpr[A:Type](using qctx: QuoteContext)(expr: Expr[A]): Expr[A] = { + def transformImplExpr[A:Type](using Quotes)(expr: Expr[A]): Expr[A] = { import qctx.reflect._ Term.of(expr) match { case Inlined(x,y,z) => transformImplExpr(z.asExpr.asInstanceOf[Expr[A]]) diff --git a/tests/pos-macros/i8521/Macro_1.scala b/tests/pos-macros/i8521/Macro_1.scala index 716342dcd698..b5289f4c7cb1 100644 --- a/tests/pos-macros/i8521/Macro_1.scala +++ b/tests/pos-macros/i8521/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Foo { inline def foo[T <: AnyKind]: String = ${ bar[T] } - def bar[T <: AnyKind : Type](using qctx: QuoteContext): Expr[String] = { + def bar[T <: AnyKind : Type](using Quotes): Expr[String] = { import qctx.reflect._ def packageToName(sym: Symbol): Unit = { diff --git a/tests/pos-macros/i8651a.scala b/tests/pos-macros/i8651a.scala index 4e342cc8451f..24cad01570d4 100644 --- a/tests/pos-macros/i8651a.scala +++ b/tests/pos-macros/i8651a.scala @@ -1,5 +1,5 @@ import scala.quoted._ -def coroutineImpl(using QuoteContext): Expr[Any] = +def coroutineImpl(using Quotes): Expr[Any] = '{ new { def state: Int = 0 diff --git a/tests/pos-macros/i8651b.scala b/tests/pos-macros/i8651b.scala index 16e588160b0e..234a445801c2 100644 --- a/tests/pos-macros/i8651b.scala +++ b/tests/pos-macros/i8651b.scala @@ -8,7 +8,7 @@ object Macros { inline def coroutine[T](inline body: Any): Coroutine[T] = ${ coroutineImpl('{body}) } - def coroutineImpl[T: Type](expr: Expr[_ <: Any])(using QuoteContext): Expr[Coroutine[T]] = { + def coroutineImpl[T: Type](expr: Expr[_ <: Any])(using Quotes): Expr[Coroutine[T]] = { import qctx.reflect._ '{ diff --git a/tests/pos-macros/i8866/Macro_1.scala b/tests/pos-macros/i8866/Macro_1.scala index 356b2fa73ccb..0d177e0176ca 100644 --- a/tests/pos-macros/i8866/Macro_1.scala +++ b/tests/pos-macros/i8866/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object OtherMacro { - def impl(using qctx: QuoteContext): Expr[Int] = + def impl(using Quotes): Expr[Int] = '{ 42 } inline def apply = ${ OtherMacro.impl } @@ -11,7 +11,7 @@ object OtherMacro { object Macro { - def impl(using qctx: QuoteContext): Expr[Int] = { + def impl(using Quotes): Expr[Int] = { import qctx.reflect._ ValDef.let( diff --git a/tests/pos-macros/i8866b/Macro_1.scala b/tests/pos-macros/i8866b/Macro_1.scala index c5499b567b1b..b2ea945f1902 100644 --- a/tests/pos-macros/i8866b/Macro_1.scala +++ b/tests/pos-macros/i8866b/Macro_1.scala @@ -6,7 +6,7 @@ object Other { object Macro { - def impl(using qctx: QuoteContext): Expr[Int] = { + def impl(using Quotes): Expr[Int] = { import qctx.reflect._ ValDef.let( diff --git a/tests/pos-macros/i8866c/Macro_1.scala b/tests/pos-macros/i8866c/Macro_1.scala index 4e2cd585ea95..d035bcf4babe 100644 --- a/tests/pos-macros/i8866c/Macro_1.scala +++ b/tests/pos-macros/i8866c/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ def f(xs: Boolean*): Unit = ??? -def mcrImpl(using QuoteContext): Expr[Unit] = +def mcrImpl(using Quotes): Expr[Unit] = val func: Expr[Seq[Boolean] => Unit] = '{(esx: Seq[Boolean]) => f(esx: _*)} val trees: Expr[Seq[Boolean]] = '{Seq(true)} diff --git a/tests/pos-macros/i8879/Macro_1.scala b/tests/pos-macros/i8879/Macro_1.scala index fbbcca60f116..6aec3d778267 100644 --- a/tests/pos-macros/i8879/Macro_1.scala +++ b/tests/pos-macros/i8879/Macro_1.scala @@ -4,7 +4,7 @@ object Test { import scala.quoted._ - def impl[T](t: T)(using qctx: QuoteContext, tt: Type[T]): Expr[Any] = { + def impl[T](t: T)(using Quotes, Type[T]): Expr[Any] = { import qctx.reflect._ import util._ diff --git a/tests/pos-macros/i8945.scala b/tests/pos-macros/i8945.scala index d0873a4496b2..5bb028355e9f 100644 --- a/tests/pos-macros/i8945.scala +++ b/tests/pos-macros/i8945.scala @@ -21,7 +21,7 @@ object Macros { } object Macros3 { - def monoImpl(using quoted.QuoteContext) = '{()} + def monoImpl(using quoted.Quotes) = '{()} } } \ No newline at end of file diff --git a/tests/pos-macros/i9020-a/Macro_1.scala b/tests/pos-macros/i9020-a/Macro_1.scala index b26764654570..124a1604ca9f 100644 --- a/tests/pos-macros/i9020-a/Macro_1.scala +++ b/tests/pos-macros/i9020-a/Macro_1.scala @@ -6,7 +6,7 @@ object Show { inline def deriveWithMacro[T]: Show[T] = ${ impl[T] } import quoted._ - def impl[T](using ctx: QuoteContext, tpe: Type[T]): Expr[Show[T]] = + def impl[T](using ctx: Quotes, tpe: Type[T]): Expr[Show[T]] = '{ new Show[T] { def show(t: T): String = "TODO" diff --git a/tests/pos-macros/i9020-b/Macro_1.scala b/tests/pos-macros/i9020-b/Macro_1.scala index a6aee0d04e82..503eb48d0fa5 100644 --- a/tests/pos-macros/i9020-b/Macro_1.scala +++ b/tests/pos-macros/i9020-b/Macro_1.scala @@ -6,7 +6,7 @@ object Show { inline def deriveWithMacro[T]: Show[T] = ${ impl[T] } import quoted._ - def impl[T](using ctx: QuoteContext, tpe: Type[T]): Expr[Show[T]] = + def impl[T](using ctx: Quotes, tpe: Type[T]): Expr[Show[T]] = '{ new Show[tpe.Underlying] { def show(t: tpe.Underlying): String = "TODO" diff --git a/tests/pos-macros/i9240/Macro_1.scala b/tests/pos-macros/i9240/Macro_1.scala index 3a3cee0ecfc9..c25d2f6d80aa 100644 --- a/tests/pos-macros/i9240/Macro_1.scala +++ b/tests/pos-macros/i9240/Macro_1.scala @@ -2,11 +2,11 @@ import scala.quoted._ inline def diveInto[T]: String = ${ diveIntoImpl[T]() } -def diveIntoImpl[T]()(implicit qctx: QuoteContext, ttype: Type[T]): Expr[String] = +def diveIntoImpl[T]()(implicit qctx: Quotes, ttype: Type[T]): Expr[String] = import qctx.reflect._ Expr( unwindType(TypeRepr.of[T]) ) -def unwindType(using QuoteContext)(aType: qctx.reflect.TypeRepr): String = +def unwindType(using Quotes)(aType: qctx.reflect.TypeRepr): String = import qctx.reflect._ aType match { diff --git a/tests/pos-macros/i9251/Macro_1.scala b/tests/pos-macros/i9251/Macro_1.scala index 4c235609a3db..0289861fd470 100644 --- a/tests/pos-macros/i9251/Macro_1.scala +++ b/tests/pos-macros/i9251/Macro_1.scala @@ -18,7 +18,7 @@ object Async { } - def checkPrintTypeImpl[F[_]:Type,T:Type](f: Expr[T])(using qctx: QuoteContext): Expr[Unit] = + def checkPrintTypeImpl[F[_]:Type,T:Type](f: Expr[T])(using Quotes): Expr[Unit] = import qctx.reflect._ val fu = Term.of(f) diff --git a/tests/pos-macros/i9252/Macro.scala b/tests/pos-macros/i9252/Macro.scala index 0ac55b57cdf2..b696d79f083a 100644 --- a/tests/pos-macros/i9252/Macro.scala +++ b/tests/pos-macros/i9252/Macro.scala @@ -1,4 +1,4 @@ object Macro { inline def expand(): Unit = ${impl} - def impl(using scala.quoted.QuoteContext) = '{???} + def impl(using scala.quoted.Quotes) = '{???} } \ No newline at end of file diff --git a/tests/pos-macros/i9321/macros.scala b/tests/pos-macros/i9321/macros.scala index 06f56800a3ca..05017f95d6de 100644 --- a/tests/pos-macros/i9321/macros.scala +++ b/tests/pos-macros/i9321/macros.scala @@ -5,10 +5,10 @@ type F[X] def varargsFunc(funcs0: Foo*) = ??? inline def mcr1: F[String] = ${ mcr1Impl } -def mcr1Impl(using QuoteContext): Expr[F[String]] = '{???} +def mcr1Impl(using Quotes): Expr[F[String]] = '{???} inline def mcr2: Unit = ${mcr2Impl} -def mcr2Impl(using ctx: QuoteContext): Expr[Unit] = +def mcr2Impl(using ctx: Quotes): Expr[Unit] = val func: Expr[Seq[Foo] => Unit] = '{ (esx: Seq[Foo]) => varargsFunc(esx: _*) } val trees: Expr[Seq[Foo]] = diff --git a/tests/pos-macros/i9465.scala b/tests/pos-macros/i9465.scala index 9c59f08b2ffb..6141cbea5927 100644 --- a/tests/pos-macros/i9465.scala +++ b/tests/pos-macros/i9465.scala @@ -6,7 +6,7 @@ trait Coll[A] { } object QuoteTest { - def compile(expr: Expr[Any])(using QuoteContext): Expr[Any] = expr match { + def compile(expr: Expr[Any])(using Quotes): Expr[Any] = expr match { case '{ (??? : Coll[y]).map[b] } => ??? } } diff --git a/tests/pos-macros/i9484/C.scala b/tests/pos-macros/i9484/C.scala index daf819cd3f96..e4c6185c705d 100644 --- a/tests/pos-macros/i9484/C.scala +++ b/tests/pos-macros/i9484/C.scala @@ -2,5 +2,5 @@ import scala.quoted._ object C { inline def m: Any = ${ mExpr } - def mExpr(using qctx: QuoteContext): Expr[Any] = Expr(1) + def mExpr(using Quotes): Expr[Any] = Expr(1) } diff --git a/tests/pos-macros/i9484/Q.scala b/tests/pos-macros/i9484/Q.scala index accd4c28590f..411ca6bca67a 100644 --- a/tests/pos-macros/i9484/Q.scala +++ b/tests/pos-macros/i9484/Q.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Q { inline def f(): Any = ${ fExpr } - def fExpr(using QuoteContext): Expr[Any] = { new LC; Expr(1) } + def fExpr(using Quotes): Expr[Any] = { new LC; Expr(1) } } \ No newline at end of file diff --git a/tests/pos-macros/i9484b/C.scala b/tests/pos-macros/i9484b/C.scala index 7021ba7dc575..987bd6a40136 100644 --- a/tests/pos-macros/i9484b/C.scala +++ b/tests/pos-macros/i9484b/C.scala @@ -2,5 +2,5 @@ import scala.quoted._ object C { inline def m: Any = ${ mExpr } - def mExpr(using qctx: QuoteContext): Expr[Any] = '{ () } + def mExpr(using Quotes): Expr[Any] = '{ () } } diff --git a/tests/pos-macros/i9484b/Q.scala b/tests/pos-macros/i9484b/Q.scala index 8d8a2a5461e3..94b2bd60bb45 100644 --- a/tests/pos-macros/i9484b/Q.scala +++ b/tests/pos-macros/i9484b/Q.scala @@ -6,5 +6,5 @@ object Q { object Q2 { val m = C.m - def fExpr(f: Expr[Any])(using QuoteContext): Expr[Any] = '{ () } + def fExpr(f: Expr[Any])(using Quotes): Expr[Any] = '{ () } } diff --git a/tests/pos-macros/i9518/Macro_1.scala b/tests/pos-macros/i9518/Macro_1.scala index e0d3ff7fd500..d0a147c70798 100644 --- a/tests/pos-macros/i9518/Macro_1.scala +++ b/tests/pos-macros/i9518/Macro_1.scala @@ -5,7 +5,7 @@ trait CB[T] inline def shift : Unit = ${ shiftTerm } -def shiftTerm(using QuoteContext): Expr[Unit] = { +def shiftTerm(using Quotes): Expr[Unit] = { import qctx.reflect._ val nTree = Term.of('{ ??? : CB[Int] }) val tp1 = TypeRepr.of[CB[Int]] diff --git a/tests/pos-macros/i9570.scala b/tests/pos-macros/i9570.scala index 03a2c7f15068..c222819997bc 100644 --- a/tests/pos-macros/i9570.scala +++ b/tests/pos-macros/i9570.scala @@ -7,7 +7,7 @@ object Macros { case class HCons[+HD, TL <: HList](hd: HD, tl: TL) extends HList case object HNil extends HList - private def sizeImpl(e: Expr[HList], n:Int)(using qctx:QuoteContext): Expr[Int] = { + private def sizeImpl(e: Expr[HList], n:Int)(using qctx:Quotes): Expr[Int] = { import qctx.reflect._ e match { case '{HCons(_,$t)} => // error if run with fatal warinings in BootstrappedOnlyCompilationTests diff --git a/tests/pos-macros/i9687/Macro_1.scala b/tests/pos-macros/i9687/Macro_1.scala index 5fe76171fc34..2e3a3f393878 100644 --- a/tests/pos-macros/i9687/Macro_1.scala +++ b/tests/pos-macros/i9687/Macro_1.scala @@ -22,7 +22,7 @@ object X { transformImpl[A]('x) } - def transformImpl[A:Type](x:Expr[A])(using qctx: QuoteContext):Expr[A] = { + def transformImpl[A:Type](x:Expr[A])(using Quotes):Expr[A] = { import qctx.reflect._ val slowPath = Term.of('{ SlowPath }) val fastPath = Term.of('{ FastPath }) diff --git a/tests/pos-macros/i9802/Macro_1.scala b/tests/pos-macros/i9802/Macro_1.scala index e2a65a507fb7..a3e7760a5644 100644 --- a/tests/pos-macros/i9802/Macro_1.scala +++ b/tests/pos-macros/i9802/Macro_1.scala @@ -2,4 +2,4 @@ import scala.quoted._ inline def fun(inline prog: Double): Double = ${impl('prog)} -def impl(prog: => Expr[Double])(using QuoteContext) : Expr[Double] = '{ 42.0 } +def impl(prog: => Expr[Double])(using Quotes) : Expr[Double] = '{ 42.0 } diff --git a/tests/pos-macros/i9812.scala b/tests/pos-macros/i9812.scala index 25218802ff31..e09db34fea2a 100644 --- a/tests/pos-macros/i9812.scala +++ b/tests/pos-macros/i9812.scala @@ -5,4 +5,4 @@ sealed abstract class SomeEnum object SomeEnum: final val Foo = new SomeEnum {} -def quoteFoo: QuoteContext ?=> Expr[SomeEnum.Foo.type] = '{SomeEnum.Foo} +def quoteFoo: Quotes ?=> Expr[SomeEnum.Foo.type] = '{SomeEnum.Foo} diff --git a/tests/pos-macros/i9894/Macro_1.scala b/tests/pos-macros/i9894/Macro_1.scala index 56c8102d926a..8d5d294e2fea 100644 --- a/tests/pos-macros/i9894/Macro_1.scala +++ b/tests/pos-macros/i9894/Macro_1.scala @@ -20,7 +20,7 @@ object X: processImpl[T]('f) } - def processImpl[T:Type](f:Expr[T])(using qctx: QuoteContext):Expr[CB[T]] = + def processImpl[T:Type](f:Expr[T])(using Quotes):Expr[CB[T]] = import qctx.reflect._ def transform(term:Term):Term = diff --git a/tests/pos-macros/macro-classloaders/Macro.scala b/tests/pos-macros/macro-classloaders/Macro.scala index e0d01897028b..947edf652bfa 100644 --- a/tests/pos-macros/macro-classloaders/Macro.scala +++ b/tests/pos-macros/macro-classloaders/Macro.scala @@ -5,7 +5,7 @@ import scala.quoted._ object Macro { self => inline def f: Any = ${ impl } - def impl(using QuoteContext): Expr[Any] = { + def impl(using Quotes): Expr[Any] = { //println("======== "+self.getClass.getClassLoader.asInstanceOf[URLClassLoader].getURLs.mkString("; ")) //println(" ====== "+Thread.currentThread().getContextClassLoader.asInstanceOf[URLClassLoader].getURLs.mkString("; ")) assert(getClass.getClassLoader eq Thread.currentThread().getContextClassLoader, diff --git a/tests/pos-macros/macro-docs.scala b/tests/pos-macros/macro-docs.scala index bebe01cc3d66..b1f7d4933934 100644 --- a/tests/pos-macros/macro-docs.scala +++ b/tests/pos-macros/macro-docs.scala @@ -24,7 +24,7 @@ object MacrosMD_Liftable { } } - def showExpr[T](expr: Expr[T])(using QuoteContext): Expr[String] = { + def showExpr[T](expr: Expr[T])(using Quotes): Expr[String] = { val code: String = expr.show Expr(code) } diff --git a/tests/pos-macros/macro-with-type/Macro_1.scala b/tests/pos-macros/macro-with-type/Macro_1.scala index 786f397347d9..73bf4bae895d 100644 --- a/tests/pos-macros/macro-with-type/Macro_1.scala +++ b/tests/pos-macros/macro-with-type/Macro_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macro { inline def ff: Unit = ${impl(Type.of[Int])} - def impl(t: Type[Int])(using QuoteContext): Expr[Unit] = '{} + def impl(t: Type[Int])(using Quotes): Expr[Unit] = '{} } diff --git a/tests/pos-macros/macros-in-same-project-1/Foo.scala b/tests/pos-macros/macros-in-same-project-1/Foo.scala index d45bda5775d7..e463e43fe840 100644 --- a/tests/pos-macros/macros-in-same-project-1/Foo.scala +++ b/tests/pos-macros/macros-in-same-project-1/Foo.scala @@ -4,6 +4,6 @@ object Foo { inline def myMacro(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using QuoteContext): Expr[Unit] = '{ println("Hello") } + def aMacroImplementation(using Quotes): Expr[Unit] = '{ println("Hello") } } diff --git a/tests/pos-macros/macros-in-same-project-2/Foo.scala b/tests/pos-macros/macros-in-same-project-2/Foo.scala index 25e1a530cd12..7f77c8e356fd 100644 --- a/tests/pos-macros/macros-in-same-project-2/Foo.scala +++ b/tests/pos-macros/macros-in-same-project-2/Foo.scala @@ -2,6 +2,6 @@ import scala.quoted._ object Foo { - def aMacroImplementation(using QuoteContext): Expr[Unit] = '{ println("Hello") } + def aMacroImplementation(using Quotes): Expr[Unit] = '{ println("Hello") } } diff --git a/tests/pos-macros/macros-in-same-project-3/Bar.scala b/tests/pos-macros/macros-in-same-project-3/Bar.scala index 11d8aa44511b..26bbb440fac8 100644 --- a/tests/pos-macros/macros-in-same-project-3/Bar.scala +++ b/tests/pos-macros/macros-in-same-project-3/Bar.scala @@ -4,6 +4,6 @@ object Bar { inline def myMacro(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using QuoteContext): Expr[Unit] = Foo.hello() + def aMacroImplementation(using Quotes): Expr[Unit] = Foo.hello() } diff --git a/tests/pos-macros/macros-in-same-project-3/Foo.scala b/tests/pos-macros/macros-in-same-project-3/Foo.scala index 17cb639647fb..c2d88908dcb4 100644 --- a/tests/pos-macros/macros-in-same-project-3/Foo.scala +++ b/tests/pos-macros/macros-in-same-project-3/Foo.scala @@ -2,6 +2,6 @@ import scala.quoted._ object Foo { - def hello()(using QuoteContext): Expr[Unit] = '{ println("Hello") } + def hello()(using Quotes): Expr[Unit] = '{ println("Hello") } } diff --git a/tests/pos-macros/macros-in-same-project-4/Bar.scala b/tests/pos-macros/macros-in-same-project-4/Bar.scala index 22f46fdc84e9..9bcb16bdc9ac 100644 --- a/tests/pos-macros/macros-in-same-project-4/Bar.scala +++ b/tests/pos-macros/macros-in-same-project-4/Bar.scala @@ -3,9 +3,9 @@ import scala.quoted._ object Bar { inline def eqMacro(x: Foo, y: Foo): Boolean = ${ eqMacroExpr('x, 'y) } - def eqMacroExpr(x: Expr[Foo], y: Expr[Foo])(using QuoteContext): Expr[Boolean] = '{ $x == $y } + def eqMacroExpr(x: Expr[Foo], y: Expr[Foo])(using Quotes): Expr[Boolean] = '{ $x == $y } inline def plusMacro(x: Foo, y: Foo): Foo = ${ eqPlusExpr('x, 'y) } - def eqPlusExpr(x: Expr[Foo], y: Expr[Foo])(using QuoteContext): Expr[Foo] = '{ new Foo($x.value + $y.value) } + def eqPlusExpr(x: Expr[Foo], y: Expr[Foo])(using Quotes): Expr[Foo] = '{ new Foo($x.value + $y.value) } } diff --git a/tests/pos-macros/nil-liftable.scala b/tests/pos-macros/nil-liftable.scala index 745bfcf45dab..a8ac5bbd6240 100644 --- a/tests/pos-macros/nil-liftable.scala +++ b/tests/pos-macros/nil-liftable.scala @@ -2,6 +2,6 @@ import scala.quoted._ class Test: given NilIsLiftable as Liftable[Nil.type] = new Liftable[Nil.type] { - def toExpr(xs: Nil.type): QuoteContext ?=> Expr[Nil.type] = + def toExpr(xs: Nil.type): Quotes ?=> Expr[Nil.type] = '{ Nil } } diff --git a/tests/pos-macros/power-macro/Macro_1.scala b/tests/pos-macros/power-macro/Macro_1.scala index bb78bb21ca85..7840b3d45204 100644 --- a/tests/pos-macros/power-macro/Macro_1.scala +++ b/tests/pos-macros/power-macro/Macro_1.scala @@ -5,10 +5,10 @@ object PowerMacro { inline def power(inline n: Long, x: Double) = ${powerCode('n, 'x)} - def powerCode(n: Expr[Long], x: Expr[Double]) (using QuoteContext): Expr[Double] = + def powerCode(n: Expr[Long], x: Expr[Double]) (using Quotes): Expr[Double] = powerCode(n.unliftOrError, x) - def powerCode(n: Long, x: Expr[Double])(using QuoteContext): Expr[Double] = + def powerCode(n: Long, x: Expr[Double])(using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n % 2 == 0) '{ { val y = $x * $x; ${powerCode(n / 2, 'y)} } } else '{ $x * ${powerCode(n - 1, x)} } diff --git a/tests/pos-macros/quote-1.scala b/tests/pos-macros/quote-1.scala index a67a760f62d7..23107f72053b 100644 --- a/tests/pos-macros/quote-1.scala +++ b/tests/pos-macros/quote-1.scala @@ -1,6 +1,6 @@ import scala.quoted._ -class Test(using QuoteContext) { +class Test(using Quotes) { def f[T](x: Expr[T])(implicit t: Type[T]) = '{ val y: T = $x diff --git a/tests/pos-macros/quote-bind-T.scala b/tests/pos-macros/quote-bind-T.scala index eea1f0d901b5..99553e5ed742 100644 --- a/tests/pos-macros/quote-bind-T.scala +++ b/tests/pos-macros/quote-bind-T.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Test { - def matchX[T](x: Expr[T])(using Type[T], QuoteContext): Expr[T] = '{ + def matchX[T](x: Expr[T])(using Type[T], Quotes): Expr[T] = '{ $x match { case y: T => y } diff --git a/tests/pos-macros/quote-lift.scala b/tests/pos-macros/quote-lift.scala index 9e5b1adcedce..3bb85a133f1d 100644 --- a/tests/pos-macros/quote-lift.scala +++ b/tests/pos-macros/quote-lift.scala @@ -1,6 +1,6 @@ import scala.quoted._ -class Test(using QuoteContext) { +class Test(using Quotes) { '{ ${implicitly[Liftable[Int]].toExpr(1)} } diff --git a/tests/pos-macros/quote-liftable.scala b/tests/pos-macros/quote-liftable.scala index a7d7c00cb376..d83ddfe5557a 100644 --- a/tests/pos-macros/quote-liftable.scala +++ b/tests/pos-macros/quote-liftable.scala @@ -1,8 +1,8 @@ import scala.quoted._ -def test(using QuoteContext) = { +def test(using Quotes) = { - given QuoteContext = ??? + given Quotes = ??? implicit def IntIsLiftable: Liftable[Int] = new { def toExpr(n: Int) = n match { diff --git a/tests/pos-macros/quote-matching-implicit-types.scala b/tests/pos-macros/quote-matching-implicit-types.scala index cf4e781acbaf..e75749dbc4ab 100644 --- a/tests/pos-macros/quote-matching-implicit-types.scala +++ b/tests/pos-macros/quote-matching-implicit-types.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Foo { - def f(e: Expr[Any])(using QuoteContext): Unit = e match { + def f(e: Expr[Any])(using Quotes): Unit = e match { case '{ foo[t]($x) } => bar(x) case '{ foo[t]($x) } if bar(x) => () case '{ foo[t]($x) } => '{ foo($x) } diff --git a/tests/pos-macros/quote-nested-object/Macro_1.scala b/tests/pos-macros/quote-nested-object/Macro_1.scala index 48eaeb49d9e3..f4b1456d4931 100644 --- a/tests/pos-macros/quote-nested-object/Macro_1.scala +++ b/tests/pos-macros/quote-nested-object/Macro_1.scala @@ -8,7 +8,7 @@ object Macro { inline def plus(inline n: Int, m: Int): Int = ${ plus('n, 'm) } - def plus(n: Expr[Int], m: Expr[Int]) (using QuoteContext): Expr[Int] = + def plus(n: Expr[Int], m: Expr[Int]) (using Quotes): Expr[Int] = if (n.unliftOrError == 0) m else '{ ${n} + $m } @@ -16,7 +16,7 @@ object Macro { inline def plus(inline n: Int, m: Int): Int = ${ plus('n, 'm) } - def plus(n: Expr[Int], m: Expr[Int]) (using QuoteContext): Expr[Int] = + def plus(n: Expr[Int], m: Expr[Int]) (using Quotes): Expr[Int] = if (n.unliftOrError == 0) m else '{ ${n} + $m } } diff --git a/tests/pos-macros/quote-nested.scala b/tests/pos-macros/quote-nested.scala index e01404ab6d0a..7a35c482c989 100644 --- a/tests/pos-macros/quote-nested.scala +++ b/tests/pos-macros/quote-nested.scala @@ -5,7 +5,7 @@ object Macro { inline def foo: Unit = ${ nested() } - private def nested()(using QuoteContext): Expr[Unit] = '{ + private def nested()(using Quotes): Expr[Unit] = '{ var i = 0 ${ val x: Expr[Double] = '{ diff --git a/tests/pos-macros/quote-no-splices.scala b/tests/pos-macros/quote-no-splices.scala index de7ae9a49bb2..6ed98ff4c048 100644 --- a/tests/pos-macros/quote-no-splices.scala +++ b/tests/pos-macros/quote-no-splices.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Foo { - def foo(using QuoteContext): Unit = { + def foo(using Quotes): Unit = { val expr ='{ val a = 3 println("foo") diff --git a/tests/pos-macros/quote-non-static-macro.scala b/tests/pos-macros/quote-non-static-macro.scala index bc37f4e490d4..6896b57f7d47 100644 --- a/tests/pos-macros/quote-non-static-macro.scala +++ b/tests/pos-macros/quote-non-static-macro.scala @@ -14,5 +14,5 @@ object Foo { object Quox { inline def foo: Unit = ${Foo.impl} } - def impl(using QuoteContext): Expr[Unit] = '{} + def impl(using Quotes): Expr[Unit] = '{} } diff --git a/tests/pos-macros/quote-this.scala b/tests/pos-macros/quote-this.scala index aaf7f807e2fa..ea9173c5d0c7 100644 --- a/tests/pos-macros/quote-this.scala +++ b/tests/pos-macros/quote-this.scala @@ -1,16 +1,16 @@ import scala.quoted._ class Foo { - def a(using QuoteContext): Expr[Int] = '{1} - def b(using QuoteContext): Expr[Int] = '{ + def a(using Quotes): Expr[Int] = '{1} + def b(using Quotes): Expr[Int] = '{ ${ this.a } } - def d(using QuoteContext): Expr[QuoteContext ?=> Expr[Int]] = '{ '{1} } + def d(using Quotes): Expr[Quotes ?=> Expr[Int]] = '{ '{1} } def foo[T](x: T): T = x - def f(using QuoteContext) = '{ + def f(using Quotes) = '{ ${ foo[this.type](this).a } } @@ -22,5 +22,5 @@ class Foo { } object Foo { - def impl[T](x: Any)(using QuoteContext): Expr[Unit] = '{} + def impl[T](x: Any)(using Quotes): Expr[Unit] = '{} } diff --git a/tests/pos-macros/quote-type-with-param.scala b/tests/pos-macros/quote-type-with-param.scala index c639f8129860..b7ab6ca11426 100644 --- a/tests/pos-macros/quote-type-with-param.scala +++ b/tests/pos-macros/quote-type-with-param.scala @@ -1,4 +1,4 @@ import scala.quoted._ -def f(using QuoteContext): Unit = +def f(using Quotes): Unit = '{ type T[X] = List[X] } diff --git a/tests/pos-macros/quote-whitebox-2/Macro_1.scala b/tests/pos-macros/quote-whitebox-2/Macro_1.scala index 94a5c9e5e688..6ba6fc66e5c8 100644 --- a/tests/pos-macros/quote-whitebox-2/Macro_1.scala +++ b/tests/pos-macros/quote-whitebox-2/Macro_1.scala @@ -5,7 +5,7 @@ object Macro { transparent inline def charOrString(inline str: String): Any = ${ impl('str) } - def impl(strExpr: Expr[String]) (using QuoteContext)= + def impl(strExpr: Expr[String]) (using Quotes)= val str = strExpr.unliftOrError if (str.length == 1) Expr(str.charAt(0)) else Expr(str) diff --git a/tests/pos-macros/quoted-inline-quote.scala b/tests/pos-macros/quoted-inline-quote.scala index dc86d45cf86b..dc8a5d9ad8b5 100644 --- a/tests/pos-macros/quoted-inline-quote.scala +++ b/tests/pos-macros/quoted-inline-quote.scala @@ -1,6 +1,6 @@ import scala.quoted._ -class Foo(using QuoteContext) { - inline def foo(x: Expr[String])(using QuoteContext) = '{ println(${x}) } +class Foo(using Quotes) { + inline def foo(x: Expr[String])(using Quotes) = '{ println(${x}) } foo('{"abc"}) } diff --git a/tests/pos-macros/quoted-pattern-type.scala b/tests/pos-macros/quoted-pattern-type.scala index 9b6c06601bb3..4cf7e0f43bab 100644 --- a/tests/pos-macros/quoted-pattern-type.scala +++ b/tests/pos-macros/quoted-pattern-type.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Lib { - def impl[T: Type](arg: Expr[T])(using QuoteContext): Expr[T] = { + def impl[T: Type](arg: Expr[T])(using Quotes): Expr[T] = { arg match { case e @ '{ $x: Boolean } => e: Expr[T & Boolean] diff --git a/tests/pos-macros/quoted-splice-pattern-applied.scala b/tests/pos-macros/quoted-splice-pattern-applied.scala index d861ddbc0ce5..b6f5065905cd 100644 --- a/tests/pos-macros/quoted-splice-pattern-applied.scala +++ b/tests/pos-macros/quoted-splice-pattern-applied.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def f(x: Expr[Int])(using QuoteContext) = x match { +def f(x: Expr[Int])(using Quotes) = x match { case '{ ${f}($a: Int): Int } => val f1: Expr[Int => Int] = f val a1: Expr[Int] = a diff --git a/tests/pos-macros/quoted-var.scala b/tests/pos-macros/quoted-var.scala index 7de01c9bb540..847151733674 100644 --- a/tests/pos-macros/quoted-var.scala +++ b/tests/pos-macros/quoted-var.scala @@ -3,13 +3,13 @@ import scala.quoted._ class Var[T] object Var { - def apply[T: Type, U: Type](init: Expr[T])(body: Var[T] => Expr[U])(using qctx: QuoteContext): Expr[U] = '{ + def apply[T: Type, U: Type](init: Expr[T])(body: Var[T] => Expr[U])(using Quotes): Expr[U] = '{ var x = $init ${ body( new Var[T] { - def get(using qctx: QuoteContext): Expr[T] = 'x - def update(e: Expr[T])(using qctx: QuoteContext): Expr[Unit] = '{ x = $e } + def get(using Quotes): Expr[T] = 'x + def update(e: Expr[T])(using Quotes): Expr[Unit] = '{ x = $e } } ) } diff --git a/tests/pos-macros/quotedPatterns-4.scala b/tests/pos-macros/quotedPatterns-4.scala index 7bf0a4cef0fd..472898f96107 100644 --- a/tests/pos-macros/quotedPatterns-4.scala +++ b/tests/pos-macros/quotedPatterns-4.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Test { - def impl(receiver: Expr[StringContext])(using qctx: scala.quoted.QuoteContext) = { + def impl(receiver: Expr[StringContext])(using qctx: scala.quoted.Quotes) = { import qctx.reflect.Repeated receiver match { case '{ StringContext(${Repeated(parts)}: _*) } => // now OK diff --git a/tests/pos-macros/quotedPatterns.scala b/tests/pos-macros/quotedPatterns.scala index 92e1822de5a2..ec4d32cdf588 100644 --- a/tests/pos-macros/quotedPatterns.scala +++ b/tests/pos-macros/quotedPatterns.scala @@ -1,12 +1,12 @@ import scala.quoted._ object Test { - def x(using QuoteContext) = '{1 + 2} + def x(using Quotes) = '{1 + 2} def f(x: Int) = x def g(x: Int, y: Int) = x * y - def res(using QuoteContext): quoted.Expr[Int] = x match { + def res(using Quotes): quoted.Expr[Int] = x match { case '{1 + 2} => '{0} case '{f($y)} => y case '{g($y, $z)} => '{$y * $z} diff --git a/tests/pos-macros/scala2-macro-compat-1.scala b/tests/pos-macros/scala2-macro-compat-1.scala index 6fb83ab62dc4..66e17ac86813 100644 --- a/tests/pos-macros/scala2-macro-compat-1.scala +++ b/tests/pos-macros/scala2-macro-compat-1.scala @@ -19,7 +19,7 @@ object LineNumberMacro2 { object LineNumberMacro3 { import scala.quoted._ - def thisLineNumberExpr(using qctx: QuoteContext): Expr[Int] = { + def thisLineNumberExpr(using Quotes): Expr[Int] = { import qctx.reflect._ Expr(Position.ofMacroExpansion.startLine + 1) } diff --git a/tests/pos-macros/splice-with-explicit-context.scala b/tests/pos-macros/splice-with-explicit-context.scala index 964e97d44545..a44eb2fcbbae 100644 --- a/tests/pos-macros/splice-with-explicit-context.scala +++ b/tests/pos-macros/splice-with-explicit-context.scala @@ -1,7 +1,7 @@ import scala.quoted._ -def f(a: Expr[Int])(using qctx: QuoteContext): Unit = +def f(a: Expr[Int])(using q: Quotes): Unit = - '{ val x: Int = ${ (using qctx2) => a } } + '{ val x: Int = ${ (using q2) => a } } - '{ val x: Int = ${ (using qctx2: qctx.Nested) => a } } + '{ val x: Int = ${ (using q2: q.Nested) => a } } diff --git a/tests/pos-macros/tasty-constant-type/Macro_1.scala b/tests/pos-macros/tasty-constant-type/Macro_1.scala index 3d4288be1ccb..a7a0a1552533 100644 --- a/tests/pos-macros/tasty-constant-type/Macro_1.scala +++ b/tests/pos-macros/tasty-constant-type/Macro_1.scala @@ -6,7 +6,7 @@ object Macro { transparent inline def ff[A <: Int, B <: Int](): AddInt[A, B] = ${ impl[A, B] } - def impl[A <: Int : Type, B <: Int : Type](using qctx: QuoteContext) : Expr[AddInt[A, B]] = { + def impl[A <: Int : Type, B <: Int : Type](using Quotes) : Expr[AddInt[A, B]] = { import qctx.reflect._ val ConstantType(Constant.Int(v1)) = TypeRepr.of[A] diff --git a/tests/pos-macros/toexproftuple.scala b/tests/pos-macros/toexproftuple.scala index 8d774148da03..e71ea1802c59 100644 --- a/tests/pos-macros/toexproftuple.scala +++ b/tests/pos-macros/toexproftuple.scala @@ -1,7 +1,7 @@ import scala.quoted._, scala.deriving._ inline def mcr: Any = ${mcrImpl} -def mcrImpl(using ctx: QuoteContext): Expr[Any] = { +def mcrImpl(using ctx: Quotes): Expr[Any] = { val tpl: (Expr[1], Expr[2], Expr[3]) = ('{1}, '{2}, '{3}) '{val res: (1, 2, 3) = ${Expr.ofTuple(tpl)}; res} } diff --git a/tests/pos-macros/treemap-unapply/Macro.scala b/tests/pos-macros/treemap-unapply/Macro.scala index 78f62774fbca..fd21e499bbb9 100644 --- a/tests/pos-macros/treemap-unapply/Macro.scala +++ b/tests/pos-macros/treemap-unapply/Macro.scala @@ -1,7 +1,7 @@ import scala.quoted._ inline def mcr(x: => Unit): Unit = ${mcrImpl('x)} -def mcrImpl(x: Expr[Unit])(using QuoteContext) : Expr[Unit] = +def mcrImpl(x: Expr[Unit])(using Quotes) : Expr[Unit] = import qctx.reflect._ val tr: Term = Term.of(x) object m extends TreeMap diff --git a/tests/pos-macros/typetags.scala b/tests/pos-macros/typetags.scala index c3dc50fceb89..97e915dda84c 100644 --- a/tests/pos-macros/typetags.scala +++ b/tests/pos-macros/typetags.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Test { - def f[T: Type](using QuoteContext) = { + def f[T: Type](using Quotes) = { implicitly[Type[Int]] implicitly[Type[List[Int]]] implicitly[Type[T]] diff --git a/tests/pos-macros/using-quote-context.scala b/tests/pos-macros/using-quote-context.scala index 51205190ecbd..1581356517a0 100644 --- a/tests/pos-macros/using-quote-context.scala +++ b/tests/pos-macros/using-quote-context.scala @@ -1,6 +1,6 @@ import scala.quoted._ class Test { - def fold[W: Type](s: Expr[W]): QuoteContext ?=> Expr[W] = + def fold[W: Type](s: Expr[W]): Quotes ?=> Expr[W] = '{ ???; $s } } diff --git a/tests/pos-special/fatal-warnings/tasty-parent-unapply.scala b/tests/pos-special/fatal-warnings/tasty-parent-unapply.scala index 5c9e3d770007..c1407ee79e2b 100644 --- a/tests/pos-special/fatal-warnings/tasty-parent-unapply.scala +++ b/tests/pos-special/fatal-warnings/tasty-parent-unapply.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Macros { - def impl(using QuoteContext): Unit = { + def impl(using Quotes): Unit = { import qctx.reflect._ def foo(tree: Tree, term: Term, typeTree: TypeTree, parent: Tree) = { diff --git a/tests/pos-staging/quote-0.scala b/tests/pos-staging/quote-0.scala index ead7fba69501..f27198d2d1b4 100644 --- a/tests/pos-staging/quote-0.scala +++ b/tests/pos-staging/quote-0.scala @@ -7,18 +7,18 @@ object Macros { inline def assert(expr: => Boolean): Unit = ${ assertImpl('expr) } - def assertImpl(expr: Expr[Boolean])(using QuoteContext) = + def assertImpl(expr: Expr[Boolean])(using Quotes) = '{ if !($expr) then throw new AssertionError(s"failed assertion: ${${showExpr(expr)}}") } - def showExpr[T](expr: Expr[T])(using QuoteContext): Expr[String] = Expr(expr.toString) + def showExpr[T](expr: Expr[T])(using Quotes): Expr[String] = Expr(expr.toString) inline def power(inline n: Int, x: Double) = ${ powerCode('n, 'x) } - def powerCode(n: Expr[Int], x: Expr[Double]) (using QuoteContext): Expr[Double] = + def powerCode(n: Expr[Int], x: Expr[Double]) (using Quotes): Expr[Double] = powerCode(n.unliftOrError, x) - def powerCode(n: Int, x: Expr[Double])(using QuoteContext): Expr[Double] = + def powerCode(n: Int, x: Expr[Double])(using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n == 1) x else if (n % 2 == 0) '{ { val y = $x * $x; ${ powerCode(n / 2, 'y) } } } diff --git a/tests/pos-staging/quote-assert/quoted_1.scala b/tests/pos-staging/quote-assert/quoted_1.scala index b298b97f963f..83a707770474 100644 --- a/tests/pos-staging/quote-assert/quoted_1.scala +++ b/tests/pos-staging/quote-assert/quoted_1.scala @@ -1,6 +1,6 @@ import scala.quoted._ object Macros { - def assertImpl(expr: Expr[Boolean])(using QuoteContext) = + def assertImpl(expr: Expr[Boolean])(using Quotes) = '{ if !($expr) then throw new AssertionError(s"failed assertion: ${$expr}") } } diff --git a/tests/pos-staging/quote-assert/quoted_2.scala b/tests/pos-staging/quote-assert/quoted_2.scala index 57af0f4d8bfc..031518cbd960 100644 --- a/tests/pos-staging/quote-assert/quoted_2.scala +++ b/tests/pos-staging/quote-assert/quoted_2.scala @@ -10,7 +10,7 @@ object Test { ${ assertImpl('expr) } - def program(using QuoteContext) = '{ + def program(using Quotes) = '{ val x = 1 assert(x != 0) diff --git a/tests/rewrites/i9632.scala b/tests/rewrites/i9632.scala index bfa7a3494746..8002eeb65113 100644 --- a/tests/rewrites/i9632.scala +++ b/tests/rewrites/i9632.scala @@ -1,4 +1,4 @@ -def f(using scala.quoted.QuoteContext) = +def f(using scala.quoted.Quotes) = '{ val x = ${ ??? diff --git a/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala b/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala index fdb7fab3ea46..ef50098ce82d 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-definitions-2/Macro_1.scala @@ -5,7 +5,7 @@ object Foo { inline def inspectBody(inline i: Int): String = ${ inspectBodyImpl('i) } - def inspectBodyImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[String] = { + def inspectBodyImpl(x: Expr[Int])(using Quotes) : Expr[String] = { import qctx.reflect._ Term.of(x) match { case Inlined(None, Nil, arg) => Expr(arg.symbol.tree.showExtractors) diff --git a/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala b/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala index d0ca25fbf60f..87527d1d15e9 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-definitions-3/Macro_1.scala @@ -5,7 +5,7 @@ object Foo { inline def inspectBody(inline i: Int): String = ${ inspectBodyImpl('i) } - def inspectBodyImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[String] = { + def inspectBodyImpl(x: Expr[Int])(using Quotes) : Expr[String] = { import qctx.reflect._ Term.of(x) match { case Inlined(None, Nil, arg) => Expr(arg.symbol.tree.showExtractors) diff --git a/tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala b/tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala index d753e3bb9c7c..0ddeb65330b5 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-extractors-owners/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { implicit inline def printOwners[T](inline x: T): Unit = ${ impl('x) } - def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { + def impl[T](x: Expr[T])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val buff = new StringBuilder @@ -18,7 +18,7 @@ object Macros { } - def myTraverser(using qctx: QuoteContext)(buff: StringBuilder): qctx.reflect.TreeTraverser = new { + def myTraverser(using Quotes)(buff: StringBuilder): qctx.reflect.TreeTraverser = new { import qctx.reflect._ override def traverseTree(tree: Tree)(owner: Symbol): Unit = { tree match { diff --git a/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala b/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala index 8b6ef3ebece7..42656c2a8436 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-load-tree-1/quoted_1.scala @@ -6,7 +6,7 @@ object Foo { inline def inspectBody(inline i: Int): String = ${ inspectBodyImpl('i) } - def inspectBodyImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[String] = { + def inspectBodyImpl(x: Expr[Int])(using Quotes) : Expr[String] = { import qctx.reflect._ def definitionString(sym: Symbol): Expr[String] = diff --git a/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala b/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala index 5b712377df1d..34721e9eb32f 100644 --- a/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala +++ b/tests/run-custom-args/Yretain-trees/tasty-load-tree-2/quoted_1.scala @@ -5,7 +5,7 @@ object Foo { inline def inspectBody(inline i: Int): String = ${ inspectBodyImpl('i) } - def inspectBodyImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[String] = { + def inspectBodyImpl(x: Expr[Int])(using Quotes) : Expr[String] = { import qctx.reflect._ def definitionString(sym: Symbol): Expr[String] = diff --git a/tests/run-custom-args/run-macros-erased/macro-erased/1.scala b/tests/run-custom-args/run-macros-erased/macro-erased/1.scala index 7492c9e04ed6..bd3b8222d0bb 100644 --- a/tests/run-custom-args/run-macros-erased/macro-erased/1.scala +++ b/tests/run-custom-args/run-macros-erased/macro-erased/1.scala @@ -10,12 +10,12 @@ object Macro { inline def foo7(i: Int) = $ { case7('{ i })(1)('{ i }) } inline def foo8(i: Int) = $ { case8('{ i })('{ i })(1) } - def case1(erased i: Expr[Int])(using QuoteContext): Expr[Int] = '{ 0 } - def case2 (i: Int)(erased j: Expr[Int])(using QuoteContext): Expr[Int] = '{ 0 } - def case3(erased i: Expr[Int]) (j: Int)(using QuoteContext): Expr[Int] = '{ 0 } - def case4 (h: Int)(erased i: Expr[Int], j: Expr[Int])(using QuoteContext): Expr[Int] = '{ 0 } - def case5(erased i: Expr[Int], j: Expr[Int]) (h: Int)(using QuoteContext): Expr[Int] = '{ 0 } - def case6 (h: Int)(erased i: Expr[Int])(erased j: Expr[Int])(using QuoteContext): Expr[Int] = '{ 0 } - def case7(erased i: Expr[Int]) (h: Int)(erased j: Expr[Int])(using QuoteContext): Expr[Int] = '{ 0 } - def case8(erased i: Expr[Int])(erased j: Expr[Int]) (h: Int)(using QuoteContext): Expr[Int] = '{ 0 } + def case1(erased i: Expr[Int])(using Quotes): Expr[Int] = '{ 0 } + def case2 (i: Int)(erased j: Expr[Int])(using Quotes): Expr[Int] = '{ 0 } + def case3(erased i: Expr[Int]) (j: Int)(using Quotes): Expr[Int] = '{ 0 } + def case4 (h: Int)(erased i: Expr[Int], j: Expr[Int])(using Quotes): Expr[Int] = '{ 0 } + def case5(erased i: Expr[Int], j: Expr[Int]) (h: Int)(using Quotes): Expr[Int] = '{ 0 } + def case6 (h: Int)(erased i: Expr[Int])(erased j: Expr[Int])(using Quotes): Expr[Int] = '{ 0 } + def case7(erased i: Expr[Int]) (h: Int)(erased j: Expr[Int])(using Quotes): Expr[Int] = '{ 0 } + def case8(erased i: Expr[Int])(erased j: Expr[Int]) (h: Int)(using Quotes): Expr[Int] = '{ 0 } } diff --git a/tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala b/tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala index 72114a3c9804..3397f64ba24e 100644 --- a/tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala +++ b/tests/run-custom-args/run-macros-erased/reflect-isFunctionType/macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ inline def isFunctionType[T]: Boolean = ${ isFunctionTypeImpl[T] } -def isFunctionTypeImpl[T: Type](using qctx: QuoteContext) : Expr[Boolean] = { +def isFunctionTypeImpl[T: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ Expr(TypeRepr.of[T].isFunctionType) } @@ -11,7 +11,7 @@ def isFunctionTypeImpl[T: Type](using qctx: QuoteContext) : Expr[Boolean] = { inline def isContextFunctionType[T]: Boolean = ${ isContextFunctionTypeImpl[T] } -def isContextFunctionTypeImpl[T: Type](using qctx: QuoteContext) : Expr[Boolean] = { +def isContextFunctionTypeImpl[T: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ Expr(TypeRepr.of[T].isContextFunctionType) } @@ -19,14 +19,14 @@ def isContextFunctionTypeImpl[T: Type](using qctx: QuoteContext) : Expr[Boolean] inline def isErasedFunctionType[T]: Boolean = ${ isErasedFunctionTypeImpl[T] } -def isErasedFunctionTypeImpl[T: Type](using qctx: QuoteContext) : Expr[Boolean] = { +def isErasedFunctionTypeImpl[T: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ Expr(TypeRepr.of[T].isErasedFunctionType) } inline def isDependentFunctionType[T]: Boolean = ${ isDependentFunctionTypeImpl[T] } -def isDependentFunctionTypeImpl[T: Type](using qctx: QuoteContext) : Expr[Boolean] = { +def isDependentFunctionTypeImpl[T: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ Expr(TypeRepr.of[T].isDependentFunctionType) } diff --git a/tests/run-custom-args/tasty-inspector/i8163.scala b/tests/run-custom-args/tasty-inspector/i8163.scala index 111907cb7895..26db21a80fc6 100644 --- a/tests/run-custom-args/tasty-inspector/i8163.scala +++ b/tests/run-custom-args/tasty-inspector/i8163.scala @@ -22,10 +22,10 @@ object Test { class TestInspector() extends TastyInspector: - protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = + protected def processCompilationUnit(using Quotes)(root: qctx.reflect.Tree): Unit = inspectClass(root) - private def inspectClass(using QuoteContext)(tree: qctx.reflect.Tree): Unit = + private def inspectClass(using Quotes)(tree: qctx.reflect.Tree): Unit = import qctx.reflect._ tree match { case t: PackageClause => diff --git a/tests/run-custom-args/tasty-inspector/i8364.scala b/tests/run-custom-args/tasty-inspector/i8364.scala index 041b7f420c27..c35a3a1b2c9b 100644 --- a/tests/run-custom-args/tasty-inspector/i8364.scala +++ b/tests/run-custom-args/tasty-inspector/i8364.scala @@ -3,7 +3,7 @@ import scala.tasty.inspector._ @main def Test = { val inspector = new TastyInspector { - protected def processCompilationUnit(using QuoteContext)(tree: qctx.reflect.Tree): Unit = { + protected def processCompilationUnit(using Quotes)(tree: qctx.reflect.Tree): Unit = { tree.showExtractors // Make sure that tree is loaded and can be traveresed } } diff --git a/tests/run-custom-args/tasty-inspector/i8389.scala b/tests/run-custom-args/tasty-inspector/i8389.scala index 4fb2df69a1e7..9a128ec2bc4a 100644 --- a/tests/run-custom-args/tasty-inspector/i8389.scala +++ b/tests/run-custom-args/tasty-inspector/i8389.scala @@ -10,7 +10,7 @@ import scala.tasty.inspector._ // in dotty-example-project val inspector = new TastyInspector { - protected def processCompilationUnit(using QuoteContext)(tree: qctx.reflect.Tree): Unit = { + protected def processCompilationUnit(using Quotes)(tree: qctx.reflect.Tree): Unit = { println(tree.show) } } diff --git a/tests/run-custom-args/tasty-inspector/i8460.scala b/tests/run-custom-args/tasty-inspector/i8460.scala index 5324aa9601b0..6efbf313aa14 100644 --- a/tests/run-custom-args/tasty-inspector/i8460.scala +++ b/tests/run-custom-args/tasty-inspector/i8460.scala @@ -37,11 +37,11 @@ class TestInspector_Children() extends TastyInspector: var kids: List[String] = Nil - protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = + protected def processCompilationUnit(using Quotes)(root: qctx.reflect.Tree): Unit = import qctx.reflect._ inspectClass(root) - private def inspectClass(using QuoteContext)(tree: qctx.reflect.Tree): Unit = + private def inspectClass(using Quotes)(tree: qctx.reflect.Tree): Unit = import qctx.reflect._ tree match { case t: PackageClause => diff --git a/tests/run-custom-args/tasty-inspector/tasty-documentation-inspector/Test.scala b/tests/run-custom-args/tasty-inspector/tasty-documentation-inspector/Test.scala index 7d0837dbcf12..7367c314d6b8 100644 --- a/tests/run-custom-args/tasty-inspector/tasty-documentation-inspector/Test.scala +++ b/tests/run-custom-args/tasty-inspector/tasty-documentation-inspector/Test.scala @@ -15,7 +15,7 @@ object Test { class DocumentationInspector extends TastyInspector { - protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = { + protected def processCompilationUnit(using Quotes)(root: qctx.reflect.Tree): Unit = { import qctx.reflect._ object Traverser extends TreeTraverser { diff --git a/tests/run-custom-args/tasty-inspector/tasty-inspector/Test.scala b/tests/run-custom-args/tasty-inspector/tasty-inspector/Test.scala index f92bf4be4c3b..e7c7780926a0 100644 --- a/tests/run-custom-args/tasty-inspector/tasty-inspector/Test.scala +++ b/tests/run-custom-args/tasty-inspector/tasty-inspector/Test.scala @@ -15,7 +15,7 @@ object Test { class DBInspector extends TastyInspector { - protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = { + protected def processCompilationUnit(using Quotes)(root: qctx.reflect.Tree): Unit = { import qctx.reflect._ object Traverser extends TreeTraverser { diff --git a/tests/run-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala b/tests/run-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala index 36a860e71fb2..ff0d5bae911e 100644 --- a/tests/run-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala +++ b/tests/run-custom-args/tasty-interpreter/interpreter/TastyInterpreter.scala @@ -5,7 +5,7 @@ import scala.tasty.inspector.TastyInspector class TastyInterpreter extends TastyInspector { - protected def processCompilationUnit(using QuoteContext)(root: qctx.reflect.Tree): Unit = { + protected def processCompilationUnit(using Quotes)(root: qctx.reflect.Tree): Unit = { import qctx.reflect._ object Traverser extends TreeTraverser { diff --git a/tests/run-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala b/tests/run-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala index 8eb690b35482..924b4f22dc07 100644 --- a/tests/run-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala +++ b/tests/run-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala @@ -3,7 +3,7 @@ package scala.tasty.interpreter import scala.quoted._ import scala.tasty.interpreter.jvm.JVMReflection -abstract class TreeInterpreter[QCtx <: QuoteContext & Singleton](using val qctx: QCtx) { +abstract class TreeInterpreter[QCtx <: Quotes & Singleton](using val qctx: QCtx) { import qctx.reflect._ final val LOG = false diff --git a/tests/run-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala b/tests/run-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala index 532eedcc4dd5..9f34b0baceb9 100644 --- a/tests/run-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala +++ b/tests/run-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala @@ -4,7 +4,7 @@ package jvm import scala.quoted._ import scala.tasty.interpreter.jvm.JVMReflection -class Interpreter[QCtx <: QuoteContext & Singleton](using qctx0: QCtx) extends TreeInterpreter[QCtx] { +class Interpreter[QCtx <: Quotes & Singleton](using qctx0: QCtx) extends TreeInterpreter[QCtx] { import qctx.reflect._ // All references are represented by themselves and values are boxed diff --git a/tests/run-custom-args/tasty-interpreter/interpreter/jvm/JVMReflection.scala b/tests/run-custom-args/tasty-interpreter/interpreter/jvm/JVMReflection.scala index be66762a7756..5a1b2d9d4bb0 100644 --- a/tests/run-custom-args/tasty-interpreter/interpreter/jvm/JVMReflection.scala +++ b/tests/run-custom-args/tasty-interpreter/interpreter/jvm/JVMReflection.scala @@ -2,7 +2,7 @@ package scala.tasty.interpreter.jvm import scala.quoted._ -class JVMReflection[QCtx <: QuoteContext & Singleton](using val tasty: QCtx) { +class JVMReflection[QCtx <: Quotes & Singleton](using val tasty: QCtx) { import qctx.reflect._ import java.lang.reflect.{InvocationTargetException, Method} diff --git a/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala b/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala index 12614de4eac1..5eb0a288e6b3 100644 --- a/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala +++ b/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala @@ -4,7 +4,7 @@ import scala.util.FromDigits import scala.quoted._ object BigFloatFromDigitsImpl: - def apply(digits: Expr[String])(using QuoteContext): Expr[BigFloat] = + def apply(digits: Expr[String])(using Quotes): Expr[BigFloat] = digits match case Const(ds) => try diff --git a/tests/run-macros/beta-reduce-inline-result/Macro_1.scala b/tests/run-macros/beta-reduce-inline-result/Macro_1.scala index dd880b403569..a38340a74595 100644 --- a/tests/run-macros/beta-reduce-inline-result/Macro_1.scala +++ b/tests/run-macros/beta-reduce-inline-result/Macro_1.scala @@ -4,13 +4,13 @@ object Macros { inline def betaReduce[Arg,Result](inline fn : Arg=>Result)(inline arg: Arg): Result = ${ betaReduceImpl('{ fn })('{ arg }) } - def betaReduceImpl[Arg: Type, Result: Type](fn: Expr[Arg=>Result])(arg: Expr[Arg])(using qctx : QuoteContext): Expr[Result] = + def betaReduceImpl[Arg: Type, Result: Type](fn: Expr[Arg=>Result])(arg: Expr[Arg])(using qctx : Quotes): Expr[Result] = Expr.betaReduce('{$fn($arg)}) inline def betaReduceAdd1[Arg](inline fn: Arg=>Int)(inline arg: Arg): Int = ${ betaReduceAdd1Impl('{ fn })('{ arg }) } - def betaReduceAdd1Impl[Arg: Type](fn: Expr[Arg=>Int])(arg: Expr[Arg])(using qctx: QuoteContext): Expr[Int] = + def betaReduceAdd1Impl[Arg: Type](fn: Expr[Arg=>Int])(arg: Expr[Arg])(using Quotes): Expr[Int] = val app = '{$fn.asInstanceOf[Arg=>Int]($arg)} // FIXME: remove asInstanceOf (workaround for #8612) '{ ${ Expr.betaReduce(app) } + 1 } } diff --git a/tests/run-macros/enum-nat-macro/Macros_2.scala b/tests/run-macros/enum-nat-macro/Macros_2.scala index e7a8c13489ef..a5da5dc4fe0f 100644 --- a/tests/run-macros/enum-nat-macro/Macros_2.scala +++ b/tests/run-macros/enum-nat-macro/Macros_2.scala @@ -7,7 +7,7 @@ import Nat._ object Macros: import quoted._ - def toIntImpl(nat: Expr[Nat])(using QuoteContext): Expr[Int] = + def toIntImpl(nat: Expr[Nat])(using Quotes): Expr[Int] = def inner(nat: Expr[Nat], acc: Int): Int = nat match case '{ Succ($nat) } => inner(nat, acc + 1) @@ -15,9 +15,9 @@ import Nat._ Expr(inner(nat, 0)) - def natZero(using QuoteContext): Expr[Nat.Zero.type] = '{Zero} + def natZero(using Quotes): Expr[Nat.Zero.type] = '{Zero} - def toNatImpl(int: Expr[Int])(using QuoteContext): Expr[Nat] = + def toNatImpl(int: Expr[Int])(using Quotes): Expr[Nat] = // it seems even with the bound that the arg will always widen to Expr[Nat] unless explicit diff --git a/tests/run-macros/expr-map-1/Macro_1.scala b/tests/run-macros/expr-map-1/Macro_1.scala index 220f41f70a25..9406881c2f13 100644 --- a/tests/run-macros/expr-map-1/Macro_1.scala +++ b/tests/run-macros/expr-map-1/Macro_1.scala @@ -3,12 +3,12 @@ import scala.quoted._ inline def rewrite[T](inline x: Any): Any = ${ stringRewriter('x) } -private def stringRewriter(e: Expr[Any])(using QuoteContext): Expr[Any] = +private def stringRewriter(e: Expr[Any])(using Quotes): Expr[Any] = StringRewriter.transform(e) private object StringRewriter extends ExprMap { - def transform[T](e: Expr[T])(using QuoteContext, Type[T]): Expr[T] = e match + def transform[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] = e match case Const(s: String) => Expr(s.reverse) match case '{ $x: T } => x diff --git a/tests/run-macros/expr-map-2/Macro_1.scala b/tests/run-macros/expr-map-2/Macro_1.scala index f4cf75810706..2236ff9c3c7f 100644 --- a/tests/run-macros/expr-map-2/Macro_1.scala +++ b/tests/run-macros/expr-map-2/Macro_1.scala @@ -3,12 +3,12 @@ import scala.quoted._ inline def rewrite[T](inline x: Any): Any = ${ stringRewriter('x) } -private def stringRewriter(e: Expr[Any])(using QuoteContext): Expr[Any] = +private def stringRewriter(e: Expr[Any])(using Quotes): Expr[Any] = StringRewriter.transform(e) private object StringRewriter extends ExprMap { - def transform[T](e: Expr[T])(using QuoteContext, Type[T]): Expr[T] = e match + def transform[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] = e match case '{ ($x: Foo).x } => '{ new Foo(4).x } match case '{ $e: T } => e diff --git a/tests/run-macros/f-interpolation-1/FQuote_1.scala b/tests/run-macros/f-interpolation-1/FQuote_1.scala index 5044646b63e1..02357d5472d1 100644 --- a/tests/run-macros/f-interpolation-1/FQuote_1.scala +++ b/tests/run-macros/f-interpolation-1/FQuote_1.scala @@ -8,7 +8,7 @@ object FQuote { inline def ff(args: => Any*): String = ${impl('this, 'args)} } - /*private*/ def impl(receiver: Expr[SCOps], args: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = { + /*private*/ def impl(receiver: Expr[SCOps], args: Expr[Seq[Any]])(using Quotes) : Expr[String] = { import qctx.reflect._ def liftListOfAny(lst: List[Term]): Expr[List[Any]] = lst match { diff --git a/tests/run-macros/flops-rewrite-2/Macro_1.scala b/tests/run-macros/flops-rewrite-2/Macro_1.scala index 0d3884af80b4..c1c0f6f2e77d 100644 --- a/tests/run-macros/flops-rewrite-2/Macro_1.scala +++ b/tests/run-macros/flops-rewrite-2/Macro_1.scala @@ -7,7 +7,7 @@ def plus(x: Int, y: Int): Int = x + y def times(x: Int, y: Int): Int = x * y def power(x: Int, y: Int): Int = if y == 0 then 1 else times(x, power(x, y - 1)) -private def rewriteMacro[T: Type](x: Expr[T])(using QuoteContext): Expr[T] = { +private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { val rewriter = Rewriter( postTransform = List( Transformation[Int] { @@ -50,7 +50,7 @@ object Transformation { new Transformation(transform) } class Transformation[T: Type](transform: PartialFunction[Expr[T], Expr[T]]) { - def apply[U: Type](e: Expr[U])(using QuoteContext): Expr[U] = { + def apply[U: Type](e: Expr[U])(using Quotes): Expr[U] = { e match { case '{ $e: T } => transform.applyOrElse(e, identity) match { case '{ $e2: U } => e2 } case e => e @@ -64,7 +64,7 @@ private object Rewriter { } private class Rewriter(preTransform: List[Transformation[_]] = Nil, postTransform: List[Transformation[_]] = Nil, fixPoint: Boolean) extends ExprMap { - def transform[T](e: Expr[T])(using QuoteContext, Type[T]): Expr[T] = { + def transform[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] = { val e2 = preTransform.foldLeft(e)((ei, transform) => transform(ei)) val e3 = transformChildren(e2) val e4 = postTransform.foldLeft(e3)((ei, transform) => transform(ei)) diff --git a/tests/run-macros/flops-rewrite-3/Macro_1.scala b/tests/run-macros/flops-rewrite-3/Macro_1.scala index 82198863f8f2..a9cd3d66ce9a 100644 --- a/tests/run-macros/flops-rewrite-3/Macro_1.scala +++ b/tests/run-macros/flops-rewrite-3/Macro_1.scala @@ -7,7 +7,7 @@ def plus(x: Int, y: Int): Int = x + y def times(x: Int, y: Int): Int = x * y def power(x: Int, y: Int): Int = if y == 0 then 1 else times(x, power(x, y - 1)) -private def rewriteMacro[T: Type](x: Expr[T])(using QuoteContext): Expr[T] = { +private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { val rewriter = Rewriter().withFixPoint.withPost( Transformation.safe[Int] { case '{ plus($x, $y) } => @@ -56,7 +56,7 @@ object Transformation { } class CheckedTransformation(transform: PartialFunction[Expr[Any], Expr[Any]]) extends Transformation { - def apply[T: Type](e: Expr[T])(using QuoteContext): Expr[T] = { + def apply[T: Type](e: Expr[T])(using Quotes): Expr[T] = { transform.applyOrElse(e, identity) match { case '{ $e2: T } => e2 case '{ $e2: t } => @@ -76,7 +76,7 @@ class CheckedTransformation(transform: PartialFunction[Expr[Any], Expr[Any]]) ex } class SafeTransformation[U: Type](transform: PartialFunction[Expr[U], Expr[U]]) extends Transformation { - def apply[T: Type](e: Expr[T])(using QuoteContext): Expr[T] = { + def apply[T: Type](e: Expr[T])(using Quotes): Expr[T] = { e match { case '{ $e: U } => transform.applyOrElse(e, identity) match { case '{ $e2: T } => e2 } case e => e @@ -85,7 +85,7 @@ class SafeTransformation[U: Type](transform: PartialFunction[Expr[U], Expr[U]]) } abstract class Transformation { - def apply[T: Type](e: Expr[T])(using QuoteContext): Expr[T] + def apply[T: Type](e: Expr[T])(using Quotes): Expr[T] } private object Rewriter { @@ -101,7 +101,7 @@ private class Rewriter private (preTransform: List[Transformation] = Nil, postTr def withPost(transform: Transformation): Rewriter = new Rewriter(preTransform, transform :: postTransform, fixPoint) - def transform[T](e: Expr[T])(using QuoteContext, Type[T]): Expr[T] = { + def transform[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] = { val e2 = preTransform.foldLeft(e)((ei, transform) => transform(ei)) val e3 = transformChildren(e2) val e4 = postTransform.foldLeft(e3)((ei, transform) => transform(ei)) diff --git a/tests/run-macros/flops-rewrite/Macro_1.scala b/tests/run-macros/flops-rewrite/Macro_1.scala index 7c71cf503ab3..5e82ca01c7d1 100644 --- a/tests/run-macros/flops-rewrite/Macro_1.scala +++ b/tests/run-macros/flops-rewrite/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def rewrite[T](inline x: T): T = ${ rewriteMacro('x) } -private def rewriteMacro[T: Type](x: Expr[T])(using QuoteContext): Expr[T] = { +private def rewriteMacro[T: Type](x: Expr[T])(using Quotes): Expr[T] = { val rewriter = Rewriter( postTransform = { case '{ Nil.map[t]($f) } => '{ Nil } @@ -29,7 +29,7 @@ private object Rewriter { } private class Rewriter(preTransform: Expr[Any] => Expr[Any], postTransform: Expr[Any] => Expr[Any], fixPoint: Boolean) extends ExprMap { - def transform[T](e: Expr[T])(using QuoteContext, Type[T]): Expr[T] = { + def transform[T](e: Expr[T])(using Quotes, Type[T]): Expr[T] = { val e2 = checkedTransform(e, preTransform) val e3 = transformChildren(e2) val e4 = checkedTransform(e3, postTransform) @@ -37,7 +37,7 @@ private class Rewriter(preTransform: Expr[Any] => Expr[Any], postTransform: Expr else e4 } - private def checkedTransform[T: Type](e: Expr[T], transform: Expr[T] => Expr[Any])(using QuoteContext): Expr[T] = { + private def checkedTransform[T: Type](e: Expr[T], transform: Expr[T] => Expr[Any])(using Quotes): Expr[T] = { transform(e) match { case '{ $x: T } => x case '{ $x: t } => throw new Exception( diff --git a/tests/run-macros/gestalt-optional-staging/Macro_1.scala b/tests/run-macros/gestalt-optional-staging/Macro_1.scala index 588243a907f2..59da2d765dbf 100644 --- a/tests/run-macros/gestalt-optional-staging/Macro_1.scala +++ b/tests/run-macros/gestalt-optional-staging/Macro_1.scala @@ -17,12 +17,12 @@ final class Optional[+A >: Null](val value: A) extends AnyVal { object Optional { // FIXME fix issue #5097 and enable private - /*private*/ def getOrElseImpl[T >: Null : Type](opt: Expr[Optional[T]], alt: Expr[T])(using QuoteContext): Expr[T] = '{ + /*private*/ def getOrElseImpl[T >: Null : Type](opt: Expr[Optional[T]], alt: Expr[T])(using Quotes): Expr[T] = '{ if ($opt.isEmpty) $alt else $opt.value } // FIXME fix issue #5097 and enable private - /*private*/ def mapImpl[A >: Null : Type, B >: Null : Type](opt: Expr[Optional[A]], f: Expr[A => B])(using QuoteContext): Expr[Optional[B]] = '{ + /*private*/ def mapImpl[A >: Null : Type, B >: Null : Type](opt: Expr[Optional[A]], f: Expr[A => B])(using Quotes): Expr[Optional[B]] = '{ if ($opt.isEmpty) new Optional(null) else new Optional(${Expr.betaReduce('{$f($opt.value)})}) } diff --git a/tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala b/tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala index 51c619da310e..c9d526fa3843 100644 --- a/tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala +++ b/tests/run-macros/gestalt-type-toolbox-reflect/Macro_1.scala @@ -6,28 +6,28 @@ import scala.quoted._ object TypeToolbox { /** are the two types equal? */ inline def =:=[A, B]: Boolean = ${tpEqImpl[A, B]} - private def tpEqImpl[A: Type, B: Type](using qctx: QuoteContext) : Expr[Boolean] = { + private def tpEqImpl[A: Type, B: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ Expr(TypeRepr.of[A] =:= TypeRepr.of[B]) } /** is `tp1` a subtype of `tp2` */ inline def <:<[A, B]: Boolean = ${tpLEqImpl[A, B]} - private def tpLEqImpl[A: Type, B: Type](using qctx: QuoteContext) : Expr[Boolean] = { + private def tpLEqImpl[A: Type, B: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ Expr(TypeRepr.of[A] <:< TypeRepr.of[B]) } /** type associated with the tree */ inline def typeOf[T, Expected](a: T): Boolean = ${typeOfImpl[T, Expected]('a)} - private def typeOfImpl[A: Type, E: Type](a: Expr[A])(using qctx: QuoteContext) : Expr[Boolean] = { + private def typeOfImpl[A: Type, E: Type](a: Expr[A])(using Quotes) : Expr[Boolean] = { import qctx.reflect._ Expr(TypeRepr.of[A] =:= TypeRepr.of[E]) } /** does the type refer to a case class? */ inline def isCaseClass[A]: Boolean = ${isCaseClassImpl[A]} - private def isCaseClassImpl[T: Type](using qctx: QuoteContext) : Expr[Boolean] = { + private def isCaseClassImpl[T: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ val sym = TypeTree.of[T].symbol Expr(sym.isClassDef && sym.flags.is(Flags.Case)) @@ -35,66 +35,66 @@ object TypeToolbox { /** val fields of a case class Type -- only the ones declared in primary constructor */ inline def caseFields[T]: List[String] = ${caseFieldsImpl[T]} - private def caseFieldsImpl[T: Type](using qctx: QuoteContext) : Expr[List[String]] = { + private def caseFieldsImpl[T: Type](using Quotes) : Expr[List[String]] = { import qctx.reflect._ val fields = TypeTree.of[T].symbol.caseFields.map(_.name) Expr(fields) } inline def fieldIn[T](inline mem: String): String = ${fieldInImpl[T]('mem)} - private def fieldInImpl[T: Type](mem: Expr[String])(using qctx: QuoteContext) : Expr[String] = { + private def fieldInImpl[T: Type](mem: Expr[String])(using Quotes) : Expr[String] = { import qctx.reflect._ val field = TypeTree.of[T].symbol.field(mem.unliftOrError) Expr(if field.isNoSymbol then "" else field.name) } inline def fieldsIn[T]: Seq[String] = ${fieldsInImpl[T]} - private def fieldsInImpl[T: Type](using qctx: QuoteContext) : Expr[Seq[String]] = { + private def fieldsInImpl[T: Type](using Quotes) : Expr[Seq[String]] = { import qctx.reflect._ val fields = TypeTree.of[T].symbol.fields Expr(fields.map(_.name).toList) } inline def methodIn[T](inline mem: String): Seq[String] = ${methodInImpl[T]('mem)} - private def methodInImpl[T: Type](mem: Expr[String])(using qctx: QuoteContext) : Expr[Seq[String]] = { + private def methodInImpl[T: Type](mem: Expr[String])(using Quotes) : Expr[Seq[String]] = { import qctx.reflect._ Expr(TypeTree.of[T].symbol.classMethod(mem.unliftOrError).map(_.name)) } inline def methodsIn[T]: Seq[String] = ${methodsInImpl[T]} - private def methodsInImpl[T: Type](using qctx: QuoteContext) : Expr[Seq[String]] = { + private def methodsInImpl[T: Type](using Quotes) : Expr[Seq[String]] = { import qctx.reflect._ Expr(TypeTree.of[T].symbol.classMethods.map(_.name)) } inline def method[T](inline mem: String): Seq[String] = ${methodImpl[T]('mem)} - private def methodImpl[T: Type](mem: Expr[String])(using qctx: QuoteContext) : Expr[Seq[String]] = { + private def methodImpl[T: Type](mem: Expr[String])(using Quotes) : Expr[Seq[String]] = { import qctx.reflect._ Expr(TypeTree.of[T].symbol.method(mem.unliftOrError).map(_.name)) } inline def methods[T]: Seq[String] = ${methodsImpl[T]} - private def methodsImpl[T: Type](using qctx: QuoteContext) : Expr[Seq[String]] = { + private def methodsImpl[T: Type](using Quotes) : Expr[Seq[String]] = { import qctx.reflect._ Expr(TypeTree.of[T].symbol.methods.map(_.name)) } inline def typeTag[T](x: T): String = ${typeTagImpl[T]} - private def typeTagImpl[T: Type](using qctx: QuoteContext) : Expr[String] = { + private def typeTagImpl[T: Type](using Quotes) : Expr[String] = { import qctx.reflect._ val res = TypeRepr.of[T].show Expr(res) } inline def companion[T1, T2]: Boolean = ${companionImpl[T1, T2]} - private def companionImpl[T1: Type, T2: Type](using qctx: QuoteContext) : Expr[Boolean] = { + private def companionImpl[T1: Type, T2: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ val res = TypeTree.of[T1].symbol.companionModule == TypeTree.of[T2].symbol Expr(res) } inline def companionName[T1]: String = ${companionNameImpl[T1]} - private def companionNameImpl[T: Type](using qctx: QuoteContext) : Expr[String] = { + private def companionNameImpl[T: Type](using Quotes) : Expr[String] = { import qctx.reflect._ val sym = TypeTree.of[T].symbol val companionClass = diff --git a/tests/run-macros/i10011/Macro_1.scala b/tests/run-macros/i10011/Macro_1.scala index 50865d8b760b..268d6d122343 100644 --- a/tests/run-macros/i10011/Macro_1.scala +++ b/tests/run-macros/i10011/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ inline def printPos[T](inline expr: T): (Int, Int) = ${ printPos('expr) } -private def printPos[T](expr: Expr[T])(using QuoteContext): Expr[(Int, Int)] = +private def printPos[T](expr: Expr[T])(using Quotes): Expr[(Int, Int)] = import qctx.reflect._ val pos = Term.of(expr).pos Expr((pos.start, pos.end)) diff --git a/tests/run-macros/i4515/Macro_1.scala b/tests/run-macros/i4515/Macro_1.scala index 185e74a2602c..69b5dabec7f0 100644 --- a/tests/run-macros/i4515/Macro_1.scala +++ b/tests/run-macros/i4515/Macro_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macro { inline def foo[X](x: X): Unit = ${fooImpl('x)} - def fooImpl[X: Type](x: Expr[X])(using QuoteContext): Expr[Unit] = '{} + def fooImpl[X: Type](x: Expr[X])(using Quotes): Expr[Unit] = '{} } diff --git a/tests/run-macros/i4515b/Macro_1.scala b/tests/run-macros/i4515b/Macro_1.scala index 920b80040d9e..a1bd34fb77e9 100644 --- a/tests/run-macros/i4515b/Macro_1.scala +++ b/tests/run-macros/i4515b/Macro_1.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Macro { inline def foo: Unit = ${ fooImpl } - def fooImpl(using QuoteContext): Expr[Unit] = '{} + def fooImpl(using Quotes): Expr[Unit] = '{} } diff --git a/tests/run-macros/i4734/Macro_1.scala b/tests/run-macros/i4734/Macro_1.scala index 4e68dea7d653..a938536e7cf5 100644 --- a/tests/run-macros/i4734/Macro_1.scala +++ b/tests/run-macros/i4734/Macro_1.scala @@ -5,10 +5,10 @@ object Macros { inline def unrolledForeach(seq: IndexedSeq[Int], inline f: Int => Unit, inline unrollSize: Int): Unit = // or f: Int => Unit ${ unrolledForeachImpl('seq, 'f, 'unrollSize) } - def unrolledForeachImpl(seq: Expr[IndexedSeq[Int]], f: Expr[Int => Unit], unrollSizeExpr: Expr[Int]) (using QuoteContext): Expr[Unit] = + def unrolledForeachImpl(seq: Expr[IndexedSeq[Int]], f: Expr[Int => Unit], unrollSizeExpr: Expr[Int]) (using Quotes): Expr[Unit] = unrolledForeachImpl(seq, f, unrollSizeExpr.unliftOrError) - def unrolledForeachImpl(seq: Expr[IndexedSeq[Int]], f: Expr[Int => Unit], unrollSize: Int)(using QuoteContext): Expr[Unit] = '{ + def unrolledForeachImpl(seq: Expr[IndexedSeq[Int]], f: Expr[Int => Unit], unrollSize: Int)(using Quotes): Expr[Unit] = '{ val size = ($seq).length assert(size % (${Expr(unrollSize)}) == 0) // for simplicity of the implementation var i = 0 @@ -26,7 +26,7 @@ object Macros { } class UnrolledRange(start: Int, end: Int) { - def foreach(f: Int => Expr[Unit])(using QuoteContext): Expr[Unit] = { + def foreach(f: Int => Expr[Unit])(using Quotes): Expr[Unit] = { @tailrec def loop(i: Int, acc: Expr[Unit]): Expr[Unit] = if (i >= 0) loop(i - 1, '{ ${f(i)}; $acc }) else acc diff --git a/tests/run-macros/i4735/Macro_1.scala b/tests/run-macros/i4735/Macro_1.scala index c2c32907ea1f..5182b9dc41cd 100644 --- a/tests/run-macros/i4735/Macro_1.scala +++ b/tests/run-macros/i4735/Macro_1.scala @@ -7,7 +7,7 @@ object Macro { inline def unrolledForeach(inline unrollSize: Int, seq: Array[Int], inline f: Int => Unit): Unit = // or f: Int => Unit ${ unrolledForeachImpl('unrollSize, 'seq, 'f) } - private def unrolledForeachImpl(unrollSize: Expr[Int], seq: Expr[Array[Int]], f: Expr[Int => Unit]) (using QuoteContext): Expr[Unit] = '{ + private def unrolledForeachImpl(unrollSize: Expr[Int], seq: Expr[Array[Int]], f: Expr[Int => Unit]) (using Quotes): Expr[Unit] = '{ val size = ($seq).length assert(size % (${unrollSize}) == 0) // for simplicity of the implementation var i = 0 @@ -25,7 +25,7 @@ object Macro { } private class UnrolledRange(start: Int, end: Int) { - def foreach(f: Int => Expr[Unit]) (using QuoteContext): Expr[Unit] = { + def foreach(f: Int => Expr[Unit]) (using Quotes): Expr[Unit] = { @tailrec def loop(i: Int, acc: Expr[Unit]): Expr[Unit] = if (i >= 0) loop(i - 1, '{ ${f(i)}; $acc }) else acc diff --git a/tests/run-macros/i4803/Macro_1.scala b/tests/run-macros/i4803/Macro_1.scala index 1ee76ac16d33..f0c7ed23b235 100644 --- a/tests/run-macros/i4803/Macro_1.scala +++ b/tests/run-macros/i4803/Macro_1.scala @@ -1,10 +1,10 @@ import scala.quoted._ object PowerMacro { - def powerCode(x: Expr[Double], n: Expr[Long]) (using QuoteContext): Expr[Double] = + def powerCode(x: Expr[Double], n: Expr[Long]) (using Quotes): Expr[Double] = powerCode(x, n.unliftOrError) - def powerCode(x: Expr[Double], n: Long) (using QuoteContext): Expr[Double] = + def powerCode(x: Expr[Double], n: Long) (using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n % 2 == 0) '{ val y = $x * $x; ${ powerCode('y, n / 2) } } else '{ $x * ${ powerCode(x, n - 1) } } diff --git a/tests/run-macros/i4803b/Macro_1.scala b/tests/run-macros/i4803b/Macro_1.scala index d070877db085..58c9d90ef338 100644 --- a/tests/run-macros/i4803b/Macro_1.scala +++ b/tests/run-macros/i4803b/Macro_1.scala @@ -1,10 +1,10 @@ import scala.quoted._ object PowerMacro { - def powerCode(x: Expr[Double], n: Expr[Long]) (using QuoteContext): Expr[Double] = + def powerCode(x: Expr[Double], n: Expr[Long]) (using Quotes): Expr[Double] = powerCode(x, n.unliftOrError) - def powerCode(x: Expr[Double], n: Long) (using QuoteContext): Expr[Double] = + def powerCode(x: Expr[Double], n: Long) (using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n % 2 == 0) '{ val y = $x * $x; ${ powerCode('y, n / 2) } } else '{ $x * ${ powerCode(x, n - 1) } } diff --git a/tests/run-macros/i4803c/Macro_1.scala b/tests/run-macros/i4803c/Macro_1.scala index 64a6cb7951cc..a583db7a52ba 100644 --- a/tests/run-macros/i4803c/Macro_1.scala +++ b/tests/run-macros/i4803c/Macro_1.scala @@ -1,10 +1,10 @@ import scala.quoted._ object PowerMacro { - def powerCode(x: Expr[Double], n: Expr[Long]) (using QuoteContext): Expr[Double] = + def powerCode(x: Expr[Double], n: Expr[Long]) (using Quotes): Expr[Double] = powerCode(x, n.unliftOrError) - def powerCode(x: Expr[Double], n: Long) (using QuoteContext): Expr[Double] = + def powerCode(x: Expr[Double], n: Long) (using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n % 2 == 0) '{ val y = $x * $x; ${powerCode('y, n / 2)} } else '{ $x * ${powerCode(x, n - 1)} } diff --git a/tests/run-macros/i4803e/Macro_1.scala b/tests/run-macros/i4803e/Macro_1.scala index 1050ecdf9d3a..dc601de9bd08 100644 --- a/tests/run-macros/i4803e/Macro_1.scala +++ b/tests/run-macros/i4803e/Macro_1.scala @@ -1,7 +1,7 @@ import scala.quoted._ object PowerMacro { - def power2(x: Expr[Double])(using QuoteContext) = '{ + def power2(x: Expr[Double])(using Quotes) = '{ inline def power(x: Double, n: Long): Double = if (n == 0) 1.0 else if (n % 2 == 0) { val y = x * x; power(y, n / 2) } diff --git a/tests/run-macros/i4803f/Macro_1.scala b/tests/run-macros/i4803f/Macro_1.scala index 941b07451384..635cc3e6f936 100644 --- a/tests/run-macros/i4803f/Macro_1.scala +++ b/tests/run-macros/i4803f/Macro_1.scala @@ -1,12 +1,12 @@ import scala.quoted._ object PowerMacro { - def powerCode(x: Expr[Double], n: Long)(using QuoteContext): Expr[Double] = + def powerCode(x: Expr[Double], n: Long)(using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n % 2 == 0) '{ val y = $x * $x; ${powerCode('y, n / 2)} } else '{ $x * ${powerCode(x, n - 1)} } - def power2(x: Expr[Double])(using QuoteContext) = '{ + def power2(x: Expr[Double])(using Quotes) = '{ inline def power(x: Double): Double = ${powerCode('x, 2)} power($x) } diff --git a/tests/run-macros/i4947e/Macro_1.scala b/tests/run-macros/i4947e/Macro_1.scala index 4ab4f3fc076a..13aab8abeab6 100644 --- a/tests/run-macros/i4947e/Macro_1.scala +++ b/tests/run-macros/i4947e/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { def printStack(tag: String): Unit = { println(tag + ": "+ new Exception().getStackTrace().apply(1)) } - def assertImpl(expr: Expr[Boolean])(using QuoteContext) = '{ + def assertImpl(expr: Expr[Boolean])(using Quotes) = '{ printStack("assertImpl") println($expr) } diff --git a/tests/run-macros/i4947f/Macro_1.scala b/tests/run-macros/i4947f/Macro_1.scala index 400e6701cd7f..ea760e2fa67f 100644 --- a/tests/run-macros/i4947f/Macro_1.scala +++ b/tests/run-macros/i4947f/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { def printStack(tag: String): Unit = { println(tag + ": "+ new Exception().getStackTrace().apply(1)) } - def assertImpl(expr: Expr[Boolean])(using QuoteContext) = '{ + def assertImpl(expr: Expr[Boolean])(using Quotes) = '{ printStack("assertImpl") println($expr) } diff --git a/tests/run-macros/i5119/Macro_1.scala b/tests/run-macros/i5119/Macro_1.scala index 10e66109a2e7..3d731d4c4219 100644 --- a/tests/run-macros/i5119/Macro_1.scala +++ b/tests/run-macros/i5119/Macro_1.scala @@ -5,7 +5,7 @@ object Macro { inline def ff(args: => Any*): String = ${ Macro.impl('sc, 'args) } } implicit inline def XmlQuote(inline sc: StringContext): StringContextOps = new StringContextOps(sc) - def impl(sc: Expr[StringContext], args: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = { + def impl(sc: Expr[StringContext], args: Expr[Seq[Any]])(using Quotes) : Expr[String] = { import qctx.reflect._ Expr(Term.of(sc).underlyingArgument.showExtractors + "\n" + Term.of(args).underlyingArgument.showExtractors) } diff --git a/tests/run-macros/i5119b/Macro_1.scala b/tests/run-macros/i5119b/Macro_1.scala index 6345e27150f2..159b7792363e 100644 --- a/tests/run-macros/i5119b/Macro_1.scala +++ b/tests/run-macros/i5119b/Macro_1.scala @@ -5,7 +5,7 @@ object Macro { inline def ff(arg1: Any, arg2: Any): String = ${ Macro.impl('{arg1}, '{arg2}) } - def impl(arg1: Expr[Any], arg2: Expr[Any])(using qctx: QuoteContext) : Expr[String] = + def impl(arg1: Expr[Any], arg2: Expr[Any])(using Quotes) : Expr[String] = import qctx.reflect._ Expr(Term.of(arg1).underlyingArgument.showExtractors + "\n" + Term.of(arg2).underlyingArgument.showExtractors) diff --git a/tests/run-macros/i5188a/Macro_1.scala b/tests/run-macros/i5188a/Macro_1.scala index 173c11a628a5..b44b7c3d919e 100644 --- a/tests/run-macros/i5188a/Macro_1.scala +++ b/tests/run-macros/i5188a/Macro_1.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Lib { inline def sum(inline args: Int*): Int = ${ impl('args) } - def impl(args: Expr[Seq[Int]]) (using QuoteContext): Expr[Int] = Expr(args.unliftOrError.sum) + def impl(args: Expr[Seq[Int]]) (using Quotes): Expr[Int] = Expr(args.unliftOrError.sum) } diff --git a/tests/run-macros/i5533/Macro_1.scala b/tests/run-macros/i5533/Macro_1.scala index b12a0af99c33..1b7cd4403f27 100644 --- a/tests/run-macros/i5533/Macro_1.scala +++ b/tests/run-macros/i5533/Macro_1.scala @@ -7,7 +7,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${assertImpl('condition)} - def assertImpl(condition: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(condition: Expr[Boolean])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(condition) diff --git a/tests/run-macros/i5533b/Macro_1.scala b/tests/run-macros/i5533b/Macro_1.scala index 1dbc0d303c84..7ac800f07f28 100644 --- a/tests/run-macros/i5533b/Macro_1.scala +++ b/tests/run-macros/i5533b/Macro_1.scala @@ -6,7 +6,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${assertImpl('condition)} - def assertImpl(condition: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(condition: Expr[Boolean])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(condition) def exprStr: String = condition.show diff --git a/tests/run-macros/i5536/Macro_1.scala b/tests/run-macros/i5536/Macro_1.scala index d09e9faa5231..de7268f83d83 100644 --- a/tests/run-macros/i5536/Macro_1.scala +++ b/tests/run-macros/i5536/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ object scalatest { inline def assert(condition: => Boolean): Unit = ${assertImpl('condition)} - def assertImpl(condition: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(condition: Expr[Boolean])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(condition) def exprStr: String = condition.show diff --git a/tests/run-macros/i5629/Macro_1.scala b/tests/run-macros/i5629/Macro_1.scala index 1bc340db8719..dea3e14c57d6 100644 --- a/tests/run-macros/i5629/Macro_1.scala +++ b/tests/run-macros/i5629/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def assert(condition: => Boolean): Unit = ${ assertImpl('{condition}, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val b = Term.of(cond).underlyingArgument.asExprOf[Boolean] '{ scala.Predef.assert($b) } @@ -12,7 +12,7 @@ object Macros { inline def thisLineNumber = ${ thisLineNumberImpl } - def thisLineNumberImpl(using qctx: QuoteContext) : Expr[Int] = { + def thisLineNumberImpl(using Quotes) : Expr[Int] = { import qctx.reflect._ Expr(Position.ofMacroExpansion.startLine) } diff --git a/tests/run-macros/i5715/Macro_1.scala b/tests/run-macros/i5715/Macro_1.scala index 77cb8bc1457b..03d82e8e690f 100644 --- a/tests/run-macros/i5715/Macro_1.scala +++ b/tests/run-macros/i5715/Macro_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ Term.of(cond).underlyingArgument match { diff --git a/tests/run-macros/i5941/macro_1.scala b/tests/run-macros/i5941/macro_1.scala index 7ebacbe25b89..9640cdb874dc 100644 --- a/tests/run-macros/i5941/macro_1.scala +++ b/tests/run-macros/i5941/macro_1.scala @@ -11,7 +11,7 @@ object Lens { def set(t: T, s: S): S = _set(t)(s) } - def impl[S: Type, T: Type](getter: Expr[S => T])(using qctx: QuoteContext) : Expr[Lens[S, T]] = { + def impl[S: Type, T: Type](getter: Expr[S => T])(using Quotes) : Expr[Lens[S, T]] = { import qctx.reflect._ import util._ @@ -84,7 +84,7 @@ object Iso { def to(s: S): A = _to(s) } - def impl[S: Type, A: Type](using qctx: QuoteContext) : Expr[Iso[S, A]] = { + def impl[S: Type, A: Type](using Quotes) : Expr[Iso[S, A]] = { import qctx.reflect._ import util._ @@ -123,7 +123,7 @@ object Iso { } } - def implUnit[S: Type](using qctx: QuoteContext) : Expr[Iso[S, 1]] = { + def implUnit[S: Type](using Quotes) : Expr[Iso[S, 1]] = { import qctx.reflect._ import util._ @@ -160,7 +160,7 @@ object Iso { } // TODO: require whitebox macro - def implFields[S: Type](using qctx: QuoteContext) : Expr[Iso[S, Any]] = ??? + def implFields[S: Type](using Quotes) : Expr[Iso[S, Any]] = ??? } object GenIso { @@ -195,7 +195,7 @@ object Prism { def apply(a: A): S = app(a) } - def impl[S: Type, A <: S : Type](using qctx: QuoteContext) : Expr[Prism[S, A]] = { + def impl[S: Type, A <: S : Type](using Quotes) : Expr[Prism[S, A]] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/i6171/Macro_1.scala b/tests/run-macros/i6171/Macro_1.scala index 9a18094e9562..db7ec7a4ed48 100644 --- a/tests/run-macros/i6171/Macro_1.scala +++ b/tests/run-macros/i6171/Macro_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/i6201/macro_1.scala b/tests/run-macros/i6201/macro_1.scala index 0fe7b233e51f..ff68c1eb9fc1 100644 --- a/tests/run-macros/i6201/macro_1.scala +++ b/tests/run-macros/i6201/macro_1.scala @@ -3,11 +3,11 @@ import scala.quoted._ extension (inline x: String) inline def strip: String = ${ stripImpl('x) } -def stripImpl(x: Expr[String])(using qctx: QuoteContext) : Expr[String] = +def stripImpl(x: Expr[String])(using Quotes) : Expr[String] = Expr(x.unliftOrError.stripMargin) inline def isHello(inline x: String): Boolean = ${ isHelloImpl('x) } -def isHelloImpl(x: Expr[String])(using qctx: QuoteContext) : Expr[Boolean] = +def isHelloImpl(x: Expr[String])(using Quotes) : Expr[Boolean] = if (x.unliftOrError == "hello") Expr(true) else Expr(false) diff --git a/tests/run-macros/i6253-b/quoted_1.scala b/tests/run-macros/i6253-b/quoted_1.scala index c6c4155f9516..039e798155cb 100644 --- a/tests/run-macros/i6253-b/quoted_1.scala +++ b/tests/run-macros/i6253-b/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { extension (inline self: StringContext) inline def xyz(args: => String*): String = ${impl('self, 'args)} - private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using QuoteContext): Expr[String] = { + private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using Quotes): Expr[String] = { self match { case '{ StringContext($parts: _*) } => '{ diff --git a/tests/run-macros/i6253-c/quoted_1.scala b/tests/run-macros/i6253-c/quoted_1.scala index a801b6b97ee2..49525f6c3069 100644 --- a/tests/run-macros/i6253-c/quoted_1.scala +++ b/tests/run-macros/i6253-c/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { // Should be: extension (inline self: StringContext) inline def ... extension (self: => StringContext) inline def xyz(args: => String*): String = ${impl('self, 'args)} - private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using QuoteContext): Expr[String] = { + private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using Quotes): Expr[String] = { self match { case '{ StringContext($parts: _*) } => // Should not match as the parameter is not marked as inlined '{ ??? } diff --git a/tests/run-macros/i6253/quoted_1.scala b/tests/run-macros/i6253/quoted_1.scala index 3f36d0f69ab1..5956386e1d17 100644 --- a/tests/run-macros/i6253/quoted_1.scala +++ b/tests/run-macros/i6253/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { extension (inline self: StringContext) inline def xyz(args: => String*): String = ${impl('self, 'args)} - private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using QuoteContext): Expr[String] = { + private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using Quotes): Expr[String] = { self match { case '{ StringContext($parts: _*) } => '{ StringContext($parts: _*).s($args: _*) } diff --git a/tests/run-macros/i6270/Macro_1.scala b/tests/run-macros/i6270/Macro_1.scala index 779c763a25fc..f112f8812dc8 100644 --- a/tests/run-macros/i6270/Macro_1.scala +++ b/tests/run-macros/i6270/Macro_1.scala @@ -4,7 +4,7 @@ object api { extension (inline x: String) inline def reflect : String = ${ reflImpl('x) } - private def reflImpl(x: Expr[String])(using qctx: QuoteContext) : Expr[String] = { + private def reflImpl(x: Expr[String])(using Quotes) : Expr[String] = { import qctx.reflect._ Expr(x.show) } @@ -12,7 +12,7 @@ object api { extension (x: => String) inline def reflectColor : String = ${ reflImplColor('x) } - private def reflImplColor(x: Expr[String])(using qctx: QuoteContext) : Expr[String] = { + private def reflImplColor(x: Expr[String])(using Quotes) : Expr[String] = { import qctx.reflect._ Expr(x.showAnsiColored) } diff --git a/tests/run-macros/i6518/Macro_1.scala b/tests/run-macros/i6518/Macro_1.scala index 99f65738c744..8fde399e489e 100644 --- a/tests/run-macros/i6518/Macro_1.scala +++ b/tests/run-macros/i6518/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def test(): String = ${ testImpl } - private def testImpl(using qctx: QuoteContext) : Expr[String] = { + private def testImpl(using Quotes) : Expr[String] = { import qctx.reflect._ val classSym = TypeRepr.of[Function1].classSymbol.get classSym.classMethod("apply") diff --git a/tests/run-macros/i6679/Macro_1.scala b/tests/run-macros/i6679/Macro_1.scala index 0130c9ebbb90..0a02e7e0856b 100644 --- a/tests/run-macros/i6679/Macro_1.scala +++ b/tests/run-macros/i6679/Macro_1.scala @@ -1,6 +1,6 @@ import scala.quoted._ -def makeMatch[A: Type](head : Expr[A])(using qctx : QuoteContext) : Expr[Unit] = { +def makeMatch[A: Type](head : Expr[A])(using qctx : Quotes) : Expr[Unit] = { import qctx.reflect._ val sacrifice = '{ $head match { case _ => ??? } } @@ -9,6 +9,6 @@ def makeMatch[A: Type](head : Expr[A])(using qctx : QuoteContext) : Expr[Unit] = '{ println("Ok") } } -def mm(implicit qctx : QuoteContext) = makeMatch('{42}) +def mm(implicit qctx : Quotes) = makeMatch('{42}) inline def f = ${ mm } diff --git a/tests/run-macros/i6765-b/Macro_1.scala b/tests/run-macros/i6765-b/Macro_1.scala index 691971dc5bc4..1beb85e13495 100644 --- a/tests/run-macros/i6765-b/Macro_1.scala +++ b/tests/run-macros/i6765-b/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def foo = ${fooImpl} -def fooImpl(using qctx: QuoteContext) = { +def fooImpl(using Quotes) = { val res = Expr.ofList(List('{"One"})) Expr(res.show) } diff --git a/tests/run-macros/i6765-c/Macro_1.scala b/tests/run-macros/i6765-c/Macro_1.scala index 3a1858cc56ca..87c26e55b7d7 100644 --- a/tests/run-macros/i6765-c/Macro_1.scala +++ b/tests/run-macros/i6765-c/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def foo(inline n: Int) = ${fooImpl('n)} -def fooImpl(n: Expr[Int])(using qctx: QuoteContext) = { +def fooImpl(n: Expr[Int])(using Quotes) = { val res = Expr.ofList(List.tabulate(n.unliftOrError)(i => Expr("#" + i))) '{ ${Expr(res.show)} + "\n" + $res.toString + "\n" } } diff --git a/tests/run-macros/i6765/Macro_1.scala b/tests/run-macros/i6765/Macro_1.scala index 42fc5ef368f9..1cf4bccc83fe 100644 --- a/tests/run-macros/i6765/Macro_1.scala +++ b/tests/run-macros/i6765/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def foo = ${fooImpl} -def fooImpl(using qctx: QuoteContext) = { +def fooImpl(using Quotes) = { import qctx.reflect._ val res = Expr.ofList(List('{"One"})) Expr(res.show) diff --git a/tests/run-macros/i6772/Macro_1.scala b/tests/run-macros/i6772/Macro_1.scala index cb8952618d43..e1bb395dbd77 100644 --- a/tests/run-macros/i6772/Macro_1.scala +++ b/tests/run-macros/i6772/Macro_1.scala @@ -4,10 +4,10 @@ object Macros { inline def m() : Any = ${ mImpl() } - def mImpl()(using QuoteContext): Expr[Any] = + def mImpl()(using Quotes): Expr[Any] = List(Expr(1), Expr(2), Expr(3)).toExprOfList - extension [T](list: List[Expr[T]]) def toExprOfList(using Type[T], QuoteContext): Expr[List[T]] = '{ + extension [T](list: List[Expr[T]]) def toExprOfList(using Type[T], Quotes): Expr[List[T]] = '{ val buff = List.newBuilder[T] ${ Expr.block(list.map(v => '{ buff += $v }), '{ buff.result() }) } } diff --git a/tests/run-macros/i6803/Macro_1.scala b/tests/run-macros/i6803/Macro_1.scala index e6164054d348..7ff3b633a676 100644 --- a/tests/run-macros/i6803/Macro_1.scala +++ b/tests/run-macros/i6803/Macro_1.scala @@ -8,7 +8,7 @@ object AsObject { object LineNo { def unsafe(i: Int): LineNo = new LineNo(i) inline given LineNo = ${impl} - private def impl(using qctx: QuoteContext): Expr[LineNo] = { + private def impl(using Quotes): Expr[LineNo] = { import qctx.reflect._ '{unsafe(${Expr(Position.ofMacroExpansion.startLine)})} } @@ -20,7 +20,7 @@ package AsPackage { object LineNo { def unsafe(i: Int): LineNo = new LineNo(i) inline given LineNo = ${impl} - private def impl(using qctx: QuoteContext): Expr[LineNo] = { + private def impl(using Quotes): Expr[LineNo] = { import qctx.reflect._ '{unsafe(${Expr(Position.ofMacroExpansion.startLine)})} } diff --git a/tests/run-macros/i6988/FirstArg_1.scala b/tests/run-macros/i6988/FirstArg_1.scala index da4186a93785..00b03d7f0e17 100644 --- a/tests/run-macros/i6988/FirstArg_1.scala +++ b/tests/run-macros/i6988/FirstArg_1.scala @@ -8,7 +8,7 @@ object FirstArg { object Macros { import scala.quoted._ - def argsImpl(using qctx: QuoteContext) : Expr[FirstArg] = { + def argsImpl(using Quotes) : Expr[FirstArg] = { import qctx.reflect._ def enclosingClass(cur: Symbol = Symbol.spliceOwner): Symbol = diff --git a/tests/run-macros/i7008/macro_1.scala b/tests/run-macros/i7008/macro_1.scala index a371f66fb25e..6f895ea5c781 100644 --- a/tests/run-macros/i7008/macro_1.scala +++ b/tests/run-macros/i7008/macro_1.scala @@ -4,13 +4,13 @@ case class Box[T](v: T) inline def mcr(expr: => Boolean): Unit = ${mcrProxy('expr)} -def mcrProxy(expr: Expr[Boolean])(using QuoteContext): Expr[Unit] = { +def mcrProxy(expr: Expr[Boolean])(using Quotes): Expr[Unit] = { val res = mcrImpl[Boolean]('{ (esx: Seq[Box[Boolean]]) => () }, expr) // println(s"Out: ${res.show}") res } -def mcrImpl[T](func: Expr[Seq[Box[T]] => Unit], expr: Expr[T])(using QuoteContext, Type[T]): Expr[Unit] = { +def mcrImpl[T](func: Expr[Seq[Box[T]] => Unit], expr: Expr[T])(using Quotes, Type[T]): Expr[Unit] = { import qctx.reflect._ val arg = Varargs(Seq('{(Box($expr))})) Expr.betaReduce('{$func($arg)}) diff --git a/tests/run-macros/i7025/Macros_1.scala b/tests/run-macros/i7025/Macros_1.scala index 8092128f0e9b..1602986f0472 100644 --- a/tests/run-macros/i7025/Macros_1.scala +++ b/tests/run-macros/i7025/Macros_1.scala @@ -3,7 +3,7 @@ object Macros { inline def debug: Unit = ${Macros.debugImpl} - def debugImpl(using qctx: QuoteContext): Expr[Unit] = { + def debugImpl(using Quotes): Expr[Unit] = { import qctx.reflect._ def nearestEnclosingDef(owner: Symbol): Symbol = diff --git a/tests/run-macros/i7048/Lib_1.scala b/tests/run-macros/i7048/Lib_1.scala index b2b0fc70f6c8..1cb1c0465342 100644 --- a/tests/run-macros/i7048/Lib_1.scala +++ b/tests/run-macros/i7048/Lib_1.scala @@ -12,13 +12,13 @@ given [U] as IsExpr[Expr[U]] = new IsExpr[Expr[U]] { def f(x: Any): String = x.toString -def g[T](x: T)(using e: IsExpr[T])(using tu: Type[e.Underlying]): QuoteContext ?=> Expr[String] = { +def g[T](x: T)(using e: IsExpr[T])(using tu: Type[e.Underlying]): Quotes ?=> Expr[String] = { val underlying: Expr[e.Underlying] = e.toExpr(x) '{f($underlying)} } inline def mcr(): Any = ${mcrImpl} -def mcrImpl(using QuoteContext): Expr[Any] = { +def mcrImpl(using Quotes): Expr[Any] = { val x = '{1} g(x) } diff --git a/tests/run-macros/i7519c/Macro_1.scala b/tests/run-macros/i7519c/Macro_1.scala index 415500ef17c3..da7f7a2288f6 100644 --- a/tests/run-macros/i7519c/Macro_1.scala +++ b/tests/run-macros/i7519c/Macro_1.scala @@ -7,7 +7,7 @@ class Quoted[T] inline def quote[T]: String = ${ quoteImpl[T] } -def quoteImpl[T: Type](using qctx: QuoteContext): Expr[String] = { +def quoteImpl[T: Type](using Quotes): Expr[String] = { val value: Expr[Int] = '{ 42 } Expr(('{ new Quoted[T @Annot($value)] }).show) } diff --git a/tests/run-macros/i7715/Macros_1.scala b/tests/run-macros/i7715/Macros_1.scala index 81f733f924e4..b44c6487687a 100644 --- a/tests/run-macros/i7715/Macros_1.scala +++ b/tests/run-macros/i7715/Macros_1.scala @@ -1,6 +1,6 @@ import scala.quoted._ inline def mcr(e: => Any): Any = ${mcrImpl('e)} -def mcrImpl(e: Expr[Any])(using ctx: QuoteContext): Expr[Any] = +def mcrImpl(e: Expr[Any])(using ctx: Quotes): Expr[Any] = e match case '{ $body } => body diff --git a/tests/run-macros/i7716/Macro_1.scala b/tests/run-macros/i7716/Macro_1.scala index 10f8436c8171..01f4e5184a12 100644 --- a/tests/run-macros/i7716/Macro_1.scala +++ b/tests/run-macros/i7716/Macro_1.scala @@ -1,11 +1,11 @@ import scala.quoted._ trait Foo: - def mcrImpl1(e: Expr[Any])(using ctx: QuoteContext): Expr[Any] = + def mcrImpl1(e: Expr[Any])(using ctx: Quotes): Expr[Any] = '{println(s"Hello ${$e}")} object Foo extends Foo: - def mcrImpl2(e: Expr[Any])(using ctx: QuoteContext): Expr[Any] = + def mcrImpl2(e: Expr[Any])(using ctx: Quotes): Expr[Any] = '{println(s"Hello ${$e}")} object Bar: diff --git a/tests/run-macros/i7887/Macro_1.scala b/tests/run-macros/i7887/Macro_1.scala index f60309685b60..24ac8dec39a0 100644 --- a/tests/run-macros/i7887/Macro_1.scala +++ b/tests/run-macros/i7887/Macro_1.scala @@ -1,4 +1,4 @@ -def myMacroImpl(a: quoted.Expr[_])(using qctx: quoted.QuoteContext) = { +def myMacroImpl(a: quoted.Expr[_])(using qctx: quoted.Quotes) = { import qctx.reflect._ def typed[A] = { implicit val t: quoted.Type[A] = Term.of(a).tpe.widen.asType.asInstanceOf[quoted.Type[A]] diff --git a/tests/run-macros/i7898/Macro_1.scala b/tests/run-macros/i7898/Macro_1.scala index 8adfca1bf010..48271a4cc725 100644 --- a/tests/run-macros/i7898/Macro_1.scala +++ b/tests/run-macros/i7898/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Main { - def myMacroImpl(body: Expr[_])(using qctx: QuoteContext) : Expr[_] = { + def myMacroImpl(body: Expr[_])(using Quotes) : Expr[_] = { import qctx.reflect._ val bodyTerm = Term.of(underlyingArgument(body)) val showed = bodyTerm.show @@ -16,7 +16,7 @@ object Main { myMacroImpl('body) } - def underlyingArgument[T](expr: Expr[T])(using qctx: QuoteContext): Expr[T] = + def underlyingArgument[T](expr: Expr[T])(using Quotes): Expr[T] = import qctx.reflect._ Term.of(expr).underlyingArgument.asExpr.asInstanceOf[Expr[T]] } diff --git a/tests/run-macros/i7964/Macro_1.scala b/tests/run-macros/i7964/Macro_1.scala index b09eb08e28a2..a630efca35b3 100644 --- a/tests/run-macros/i7964/Macro_1.scala +++ b/tests/run-macros/i7964/Macro_1.scala @@ -7,7 +7,7 @@ enum Num { // TODO derive a quoted.Unliftable inline def foo(inline num: Num): Int = ${ fooExpr('num) } -private def fooExpr(numExpr: Expr[Num]) (using QuoteContext): Expr[Int] = +private def fooExpr(numExpr: Expr[Num]) (using Quotes): Expr[Int] = val num = numExpr match { case '{ Num.One } => Num.One case '{ Num.Two } => Num.Two diff --git a/tests/run-macros/i7987/Macros_1.scala b/tests/run-macros/i7987/Macros_1.scala index f6017ee597f9..ecb136b23d49 100644 --- a/tests/run-macros/i7987/Macros_1.scala +++ b/tests/run-macros/i7987/Macros_1.scala @@ -5,7 +5,7 @@ import scala.deriving._ object Macros { inline def m(): String = ${ macroImpl() } - def macroImpl[T]()(using qctx: QuoteContext): Expr[String] = { + def macroImpl[T]()(using Quotes): Expr[String] = { Expr.summon[Mirror.Of[Some[Int]]] match case Some('{ $_ : t }) => Expr(Type.show[t]) } diff --git a/tests/run-macros/i8007/Macro_1.scala b/tests/run-macros/i8007/Macro_1.scala index 24a829c3cedc..a3644da43b9c 100644 --- a/tests/run-macros/i8007/Macro_1.scala +++ b/tests/run-macros/i8007/Macro_1.scala @@ -4,7 +4,7 @@ import scala.quoted._ object Macro1 { - def mirrorFields[T: Type](using qctx: QuoteContext): List[String] = + def mirrorFields[T: Type](using Quotes): List[String] = Type.of[T] match { case '[field *: fields] => Type.show[field] :: mirrorFields[fields] case '[EmptyTuple] => Nil @@ -16,7 +16,7 @@ object Macro1 { inline def test1[T](value: =>T): List[String] = ${ test1Impl('value) } - def test1Impl[T: Type](value: Expr[T])(using qctx: QuoteContext): Expr[List[String]] = { + def test1Impl[T: Type](value: Expr[T])(using Quotes): Expr[List[String]] = { import qctx.reflect._ val mirrorTpe = Type.of[Mirror.Of[T]] diff --git a/tests/run-macros/i8007/Macro_2.scala b/tests/run-macros/i8007/Macro_2.scala index 06576f8953fe..61ebfb46f785 100644 --- a/tests/run-macros/i8007/Macro_2.scala +++ b/tests/run-macros/i8007/Macro_2.scala @@ -4,7 +4,7 @@ import scala.quoted._ object Macro2 { - def mirrorFields[T](using t: Type[T])(using qctx: QuoteContext): List[String] = + def mirrorFields[T](using t: Type[T])(using Quotes): List[String] = t match { case '[field *: fields] => Type.show[field].substring(1, Type.show[field].length-1) :: mirrorFields[fields] case '[EmptyTuple] => Nil @@ -20,7 +20,7 @@ object Macro2 { def encode(elem: T): String = body(elem) } - def derived[T: Type](ev: Expr[Mirror.Of[T]])(using qctx: QuoteContext): Expr[JsonEncoder[T]] = { + def derived[T: Type](ev: Expr[Mirror.Of[T]])(using Quotes): Expr[JsonEncoder[T]] = { import qctx.reflect._ val fields = ev match { @@ -42,7 +42,7 @@ object Macro2 { inline def test2[T](value: =>T): Unit = ${ test2Impl('value) } - def test2Impl[T: Type](value: Expr[T])(using qctx: QuoteContext): Expr[Unit] = { + def test2Impl[T: Type](value: Expr[T])(using Quotes): Expr[Unit] = { import qctx.reflect._ val mirrorTpe = Type.of[Mirror.Of[T]] diff --git a/tests/run-macros/i8007/Macro_3.scala b/tests/run-macros/i8007/Macro_3.scala index 2cfde64538ec..b9117123ea35 100644 --- a/tests/run-macros/i8007/Macro_3.scala +++ b/tests/run-macros/i8007/Macro_3.scala @@ -25,14 +25,14 @@ object Eq { def eqv(x: T, y: T): Boolean = body(x, y) } - def summonAll[T: Type](using qctx: QuoteContext): List[Expr[Eq[_]]] = Type.of[T] match { + def summonAll[T: Type](using Quotes): List[Expr[Eq[_]]] = Type.of[T] match { case '[String *: tpes] => '{ summon[Eq[String]] } :: summonAll[tpes] case '[Int *: tpes] => '{ summon[Eq[Int]] } :: summonAll[tpes] case '[tpe *: tpes] => derived[tpe] :: summonAll[tpes] case '[EmptyTuple] => Nil } - given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = { + given derived[T: Type](using q: Quotes) as Expr[Eq[T]] = { import qctx.reflect._ val ev: Expr[Mirror.Of[T]] = Expr.summon(using Type.of[Mirror.Of[T]]).get diff --git a/tests/run-macros/i8115/Macro_2.scala b/tests/run-macros/i8115/Macro_2.scala index 5543f1157c93..a8c4e0edb4b0 100644 --- a/tests/run-macros/i8115/Macro_2.scala +++ b/tests/run-macros/i8115/Macro_2.scala @@ -4,7 +4,7 @@ import scala.quoted._ object MyClassMaker { inline def make: MyClass = ${ makeImpl } - def makeImpl(using qctx: QuoteContext): Expr[MyClass] = { + def makeImpl(using Quotes): Expr[MyClass] = { '{ new MyClass { } /* eventually I want to add properties inside */ } diff --git a/tests/run-macros/i8115b/Macro_2.scala b/tests/run-macros/i8115b/Macro_2.scala index 85368256e639..23c546e7f47f 100644 --- a/tests/run-macros/i8115b/Macro_2.scala +++ b/tests/run-macros/i8115b/Macro_2.scala @@ -4,7 +4,7 @@ import scala.quoted._ object MyClassMaker { inline def make: MyClass = ${ makeImpl } - def makeImpl(using qctx: QuoteContext): Expr[MyClass] = { + def makeImpl(using Quotes): Expr[MyClass] = { '{ new MyClass { override def toString(): String = "MyClassMaker.make.MyClass" diff --git a/tests/run-macros/i8514/Macro_1.scala b/tests/run-macros/i8514/Macro_1.scala index 44257052ae69..8646ac588021 100644 --- a/tests/run-macros/i8514/Macro_1.scala +++ b/tests/run-macros/i8514/Macro_1.scala @@ -6,7 +6,7 @@ class C extends B inline def test(): Unit = ${ testExpr } -def testExpr(using QuoteContext): Expr[Unit] = { +def testExpr(using Quotes): Expr[Unit] = { import qctx.reflect._ '{ diff --git a/tests/run-macros/i8514b/Macro_1.scala b/tests/run-macros/i8514b/Macro_1.scala index 75540acc556d..45fb09178c86 100644 --- a/tests/run-macros/i8514b/Macro_1.scala +++ b/tests/run-macros/i8514b/Macro_1.scala @@ -6,7 +6,7 @@ class B extends A[P, String] inline def test(): Unit = ${ testExpr } -def testExpr(using QuoteContext): Expr[Unit] = { +def testExpr(using Quotes): Expr[Unit] = { import qctx.reflect._ val t = TypeRepr.of[B] diff --git a/tests/run-macros/i8520/Macro_1.scala b/tests/run-macros/i8520/Macro_1.scala index 74100f7b7560..8ec169ac9f7c 100644 --- a/tests/run-macros/i8520/Macro_1.scala +++ b/tests/run-macros/i8520/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def test[T[_]]: Unit = ${ testExpr[T] } -def testExpr[T[_]: Type](using QuoteContext): Expr[Unit] = { +def testExpr[T[_]: Type](using Quotes): Expr[Unit] = { import qctx.reflect._ def variance(f: Flags) = if f.is(Flags.Covariant) then "+" diff --git a/tests/run-macros/i8530/Macro_1.scala b/tests/run-macros/i8530/Macro_1.scala index 2d49b71383e3..dc431c14ef14 100644 --- a/tests/run-macros/i8530/Macro_1.scala +++ b/tests/run-macros/i8530/Macro_1.scala @@ -4,5 +4,5 @@ object Succ: inline def unapply(n: Int): Option[Int] = ${ impl('n) } - private def impl(n: Expr[Int])(using QuoteContext): Expr[Option[Int]] = + private def impl(n: Expr[Int])(using Quotes): Expr[Option[Int]] = '{ if $n == 0 then None else Some($n - 1)} diff --git a/tests/run-macros/i8671/Macro_1.scala b/tests/run-macros/i8671/Macro_1.scala index 92a36a82b844..b6c8f0dedeeb 100644 --- a/tests/run-macros/i8671/Macro_1.scala +++ b/tests/run-macros/i8671/Macro_1.scala @@ -11,7 +11,7 @@ object FileName { def fileNameFromString(s: String): Either[String, FileName] = Right(FileName.unsafe(s)) - def createFileName(fileName: Expr[String])(using qctx: QuoteContext): Expr[FileName] = + def createFileName(fileName: Expr[String])(using Quotes): Expr[FileName] = fileName match { case e@Const(s) => fileNameFromString(s) match { diff --git a/tests/run-macros/i8745/Macro_1.scala b/tests/run-macros/i8745/Macro_1.scala index 5575c4c07c85..23a44412789b 100644 --- a/tests/run-macros/i8745/Macro_1.scala +++ b/tests/run-macros/i8745/Macro_1.scala @@ -7,7 +7,7 @@ trait Trait { object Macro { inline def mac(inline tree: String): String = ${ macImpl('tree) } - def macImpl(tree: Expr[String])(using qctx: QuoteContext): Expr[String] = { + def macImpl(tree: Expr[String])(using Quotes): Expr[String] = { tree match { case vv @ '{ ($s: Trait).fun($arg) } => arg case _ => Expr("not matched") diff --git a/tests/run-macros/i8745b/Macro_1.scala b/tests/run-macros/i8745b/Macro_1.scala index 63af88c1ce19..bebb6cf6c382 100644 --- a/tests/run-macros/i8745b/Macro_1.scala +++ b/tests/run-macros/i8745b/Macro_1.scala @@ -6,7 +6,7 @@ object Companion { object Macro { inline def mac(inline tree: String): String = ${ macImpl('tree) } - def macImpl(tree: Expr[String])(using qctx: QuoteContext): Expr[String] = { + def macImpl(tree: Expr[String])(using Quotes): Expr[String] = { tree match { case vv @ '{ ($s: Companion.type).fun($arg) } => arg case _ => ??? diff --git a/tests/run-macros/i8746/Macro_1.scala b/tests/run-macros/i8746/Macro_1.scala index de6a895d4c74..e8f8143b1f23 100644 --- a/tests/run-macros/i8746/Macro_1.scala +++ b/tests/run-macros/i8746/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Macro { inline def mac(): String = ${ macImpl() } - def macImpl()(using qctx: QuoteContext): Expr[String] = + def macImpl()(using Quotes): Expr[String] = '{(x: String) => "anything"} match case '{ (in: String) => ($out: tpe2) } => Expr(out.toString) case _ => ??? diff --git a/tests/run-macros/i8746b/Macro_1.scala b/tests/run-macros/i8746b/Macro_1.scala index cc973c24a27c..8110716fa795 100644 --- a/tests/run-macros/i8746b/Macro_1.scala +++ b/tests/run-macros/i8746b/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Macro { inline def mac(inline tree: Any): String = ${ macImpl('tree) } - def macImpl(tree: Expr[Any])(using qctx: QuoteContext): Expr[String] = { + def macImpl(tree: Expr[Any])(using Quotes): Expr[String] = { tree match { case '{ (in: tpe1) => ($out: tpe2) } => Expr(out.toString) case _ => Expr("not matched") diff --git a/tests/run-macros/i9206/Macros_1.scala b/tests/run-macros/i9206/Macros_1.scala index 21f35e641d0c..bcb02c801ea4 100644 --- a/tests/run-macros/i9206/Macros_1.scala +++ b/tests/run-macros/i9206/Macros_1.scala @@ -4,7 +4,7 @@ import scala.quoted._ object Inspect { inline def inspect[T <: AnyKind]: String = ${ inspectTpe[T] } - def inspectTpe[T <: AnyKind: Type](using QuoteContext): Expr[String] = { + def inspectTpe[T <: AnyKind: Type](using Quotes): Expr[String] = { import qctx.reflect.TypeRepr val tree = TypeRepr.of[T].typeSymbol.tree Expr(tree.show) diff --git a/tests/run-macros/i9475/Macro_1.scala b/tests/run-macros/i9475/Macro_1.scala index c90d85ac9606..a9092e6c6ee9 100644 --- a/tests/run-macros/i9475/Macro_1.scala +++ b/tests/run-macros/i9475/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Exp { - private def compileImpl(e: Expr[Int], env: Map[String, Expr[Int]])(using QuoteContext): Expr[Int] = { + private def compileImpl(e: Expr[Int], env: Map[String, Expr[Int]])(using Quotes): Expr[Int] = { e match { case '{$s:Int} => s case exp => @@ -11,7 +11,7 @@ object Exp { } } - private def compileUnlift(e: Expr[Int])(using QuoteContext): Expr[Int] = { + private def compileUnlift(e: Expr[Int])(using Quotes): Expr[Int] = { val environment = Map[String, Expr[Int]]() compileImpl(e, environment) } diff --git a/tests/run-macros/i9570/Macro_1.scala b/tests/run-macros/i9570/Macro_1.scala index 5bdfc9709cee..3bfebe25c369 100644 --- a/tests/run-macros/i9570/Macro_1.scala +++ b/tests/run-macros/i9570/Macro_1.scala @@ -7,7 +7,7 @@ object Macros { case class HCons[+HD, TL <: HList](hd: HD, tl: TL) extends HList case object HNil extends HList - private def sizeImpl(e: Expr[HList], n:Int)(using qctx:QuoteContext): Expr[Int] = { + private def sizeImpl(e: Expr[HList], n:Int)(using qctx:Quotes): Expr[Int] = { import qctx.reflect._ e match { case '{HCons($_,$t)} => diff --git a/tests/run-macros/i9812b/Macro_1.scala b/tests/run-macros/i9812b/Macro_1.scala index 1f44e602257b..4080326cbe48 100644 --- a/tests/run-macros/i9812b/Macro_1.scala +++ b/tests/run-macros/i9812b/Macro_1.scala @@ -3,11 +3,11 @@ import SomeEnum._ trait Liftable[T] { /** Lift a value into an expression containing the construction of that value */ - def toExpr(x: T): QuoteContext ?=> Expr[T] + def toExpr(x: T): Quotes ?=> Expr[T] } object Lift: - def apply[T: Liftable](t: T)(using qctx: QuoteContext, ev: Liftable[T]): Expr[T] = ev.toExpr(t) + def apply[T: Liftable](t: T)(using q: Quotes, ev: Liftable[T]): Expr[T] = ev.toExpr(t) sealed abstract class SomeEnum object SomeEnum: @@ -17,35 +17,35 @@ object SomeEnum: def apply[S <: SomeEnum](s: S): SomeEnum = new Bar(s) given LiftFoo as Liftable[Foo.type]: - def toExpr(x: Foo.type): QuoteContext ?=> Expr[Foo.type] = '{Foo} + def toExpr(x: Foo.type): Quotes ?=> Expr[Foo.type] = '{Foo} given LiftBar[S <: SomeEnum: Type: Liftable] as Liftable[Bar[S]]: - def toExpr(x: Bar[S]): QuoteContext ?=> Expr[Bar[S]] = '{new Bar(${Lift(x.s)})} + def toExpr(x: Bar[S]): Quotes ?=> Expr[Bar[S]] = '{new Bar(${Lift(x.s)})} sealed abstract class Lst[+T] final case class CONS[+T](head: T, tail: Lst[T]) extends Lst[T] case object NIL extends Lst[Nothing] given IntLiftable[T <: Int] as Liftable[T]: - def toExpr(x: T): QuoteContext ?=> Expr[T] = (using qctx) => { + def toExpr(x: T): Quotes ?=> Expr[T] = (using qctx) => { import qctx.reflect._ Literal(Constant.Int(x)).asExpr.asInstanceOf[Expr[T]] } given LiftLst[T: Type: Liftable](using ev1: => Liftable[CONS[T]], ev2: => Liftable[NIL.type]) as Liftable[Lst[T]]: - def toExpr(xs: Lst[T]): QuoteContext ?=> Expr[Lst[T]] = xs match + def toExpr(xs: Lst[T]): Quotes ?=> Expr[Lst[T]] = xs match case NIL => ev2.toExpr(NIL) case cons @ CONS(_, _) => ev1.toExpr(cons) given LiftCONS[T: Type: Liftable](using Liftable[Lst[T]]) as Liftable[CONS[T]]: - def toExpr(x: CONS[T]): QuoteContext ?=> Expr[CONS[T]] = '{CONS(${Lift(x.head)}, ${Lift(x.tail)})} + def toExpr(x: CONS[T]): Quotes ?=> Expr[CONS[T]] = '{CONS(${Lift(x.head)}, ${Lift(x.tail)})} given LiftNIL as Liftable[NIL.type]: - def toExpr(x: NIL.type): QuoteContext ?=> Expr[NIL.type] = '{NIL} + def toExpr(x: NIL.type): Quotes ?=> Expr[NIL.type] = '{NIL} def mkLst[T](ts: T*) = ts.foldRight(NIL: Lst[T])(CONS(_,_)) -def quote123: QuoteContext ?=> Expr[Lst[Int]] = Lift(mkLst(1,2,3)) +def quote123: Quotes ?=> Expr[Lst[Int]] = Lift(mkLst(1,2,3)) inline def get123: Lst[Int] = ${ quote123 } diff --git a/tests/run-macros/inferred-repeated-result/test_1.scala b/tests/run-macros/inferred-repeated-result/test_1.scala index 84cc75055e80..1a5f578dbe25 100644 --- a/tests/run-macros/inferred-repeated-result/test_1.scala +++ b/tests/run-macros/inferred-repeated-result/test_1.scala @@ -2,7 +2,7 @@ object Macros { import scala.quoted._ inline def go[T](inline t: T) = ${ impl('t) } - def impl[T](expr: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { + def impl[T](expr: Expr[T])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(expr) diff --git a/tests/run-macros/inline-case-objects/Macro_1.scala b/tests/run-macros/inline-case-objects/Macro_1.scala index 6c4f2e59a143..3839dfdd870a 100644 --- a/tests/run-macros/inline-case-objects/Macro_1.scala +++ b/tests/run-macros/inline-case-objects/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Macros { - def impl(expr: Expr[Any]) (using QuoteContext): Expr[String] = + def impl(expr: Expr[Any]) (using Quotes): Expr[String] = val obj = expr match { case '{ None } => None case '{ scala.collection.immutable.Nil } => Nil diff --git a/tests/run-macros/inline-macro-inner-object/Macro_1.scala b/tests/run-macros/inline-macro-inner-object/Macro_1.scala index 425c9b8a0ab3..132667b298ca 100644 --- a/tests/run-macros/inline-macro-inner-object/Macro_1.scala +++ b/tests/run-macros/inline-macro-inner-object/Macro_1.scala @@ -4,17 +4,17 @@ import scala.quoted._ object A { inline def f: Unit = ${impl} - private def impl(using qctx: QuoteContext): Expr[Unit] = { + private def impl(using Quotes): Expr[Unit] = { '{println("A.f")} } object B { inline def f: Unit = ${impl} - private def impl(using qctx: QuoteContext): Expr[Unit] = { + private def impl(using Quotes): Expr[Unit] = { '{println("A.B.f")} } object C { inline def f: Unit = ${impl} - private def impl(using qctx: QuoteContext): Expr[Unit] = { + private def impl(using Quotes): Expr[Unit] = { '{println("A.B.C.f")} } } diff --git a/tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala b/tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala index 73b8119fd46d..8a60903682b4 100644 --- a/tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala +++ b/tests/run-macros/inline-macro-staged-interpreter/Macro_1.scala @@ -6,7 +6,7 @@ object E { inline def eval[T](inline x: E[T]): T = ${ impl('x) } - def impl[T: Type](expr: Expr[E[T]]) (using QuoteContext): Expr[T] = + def impl[T: Type](expr: Expr[E[T]]) (using Quotes): Expr[T] = expr.unliftOrError.lift implicit def ev1[T: Type]: Unliftable[E[T]] = new Unliftable { // TODO use type class derivation @@ -22,53 +22,53 @@ object E { } object Value { - def unapply[T](expr: Expr[T])(using Unliftable[T], QuoteContext): Option[T] = expr.unlift + def unapply[T](expr: Expr[T])(using Unliftable[T], Quotes): Option[T] = expr.unlift } } trait E[T] { - def lift (using QuoteContext): Expr[T] + def lift (using Quotes): Expr[T] } case class I(n: Int) extends E[Int] { - def lift (using QuoteContext): Expr[Int] = Expr(n) + def lift (using Quotes): Expr[Int] = Expr(n) } case class D(n: Double) extends E[Double] { - def lift (using QuoteContext): Expr[Double] = Expr(n) + def lift (using Quotes): Expr[Double] = Expr(n) } case class Plus[T](x: E[T], y: E[T])(implicit op: Plus2[T]) extends E[T] { - def lift (using QuoteContext): Expr[T] = op(x.lift, y.lift) + def lift (using Quotes): Expr[T] = op(x.lift, y.lift) } case class Times[T](x: E[T], y: E[T])(implicit op: Times2[T]) extends E[T] { - def lift (using QuoteContext): Expr[T] = op(x.lift, y.lift) + def lift (using Quotes): Expr[T] = op(x.lift, y.lift) } trait Op2[T] { - def apply(x: Expr[T], y: Expr[T]) (using QuoteContext): Expr[T] + def apply(x: Expr[T], y: Expr[T]) (using Quotes): Expr[T] } trait Plus2[T] extends Op2[T] object Plus2 { implicit case object IPlus extends Plus2[Int] { - def apply(x: Expr[Int], y: Expr[Int]) (using QuoteContext): Expr[Int] = '{$x + $y} + def apply(x: Expr[Int], y: Expr[Int]) (using Quotes): Expr[Int] = '{$x + $y} } implicit case object DPlus extends Plus2[Double] { - def apply(x: Expr[Double], y: Expr[Double]) (using QuoteContext): Expr[Double] = '{$x + $y} + def apply(x: Expr[Double], y: Expr[Double]) (using Quotes): Expr[Double] = '{$x + $y} } } trait Times2[T] extends Op2[T] object Times2 { implicit case object ITimes extends Times2[Int] { - def apply(x: Expr[Int], y: Expr[Int]) (using QuoteContext): Expr[Int] = '{$x * $y} + def apply(x: Expr[Int], y: Expr[Int]) (using Quotes): Expr[Int] = '{$x * $y} } implicit case object DTimes extends Times2[Double] { - def apply(x: Expr[Double], y: Expr[Double]) (using QuoteContext): Expr[Double] = '{$x * $y} + def apply(x: Expr[Double], y: Expr[Double]) (using Quotes): Expr[Double] = '{$x * $y} } } diff --git a/tests/run-macros/inline-option/Macro_1.scala b/tests/run-macros/inline-option/Macro_1.scala index 533e61d91069..ba6e799257e3 100644 --- a/tests/run-macros/inline-option/Macro_1.scala +++ b/tests/run-macros/inline-option/Macro_1.scala @@ -3,11 +3,11 @@ import scala.quoted._ object Macros { - def impl(opt: Expr[Option[Int]]) (using QuoteContext): Expr[Int] = opt.unliftOrError match { + def impl(opt: Expr[Option[Int]]) (using Quotes): Expr[Int] = opt.unliftOrError match { case Some(i) => Expr(i) case None => '{-1} } - def impl2(opt: Expr[Option[Option[Int]]]) (using QuoteContext): Expr[Int] = impl(Expr(opt.unliftOrError.flatten)) + def impl2(opt: Expr[Option[Option[Int]]]) (using Quotes): Expr[Int] = impl(Expr(opt.unliftOrError.flatten)) } diff --git a/tests/run-macros/inline-tuples-1/Macro_1.scala b/tests/run-macros/inline-tuples-1/Macro_1.scala index b28eae0e6d4c..ea67c9351426 100644 --- a/tests/run-macros/inline-tuples-1/Macro_1.scala +++ b/tests/run-macros/inline-tuples-1/Macro_1.scala @@ -2,26 +2,26 @@ import scala.quoted._ object Macros { - def tup1(tup: Expr[Tuple1[Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup2(tup: Expr[Tuple2[Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) - def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup1(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup2(tup: Expr[Tuple2[Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup3(tup: Expr[Tuple3[Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup4(tup: Expr[Tuple4[Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup5(tup: Expr[Tuple5[Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup6(tup: Expr[Tuple6[Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup7(tup: Expr[Tuple7[Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup8(tup: Expr[Tuple8[Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup9(tup: Expr[Tuple9[Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup10(tup: Expr[Tuple10[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup11(tup: Expr[Tuple11[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup12(tup: Expr[Tuple12[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup13(tup: Expr[Tuple13[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup14(tup: Expr[Tuple14[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup15(tup: Expr[Tuple15[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup16(tup: Expr[Tuple16[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup17(tup: Expr[Tuple17[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup18(tup: Expr[Tuple18[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup19(tup: Expr[Tuple19[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup20(tup: Expr[Tuple20[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup21(tup: Expr[Tuple21[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) + def tup22(tup: Expr[Tuple22[Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError.productIterator.map(_.asInstanceOf[Int]).sum) } diff --git a/tests/run-macros/inline-tuples-2/Macro_1.scala b/tests/run-macros/inline-tuples-2/Macro_1.scala index b4cdd1c77fa1..586df3c1a1cf 100644 --- a/tests/run-macros/inline-tuples-2/Macro_1.scala +++ b/tests/run-macros/inline-tuples-2/Macro_1.scala @@ -3,8 +3,8 @@ import scala.quoted._ object Macros { - def impl(tup: Expr[Tuple1[Int]]) (using QuoteContext): Expr[Int] = Expr(tup.unliftOrError._1) + def impl(tup: Expr[Tuple1[Int]]) (using Quotes): Expr[Int] = Expr(tup.unliftOrError._1) - def impl2(tup: Expr[Tuple1[Tuple1[Int]]]) (using QuoteContext): Expr[Int] = impl(Expr(tup.unliftOrError._1)) + def impl2(tup: Expr[Tuple1[Tuple1[Int]]]) (using Quotes): Expr[Int] = impl(Expr(tup.unliftOrError._1)) } diff --git a/tests/run-macros/inline-varargs-1/Macro_1.scala b/tests/run-macros/inline-varargs-1/Macro_1.scala index 26bf6ed9f474..b65d5544d429 100644 --- a/tests/run-macros/inline-varargs-1/Macro_1.scala +++ b/tests/run-macros/inline-varargs-1/Macro_1.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Macros { - def sum(nums: Expr[Int]*) (using QuoteContext): Expr[Int] = Expr(nums.map(_.unliftOrError).sum) + def sum(nums: Expr[Int]*) (using Quotes): Expr[Int] = Expr(nums.map(_.unliftOrError).sum) } diff --git a/tests/run-macros/macros-in-same-project1/Foo.scala b/tests/run-macros/macros-in-same-project1/Foo.scala index a59dc01f6ca7..000fb979a3d9 100644 --- a/tests/run-macros/macros-in-same-project1/Foo.scala +++ b/tests/run-macros/macros-in-same-project1/Foo.scala @@ -4,6 +4,6 @@ object Foo { inline def myMacro(): Unit = ${ aMacroImplementation } - def aMacroImplementation(using QuoteContext): Expr[Unit] = '{ println("Hello") } + def aMacroImplementation(using Quotes): Expr[Unit] = '{ println("Hello") } } \ No newline at end of file diff --git a/tests/run-macros/no-symbol/1.scala b/tests/run-macros/no-symbol/1.scala index 931938df3cb3..42fd87ebaa31 100644 --- a/tests/run-macros/no-symbol/1.scala +++ b/tests/run-macros/no-symbol/1.scala @@ -8,7 +8,7 @@ object Macro { inline def foo[T]: String = ${ fooImpl[T] } - def fooImpl[T](implicit t: Type[T], qctx: QuoteContext): Expr[String] = { + def fooImpl[T](implicit t: Type[T], qctx: Quotes): Expr[String] = { import qctx.reflect._ val sym = TypeTree.of[T].symbol if sym.isClassDef then '{ "symbol" } diff --git a/tests/run-macros/paramSymss/Macro_1.scala b/tests/run-macros/paramSymss/Macro_1.scala index 6a7efc1c5154..10120b57d7d2 100644 --- a/tests/run-macros/paramSymss/Macro_1.scala +++ b/tests/run-macros/paramSymss/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ inline def showParamSyms(inline x: Any): String = ${ showParamSymsExpr('x) } -def showParamSymsExpr(using QuoteContext)(x: Expr[Any]): Expr[String] = +def showParamSymsExpr(using Quotes)(x: Expr[Any]): Expr[String] = import qctx.reflect._ val '{ $y: Any } = x // Drop Inlined not to access the symbol val sym = Term.of(y).symbol diff --git a/tests/run-macros/power-macro/Macro_1.scala b/tests/run-macros/power-macro/Macro_1.scala index 00543b4c5a30..6395040475a4 100644 --- a/tests/run-macros/power-macro/Macro_1.scala +++ b/tests/run-macros/power-macro/Macro_1.scala @@ -3,10 +3,10 @@ import scala.quoted._ inline def power(x: Double, inline n: Int) = ${ powerCode1('x, 'n) } -private def powerCode1(using qctx: QuoteContext)(x: Expr[Double], n: Expr[Int]): Expr[Double] = +private def powerCode1(using Quotes)(x: Expr[Double], n: Expr[Int]): Expr[Double] = powerCode(x, n.unliftOrError) -private def powerCode(using qctx: QuoteContext)(x: Expr[Double], n: Int): Expr[Double] = +private def powerCode(using Quotes)(x: Expr[Double], n: Int): Expr[Double] = if (n == 0) Expr(1.0) else if (n == 1) x else if (n % 2 == 0) '{ val y = $x * $x; ${ powerCode('y, n / 2) } } diff --git a/tests/run-macros/quote-and-splice/Macros_1.scala b/tests/run-macros/quote-and-splice/Macros_1.scala index b953f741c4e3..0646f53854f0 100644 --- a/tests/run-macros/quote-and-splice/Macros_1.scala +++ b/tests/run-macros/quote-and-splice/Macros_1.scala @@ -3,26 +3,26 @@ import scala.quoted._ object Macros { inline def macro1 = ${ macro1Impl } - def macro1Impl (using QuoteContext)= '{3} + def macro1Impl (using Quotes)= '{3} inline def macro2(inline p: Boolean) = ${ macro2Impl('p) } - def macro2Impl(p: Expr[Boolean]) (using QuoteContext)= if (p.unliftOrError) '{3} else '{4} + def macro2Impl(p: Expr[Boolean]) (using Quotes)= if (p.unliftOrError) '{3} else '{4} inline def macro3(n: Int) = ${ macro3Impl('n) } - def macro3Impl(p: Expr[Int]) (using QuoteContext)= '{ 2 + $p } + def macro3Impl(p: Expr[Int]) (using Quotes)= '{ 2 + $p } inline def macro4(i: Int)(j: Int) = ${ macro4Impl('i)('j) } - def macro4Impl(i: Expr[Int])(j: Expr[Int]) (using QuoteContext)= '{ $i + $j } + def macro4Impl(i: Expr[Int])(j: Expr[Int]) (using Quotes)= '{ $i + $j } inline def macro5(i: Int, j: Int) = ${ macro5Impl(j = 'j, i = 'i) } - def macro5Impl(i: Expr[Int], j: Expr[Int]) (using QuoteContext)= '{ $i + $j } + def macro5Impl(i: Expr[Int], j: Expr[Int]) (using Quotes)= '{ $i + $j } inline def power(inline n: Int, x: Double) = ${ powerCode('n, 'x) } - def powerCode(n: Expr[Int], x: Expr[Double]) (using QuoteContext): Expr[Double] = + def powerCode(n: Expr[Int], x: Expr[Double]) (using Quotes): Expr[Double] = powerCode(n.unliftOrError, x) - def powerCode(n: Int, x: Expr[Double]) (using QuoteContext): Expr[Double] = + def powerCode(n: Int, x: Expr[Double]) (using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n == 1) x else if (n % 2 == 0) '{ { val y = $x * $x; ${powerCode(n / 2, 'y)} } } diff --git a/tests/run-macros/quote-change-owner/Macro_1.scala b/tests/run-macros/quote-change-owner/Macro_1.scala index f12c5c355c12..34001992a2a7 100644 --- a/tests/run-macros/quote-change-owner/Macro_1.scala +++ b/tests/run-macros/quote-change-owner/Macro_1.scala @@ -1,7 +1,7 @@ import scala.quoted._ object Macros { inline def assert2(expr: => Boolean): Unit = ${ assertImpl('expr) } - def assertImpl(expr: Expr[Boolean])(using QuoteContext) = '{ + def assertImpl(expr: Expr[Boolean])(using Quotes) = '{ def foo(): Unit = $expr foo() } diff --git a/tests/run-macros/quote-elide-prefix/quoted_1.scala b/tests/run-macros/quote-elide-prefix/quoted_1.scala index cdad817e2a66..d44ad7ee6930 100644 --- a/tests/run-macros/quote-elide-prefix/quoted_1.scala +++ b/tests/run-macros/quote-elide-prefix/quoted_1.scala @@ -5,5 +5,5 @@ object Macro { // By name StringContext is used to elide the prefix extension (inline sc: StringContext) inline def ff (args: => Any*): String = ${ Macro.impl('sc, 'args) } - def impl(sc: Expr[StringContext], args: Expr[Seq[Any]])(using QuoteContext): Expr[String] = '{ $args.mkString } + def impl(sc: Expr[StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[String] = '{ $args.mkString } } diff --git a/tests/run-macros/quote-force/quoted_1.scala b/tests/run-macros/quote-force/quoted_1.scala index d07a4cf47327..4c3f0844dbbb 100644 --- a/tests/run-macros/quote-force/quoted_1.scala +++ b/tests/run-macros/quote-force/quoted_1.scala @@ -6,7 +6,7 @@ object Location { implicit inline def location: Location = ${impl} - def impl(using QuoteContext): Expr[Location] = { + def impl(using Quotes): Expr[Location] = { val list = Expr(List("a", "b", "c", "d", "e", "f")) '{new Location(${list})} } diff --git a/tests/run-macros/quote-implicitMatch/Macro_1.scala b/tests/run-macros/quote-implicitMatch/Macro_1.scala index bf4f779b5a69..1c8c2e445d25 100644 --- a/tests/run-macros/quote-implicitMatch/Macro_1.scala +++ b/tests/run-macros/quote-implicitMatch/Macro_1.scala @@ -5,7 +5,7 @@ import scala.quoted._ inline def f1[T]() = ${ f1Impl[T] } -def f1Impl[T: Type](using QuoteContext) = { +def f1Impl[T: Type](using Quotes) = { Expr.summon[Ordering[T]] match { case Some(ord) => '{ new TreeSet[T]()($ord) } case _ => '{ new HashSet[T] } @@ -17,7 +17,7 @@ class B inline def g = ${ gImpl } -def gImpl(using QuoteContext) = { +def gImpl(using Quotes) = { if (Expr.summon[A].isDefined) '{ println("A") } else if (Expr.summon[B].isDefined) '{ println("B") } else throw new MatchError("") diff --git a/tests/run-macros/quote-impure-by-name/quoted_1.scala b/tests/run-macros/quote-impure-by-name/quoted_1.scala index 5f0dc8550e8e..df3252efc958 100644 --- a/tests/run-macros/quote-impure-by-name/quoted_1.scala +++ b/tests/run-macros/quote-impure-by-name/quoted_1.scala @@ -10,7 +10,7 @@ object Index { implicit inline def succ[K, H, T](implicit inline prev: Index[K, T]): Index[K, (H, T)] = ${ succImpl[K, H, T]('prev) } - def succImpl[K: Type, H: Type, T: Type](prev: Expr[Index[K, T]])(using QuoteContext): Expr[Index[K, (H, T)]] = { + def succImpl[K: Type, H: Type, T: Type](prev: Expr[Index[K, T]])(using Quotes): Expr[Index[K, (H, T)]] = { val value = s"1 + {${prev.show}}" '{new Index(${Expr(value)})} } diff --git a/tests/run-macros/quote-indexed-map-by-name/quoted_1.scala b/tests/run-macros/quote-indexed-map-by-name/quoted_1.scala index 2e64ed48febe..6cff47d619bd 100644 --- a/tests/run-macros/quote-indexed-map-by-name/quoted_1.scala +++ b/tests/run-macros/quote-indexed-map-by-name/quoted_1.scala @@ -7,7 +7,7 @@ object Index { implicit inline def succ[K, H, T](implicit prev: => Index[K, T]): Index[K, (H, T)] = ${succImpl(Type.of[K], Type.of[H], Type.of[T])} - def succImpl[K, H, T](k: Type[K], h: Type[H], t: Type[T])(using QuoteContext): Expr[Index[K, (H, T)]] = { + def succImpl[K, H, T](k: Type[K], h: Type[H], t: Type[T])(using Quotes): Expr[Index[K, (H, T)]] = { implicit val kk: Type[K] = k implicit val hh: Type[H] = h implicit val tt: Type[T] = t diff --git a/tests/run-macros/quote-inline-function/quoted_1.scala b/tests/run-macros/quote-inline-function/quoted_1.scala index 6d55dba715dd..ddae6357bdd8 100644 --- a/tests/run-macros/quote-inline-function/quoted_1.scala +++ b/tests/run-macros/quote-inline-function/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { inline def foreach2(start: Int, end: Int, f: => Int => Unit): String = ${impl('start, 'end, 'f)} inline def foreach3(start: Int, end: Int, inline f: Int => Unit): String = ${impl('start, 'end, 'f)} - def impl(start: Expr[Int], end: Expr[Int], f: Expr[Int => Unit])(using qctx: QuoteContext) : Expr[String] = { + def impl(start: Expr[Int], end: Expr[Int], f: Expr[Int => Unit])(using Quotes) : Expr[String] = { import qctx.reflect._ val res = '{ var i = $start diff --git a/tests/run-macros/quote-matcher-inference/Macro_1.scala b/tests/run-macros/quote-matcher-inference/Macro_1.scala index 743e6b9cd452..bd704315dadf 100644 --- a/tests/run-macros/quote-matcher-inference/Macro_1.scala +++ b/tests/run-macros/quote-matcher-inference/Macro_1.scala @@ -5,7 +5,7 @@ object Macros { inline def g(inline x: Unit): Unit = ${impl('x)} - private def impl(x: Expr[Any])(using QuoteContext): Expr[Any] = { + private def impl(x: Expr[Any])(using Quotes): Expr[Any] = { x match case '{ println(f($y)) } => y } diff --git a/tests/run-macros/quote-matcher-power/Macro_1.scala b/tests/run-macros/quote-matcher-power/Macro_1.scala index f57bde9ed251..25b5834cd331 100644 --- a/tests/run-macros/quote-matcher-power/Macro_1.scala +++ b/tests/run-macros/quote-matcher-power/Macro_1.scala @@ -3,10 +3,10 @@ import scala.quoted._ object Macros { - def power_s(x: Expr[Double], n: Expr[Int]) (using QuoteContext): Expr[Double] = + def power_s(x: Expr[Double], n: Expr[Int]) (using Quotes): Expr[Double] = power_s(x, n.unliftOrError) - def power_s(x: Expr[Double], n: Int) (using QuoteContext): Expr[Double] = + def power_s(x: Expr[Double], n: Int) (using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n % 2 == 1) '{ $x * ${power_s(x, n - 1)} } else '{ val y = $x * $x; ${power_s('y, n / 2)} } @@ -19,7 +19,7 @@ object Macros { inline def rewrite(expr: => Double): Double = ${rewrite('expr)} // simple, 1-level, non-recursive rewriter for exponents - def rewrite(expr: Expr[Double]) (using QuoteContext): Expr[Double] = { + def rewrite(expr: Expr[Double]) (using Quotes): Expr[Double] = { val res = expr match { // product rule case '{ power2($a, $x) * power2($b, $y)} if a.matches(b) => '{ power2($a, $x + $y) } diff --git a/tests/run-macros/quote-matcher-runtime/quoted_1.scala b/tests/run-macros/quote-matcher-runtime/quoted_1.scala index 522d19e57c2a..49456b6f2fba 100644 --- a/tests/run-macros/quote-matcher-runtime/quoted_1.scala +++ b/tests/run-macros/quote-matcher-runtime/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def matches[A, B](inline a: A, inline b: B): Unit = ${impl('a, 'b)} - private def impl[A, B](a: Expr[A], b: Expr[B])(using qctx: QuoteContext) : Expr[Unit] = { + private def impl[A, B](a: Expr[A], b: Expr[B])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val res = qctx.asInstanceOf[scala.quoted.runtime.QuoteMatching].ExprMatch.unapply[Tuple, Tuple](a)(using b).map { tup => diff --git a/tests/run-macros/quote-matcher-string-interpolator-2/quoted_1.scala b/tests/run-macros/quote-matcher-string-interpolator-2/quoted_1.scala index f5acbfaca656..a7675de6f7a5 100644 --- a/tests/run-macros/quote-matcher-string-interpolator-2/quoted_1.scala +++ b/tests/run-macros/quote-matcher-string-interpolator-2/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { extension (inline self: StringContext) inline def xyz(inline args: String*): String = ${impl('self, 'args)} - private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using QuoteContext): Expr[String] = { + private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using Quotes): Expr[String] = { (self, args) match { case ('{ StringContext(${Varargs(parts)}: _*) }, Varargs(args1)) => val strParts = parts.map { case Const(str) => str.reverse } diff --git a/tests/run-macros/quote-matcher-string-interpolator-3/quoted_1.scala b/tests/run-macros/quote-matcher-string-interpolator-3/quoted_1.scala index 1e4f3d8d1b44..8c51f0d89480 100644 --- a/tests/run-macros/quote-matcher-string-interpolator-3/quoted_1.scala +++ b/tests/run-macros/quote-matcher-string-interpolator-3/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { extension (inline self: StringContext) inline def S(args: => String*): String = ${impl('self, 'args)} - private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using QuoteContext): Expr[String] = { + private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using Quotes): Expr[String] = { self match { case '{ StringContext(${Varargs(Consts(parts))}: _*) } => val upprerParts: List[String] = parts.toList.map(_.toUpperCase) diff --git a/tests/run-macros/quote-matcher-string-interpolator/quoted_1.scala b/tests/run-macros/quote-matcher-string-interpolator/quoted_1.scala index 385f1c00c26c..a14f05fbcf26 100644 --- a/tests/run-macros/quote-matcher-string-interpolator/quoted_1.scala +++ b/tests/run-macros/quote-matcher-string-interpolator/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { extension (inline self: StringContext) inline def xyz(args: => String*): String = ${impl('self, 'args)} - private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using QuoteContext): Expr[String] = { + private def impl(self: Expr[StringContext], args: Expr[Seq[String]])(using Quotes): Expr[String] = { self match { case '{ StringContext(${Varargs(parts)}: _*) } => val parts2 = Expr.ofList(parts.map(x => '{ $x.reverse })) diff --git a/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala index bbb3d709999a..aa3fe1a5fb03 100644 --- a/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { inline def lift[T](sym: Symantics[T])(inline a: DSL): T = ${impl[T]('sym, 'a)} - private def impl[T: Type](sym: Expr[Symantics[T]], a: Expr[DSL])(using qctx: QuoteContext): Expr[T] = { + private def impl[T: Type](sym: Expr[Symantics[T]], a: Expr[DSL])(using Quotes): Expr[T] = { def lift(e: Expr[DSL]): Expr[T] = e match { diff --git a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala index b11cae0fb4fd..568a740e98c9 100644 --- a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala @@ -4,20 +4,20 @@ object Macros { inline def liftString(inline a: DSL): String = ${implStringNum('a)} - private def implStringNum(a: Expr[DSL])(using qctx: QuoteContext): Expr[String] = + private def implStringNum(a: Expr[DSL])(using Quotes): Expr[String] = impl(StringNum, a) inline def liftCompute(inline a: DSL): Int = ${implComputeNum('a)} - private def implComputeNum(a: Expr[DSL])(using qctx: QuoteContext): Expr[Int] = + private def implComputeNum(a: Expr[DSL])(using Quotes): Expr[Int] = impl(ComputeNum, a) inline def liftAST(inline a: DSL): ASTNum = ${implASTNum('a)} - private def implASTNum(a: Expr[DSL])(using qctx: QuoteContext): Expr[ASTNum] = + private def implASTNum(a: Expr[DSL])(using Quotes): Expr[ASTNum] = impl(ASTNum, a) - private def impl[T: Type](sym: Symantics[T], a: Expr[DSL])(using qctx: QuoteContext): Expr[T] = { + private def impl[T: Type](sym: Symantics[T], a: Expr[DSL])(using Quotes): Expr[T] = { def lift(e: Expr[DSL])(implicit env: Map[Int, Expr[T]]): Expr[T] = e match { @@ -63,18 +63,18 @@ object Macros { } object UnsafeExpr { - def open[T1, R, X](f: Expr[T1 => R])(content: (Expr[R], [t] => Expr[t] => Expr[T1] => Expr[t]) => X)(using qctx: QuoteContext): X = { + def open[T1, R, X](f: Expr[T1 => R])(content: (Expr[R], [t] => Expr[t] => Expr[T1] => Expr[t]) => X)(using Quotes): X = { import qctx.reflect._ val (params, bodyExpr) = paramsAndBody[R](f) content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](Term.of(e), params, List(Term.of(v))).asExpr.asInstanceOf[Expr[t]]) } - private def paramsAndBody[R](using qctx: QuoteContext)(f: Expr[Any]): (List[qctx.reflect.ValDef], Expr[R]) = { + private def paramsAndBody[R](using Quotes)(f: Expr[Any]): (List[qctx.reflect.ValDef], Expr[R]) = { import qctx.reflect._ val Block(List(DefDef("$anonfun", Nil, List(params), _, Some(body))), Closure(Ident("$anonfun"), None)) = Term.of(f).etaExpand(Symbol.spliceOwner) (params, body.asExpr.asInstanceOf[Expr[R]]) } - private def bodyFn[t](using qctx: QuoteContext)(e: qctx.reflect.Term, params: List[qctx.reflect.ValDef], args: List[qctx.reflect.Term]): qctx.reflect.Term = { + private def bodyFn[t](using Quotes)(e: qctx.reflect.Term, params: List[qctx.reflect.ValDef], args: List[qctx.reflect.Term]): qctx.reflect.Term = { import qctx.reflect._ val map = params.map(_.symbol).zip(args).toMap new TreeMap { @@ -86,7 +86,7 @@ object UnsafeExpr { } } -def freshEnvVar()(using QuoteContext): (Int, Expr[DSL]) = { +def freshEnvVar()(using Quotes): (Int, Expr[DSL]) = { v += 1 (v, '{envVar(${Expr(v)})}) } @@ -108,35 +108,35 @@ case class LitDSL(x: Int) extends DSL // trait Symantics[Num] { - def value(x: Int)(using QuoteContext): Expr[Num] - def plus(x: Expr[Num], y: Expr[Num])(using QuoteContext): Expr[Num] - def times(x: Expr[Num], y: Expr[Num])(using QuoteContext): Expr[Num] - def app(f: Expr[Num => Num], x: Expr[Num])(using QuoteContext): Expr[Num] - def lam(body: Expr[Num] => Expr[Num])(using QuoteContext): Expr[Num => Num] + def value(x: Int)(using Quotes): Expr[Num] + def plus(x: Expr[Num], y: Expr[Num])(using Quotes): Expr[Num] + def times(x: Expr[Num], y: Expr[Num])(using Quotes): Expr[Num] + def app(f: Expr[Num => Num], x: Expr[Num])(using Quotes): Expr[Num] + def lam(body: Expr[Num] => Expr[Num])(using Quotes): Expr[Num => Num] } object StringNum extends Symantics[String] { - def value(x: Int)(using QuoteContext): Expr[String] = Expr(x.toString) - def plus(x: Expr[String], y: Expr[String])(using QuoteContext): Expr[String] = '{ s"${$x} + ${$y}" } // '{ x + " + " + y } - def times(x: Expr[String], y: Expr[String])(using QuoteContext): Expr[String] = '{ s"${$x} * ${$y}" } - def app(f: Expr[String => String], x: Expr[String])(using QuoteContext): Expr[String] = Expr.betaReduce('{ $f($x) }) - def lam(body: Expr[String] => Expr[String])(using QuoteContext): Expr[String => String] = '{ (x: String) => ${body('x)} } + def value(x: Int)(using Quotes): Expr[String] = Expr(x.toString) + def plus(x: Expr[String], y: Expr[String])(using Quotes): Expr[String] = '{ s"${$x} + ${$y}" } // '{ x + " + " + y } + def times(x: Expr[String], y: Expr[String])(using Quotes): Expr[String] = '{ s"${$x} * ${$y}" } + def app(f: Expr[String => String], x: Expr[String])(using Quotes): Expr[String] = Expr.betaReduce('{ $f($x) }) + def lam(body: Expr[String] => Expr[String])(using Quotes): Expr[String => String] = '{ (x: String) => ${body('x)} } } object ComputeNum extends Symantics[Int] { - def value(x: Int)(using QuoteContext): Expr[Int] = Expr(x) - def plus(x: Expr[Int], y: Expr[Int])(using QuoteContext): Expr[Int] = '{ $x + $y } - def times(x: Expr[Int], y: Expr[Int])(using QuoteContext): Expr[Int] = '{ $x * $y } - def app(f: Expr[Int => Int], x: Expr[Int])(using QuoteContext): Expr[Int] = '{ $f($x) } - def lam(body: Expr[Int] => Expr[Int])(using QuoteContext): Expr[Int => Int] = '{ (x: Int) => ${body('x)} } + def value(x: Int)(using Quotes): Expr[Int] = Expr(x) + def plus(x: Expr[Int], y: Expr[Int])(using Quotes): Expr[Int] = '{ $x + $y } + def times(x: Expr[Int], y: Expr[Int])(using Quotes): Expr[Int] = '{ $x * $y } + def app(f: Expr[Int => Int], x: Expr[Int])(using Quotes): Expr[Int] = '{ $f($x) } + def lam(body: Expr[Int] => Expr[Int])(using Quotes): Expr[Int => Int] = '{ (x: Int) => ${body('x)} } } object ASTNum extends Symantics[ASTNum] { - def value(x: Int)(using QuoteContext): Expr[ASTNum] = '{ LitAST(${Expr(x)}) } - def plus(x: Expr[ASTNum], y: Expr[ASTNum])(using QuoteContext): Expr[ASTNum] = '{ PlusAST($x, $y) } - def times(x: Expr[ASTNum], y: Expr[ASTNum])(using QuoteContext): Expr[ASTNum] = '{ TimesAST($x, $y) } - def app(f: Expr[ASTNum => ASTNum], x: Expr[ASTNum])(using QuoteContext): Expr[ASTNum] = '{ AppAST($f, $x) } - def lam(body: Expr[ASTNum] => Expr[ASTNum])(using QuoteContext): Expr[ASTNum => ASTNum] = '{ (x: ASTNum) => ${body('x)} } + def value(x: Int)(using Quotes): Expr[ASTNum] = '{ LitAST(${Expr(x)}) } + def plus(x: Expr[ASTNum], y: Expr[ASTNum])(using Quotes): Expr[ASTNum] = '{ PlusAST($x, $y) } + def times(x: Expr[ASTNum], y: Expr[ASTNum])(using Quotes): Expr[ASTNum] = '{ TimesAST($x, $y) } + def app(f: Expr[ASTNum => ASTNum], x: Expr[ASTNum])(using Quotes): Expr[ASTNum] = '{ AppAST($f, $x) } + def lam(body: Expr[ASTNum] => Expr[ASTNum])(using Quotes): Expr[ASTNum => ASTNum] = '{ (x: ASTNum) => ${body('x)} } } trait ASTNum diff --git a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala index c025334b52c0..c3d6d1209f0b 100644 --- a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { inline def lift[R[_]](sym: Symantics { type Repr[X] = R[X] })(inline a: Int): R[Int] = ${impl('sym, 'a)} - private def impl[R[_]: Type](sym: Expr[Symantics { type Repr[X] = R[X] }], expr: Expr[Int])(using QuoteContext): Expr[R[Int]] = { + private def impl[R[_]: Type](sym: Expr[Symantics { type Repr[X] = R[X] }], expr: Expr[Int])(using Quotes): Expr[R[Int]] = { type Env = Map[Int, Any] @@ -75,18 +75,18 @@ object Macros { } object UnsafeExpr { - def open[T1, R, X](f: Expr[T1 => R])(content: (Expr[R], [t] => Expr[t] => Expr[T1] => Expr[t]) => X)(using qctx: QuoteContext): X = { + def open[T1, R, X](f: Expr[T1 => R])(content: (Expr[R], [t] => Expr[t] => Expr[T1] => Expr[t]) => X)(using Quotes): X = { import qctx.reflect._ val (params, bodyExpr) = paramsAndBody[R](f) content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](Term.of(e), params, List(Term.of(v))).asExpr.asInstanceOf[Expr[t]]) } - private def paramsAndBody[R](using qctx: QuoteContext)(f: Expr[Any]): (List[qctx.reflect.ValDef], Expr[R]) = { + private def paramsAndBody[R](using Quotes)(f: Expr[Any]): (List[qctx.reflect.ValDef], Expr[R]) = { import qctx.reflect._ val Block(List(DefDef("$anonfun", Nil, List(params), _, Some(body))), Closure(Ident("$anonfun"), None)) = Term.of(f).etaExpand(Symbol.spliceOwner) (params, body.asExpr.asInstanceOf[Expr[R]]) } - private def bodyFn[t](using qctx: QuoteContext)(e: qctx.reflect.Term, params: List[qctx.reflect.ValDef], args: List[qctx.reflect.Term]): qctx.reflect.Term = { + private def bodyFn[t](using Quotes)(e: qctx.reflect.Term, params: List[qctx.reflect.ValDef], args: List[qctx.reflect.Term]): qctx.reflect.Term = { import qctx.reflect._ val map = params.map(_.symbol).zip(args).toMap new TreeMap { @@ -98,7 +98,7 @@ object UnsafeExpr { } } -def freshEnvVar[T: Type]()(using QuoteContext): (Int, Expr[T]) = { +def freshEnvVar[T: Type]()(using Quotes): (Int, Expr[T]) = { v += 1 (v, '{envVar[T](${Expr(v)})}) } diff --git a/tests/run-macros/quote-matcher-type-bind/Macro_1.scala b/tests/run-macros/quote-matcher-type-bind/Macro_1.scala index 2311529c0c3f..4692c1c277aa 100644 --- a/tests/run-macros/quote-matcher-type-bind/Macro_1.scala +++ b/tests/run-macros/quote-matcher-type-bind/Macro_1.scala @@ -5,7 +5,7 @@ object Macros { inline def swapFandG(x: => Unit): Unit = ${impl('x)} - private def impl(x: Expr[Unit])(using QuoteContext): Expr[Unit] = { + private def impl(x: Expr[Unit])(using Quotes): Expr[Unit] = { x match { case '{ DSL.f[t]($x) } => '{ DSL.g[t]($x) } case '{ DSL.g[t]($x) } => '{ DSL.f[t]($x) } diff --git a/tests/run-macros/quote-matching-open/Macro_1.scala b/tests/run-macros/quote-matching-open/Macro_1.scala index 0288acb1c5e8..2c79eff29b0d 100644 --- a/tests/run-macros/quote-matching-open/Macro_1.scala +++ b/tests/run-macros/quote-matching-open/Macro_1.scala @@ -4,7 +4,7 @@ object Macro { inline def openTest(inline x: Any): Any = ${ Macro.impl('x) } - def impl(x: Expr[Any])(using QuoteContext): Expr[Any] = { + def impl(x: Expr[Any])(using Quotes): Expr[Any] = { x match { case '{ (x: Int) => $body(x): Int } => UnsafeExpr.open(body) { (body, close) => close(body)(Expr(2)) } case '{ (x1: Int, x2: Int) => $body(x1, x2): Int } => UnsafeExpr.open(body) { (body, close) => close(body)(Expr(2), Expr(3)) } @@ -16,29 +16,29 @@ object Macro { object UnsafeExpr { - def open[T1, R, X](f: Expr[T1 => R])(content: (Expr[R], [t] => Expr[t] => Expr[T1] => Expr[t]) => X)(using qctx: QuoteContext): X = { + def open[T1, R, X](f: Expr[T1 => R])(content: (Expr[R], [t] => Expr[t] => Expr[T1] => Expr[t]) => X)(using Quotes): X = { import qctx.reflect._ val (params, bodyExpr) = paramsAndBody[R](f) content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](Term.of(e), params, List(Term.of(v))).asExpr.asInstanceOf[Expr[t]]) } - def open[T1, T2, R, X](f: Expr[(T1, T2) => R])(content: (Expr[R], [t] => Expr[t] => (Expr[T1], Expr[T2]) => Expr[t]) => X)(using qctx: QuoteContext)(using DummyImplicit): X = { + def open[T1, T2, R, X](f: Expr[(T1, T2) => R])(content: (Expr[R], [t] => Expr[t] => (Expr[T1], Expr[T2]) => Expr[t]) => X)(using Quotes)(using DummyImplicit): X = { import qctx.reflect._ val (params, bodyExpr) = paramsAndBody[R](f) content(bodyExpr, [t] => (e: Expr[t]) => (v1: Expr[T1], v2: Expr[T2]) => bodyFn[t](Term.of(e), params, List(Term.of(v1), Term.of(v2))).asExpr.asInstanceOf[Expr[t]]) } - def open[T1, T2, T3, R, X](f: Expr[(T1, T2, T3) => R])(content: (Expr[R], [t] => Expr[t] => (Expr[T1], Expr[T2], Expr[T3]) => Expr[t]) => X)(using qctx: QuoteContext)(using DummyImplicit, DummyImplicit): X = { + def open[T1, T2, T3, R, X](f: Expr[(T1, T2, T3) => R])(content: (Expr[R], [t] => Expr[t] => (Expr[T1], Expr[T2], Expr[T3]) => Expr[t]) => X)(using Quotes)(using DummyImplicit, DummyImplicit): X = { import qctx.reflect._ val (params, bodyExpr) = paramsAndBody[R](f) content(bodyExpr, [t] => (e: Expr[t]) => (v1: Expr[T1], v2: Expr[T2], v3: Expr[T3]) => bodyFn[t](Term.of(e), params, List(Term.of(v1), Term.of(v2), Term.of(v3))).asExpr.asInstanceOf[Expr[t]]) } - private def paramsAndBody[R](using qctx: QuoteContext)(f: Expr[Any]): (List[qctx.reflect.ValDef], Expr[R]) = { + private def paramsAndBody[R](using Quotes)(f: Expr[Any]): (List[qctx.reflect.ValDef], Expr[R]) = { import qctx.reflect._ val Block(List(DefDef("$anonfun", Nil, List(params), _, Some(body))), Closure(Ident("$anonfun"), None)) = Term.of(f).etaExpand(Symbol.spliceOwner) (params, body.asExpr.asInstanceOf[Expr[R]]) } - private def bodyFn[t](using qctx: QuoteContext)(e: qctx.reflect.Term, params: List[qctx.reflect.ValDef], args: List[qctx.reflect.Term]): qctx.reflect.Term = { + private def bodyFn[t](using Quotes)(e: qctx.reflect.Term, params: List[qctx.reflect.ValDef], args: List[qctx.reflect.Term]): qctx.reflect.Term = { import qctx.reflect._ val map = params.map(_.symbol).zip(args).toMap new TreeMap { diff --git a/tests/run-macros/quote-matching-optimize-1/Macro_1.scala b/tests/run-macros/quote-matching-optimize-1/Macro_1.scala index 8bcdfcbd41c1..6909771f7f2f 100644 --- a/tests/run-macros/quote-matching-optimize-1/Macro_1.scala +++ b/tests/run-macros/quote-matching-optimize-1/Macro_1.scala @@ -4,7 +4,7 @@ object Macro { inline def optimize[T](inline x: T): Any = ${ Macro.impl('x) } - def impl[T: Type](x: Expr[T])(using QuoteContext): Expr[Any] = { + def impl[T: Type](x: Expr[T])(using Quotes): Expr[Any] = { def optimize(x: Expr[Any]): Expr[Any] = x match { case '{ type t; ($ls: List[`t`]).filter($f).filter($g) } => diff --git a/tests/run-macros/quote-matching-optimize-2/Macro_1.scala b/tests/run-macros/quote-matching-optimize-2/Macro_1.scala index 467138e82374..89f52713c106 100644 --- a/tests/run-macros/quote-matching-optimize-2/Macro_1.scala +++ b/tests/run-macros/quote-matching-optimize-2/Macro_1.scala @@ -4,7 +4,7 @@ object Macro { inline def optimize[T](inline x: T): Any = ${ Macro.impl('x) } - def impl[T: Type](x: Expr[T])(using QuoteContext): Expr[Any] = { + def impl[T: Type](x: Expr[T])(using Quotes): Expr[Any] = { def optimize(x: Expr[Any]): Expr[Any] = x match { case '{ ($ls: List[t]).filter($f).filter($g) } => diff --git a/tests/run-macros/quote-matching-optimize-3/Macro_1.scala b/tests/run-macros/quote-matching-optimize-3/Macro_1.scala index c414011fc8bb..7aefe30d20dd 100644 --- a/tests/run-macros/quote-matching-optimize-3/Macro_1.scala +++ b/tests/run-macros/quote-matching-optimize-3/Macro_1.scala @@ -4,7 +4,7 @@ object Macro { inline def optimize[T](inline x: T): Any = ${ Macro.impl('x) } - def impl[T: Type](x: Expr[T])(using QuoteContext): Expr[Any] = { + def impl[T: Type](x: Expr[T])(using Quotes): Expr[Any] = { def optimize(x: Expr[Any]): Expr[Any] = x match { case '{ ($ls: List[t]).filter($f).filter($g) } => diff --git a/tests/run-macros/quote-sep-comp-2/Macro_1.scala b/tests/run-macros/quote-sep-comp-2/Macro_1.scala index e9c94843dc9e..c23bd5f1884b 100644 --- a/tests/run-macros/quote-sep-comp-2/Macro_1.scala +++ b/tests/run-macros/quote-sep-comp-2/Macro_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macros { - def assertImpl(expr: Expr[Boolean])(using QuoteContext) = '{ println($expr) } + def assertImpl(expr: Expr[Boolean])(using Quotes) = '{ println($expr) } } diff --git a/tests/run-macros/quote-sep-comp/Macro_1.scala b/tests/run-macros/quote-sep-comp/Macro_1.scala index 33e9b0f2ed4e..611647b7d44a 100644 --- a/tests/run-macros/quote-sep-comp/Macro_1.scala +++ b/tests/run-macros/quote-sep-comp/Macro_1.scala @@ -1,5 +1,5 @@ import scala.quoted._ object Macros { inline def assert2(expr: => Boolean): Unit = ${ assertImpl('expr) } - def assertImpl(expr: Expr[Boolean])(using QuoteContext) = '{ println($expr) } + def assertImpl(expr: Expr[Boolean])(using Quotes) = '{ println($expr) } } diff --git a/tests/run-macros/quote-simple-macro/quoted_1.scala b/tests/run-macros/quote-simple-macro/quoted_1.scala index 18be3482e736..abb42b8c09c7 100644 --- a/tests/run-macros/quote-simple-macro/quoted_1.scala +++ b/tests/run-macros/quote-simple-macro/quoted_1.scala @@ -2,5 +2,5 @@ import scala.quoted._ object Macros { inline def foo(inline i: Int, dummy: Int, j: Int): Int = ${ bar('i, 'j) } - def bar(x: Expr[Int], y: Expr[Int]) (using QuoteContext): Expr[Int] = '{ ${Expr(x.unliftOrError)} + $y } + def bar(x: Expr[Int], y: Expr[Int]) (using Quotes): Expr[Int] = '{ ${Expr(x.unliftOrError)} + $y } } diff --git a/tests/run-macros/quote-toExprOfSeq/Macro_1.scala b/tests/run-macros/quote-toExprOfSeq/Macro_1.scala index 8afc6c8dc3d7..b9a7ae0a1396 100644 --- a/tests/run-macros/quote-toExprOfSeq/Macro_1.scala +++ b/tests/run-macros/quote-toExprOfSeq/Macro_1.scala @@ -2,6 +2,6 @@ import scala.quoted._ inline def seq = ${fooImpl} -def fooImpl(using qctx: QuoteContext) = { +def fooImpl(using Quotes) = { Expr.ofSeq(List('{1}, '{2}, '{3})) } diff --git a/tests/run-macros/quote-toExprOfTuple/Macro_1.scala b/tests/run-macros/quote-toExprOfTuple/Macro_1.scala index 6f82aeb7eba5..b67279d4ad74 100644 --- a/tests/run-macros/quote-toExprOfTuple/Macro_1.scala +++ b/tests/run-macros/quote-toExprOfTuple/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ object Macro { inline def t2[T0, T1](t0: T0, t1: T1): (T0, T1) = ${ impl2('{t0}, '{t1}) } - def impl2[T0: Type, T1: Type](t0: Expr[T0], t1: Expr[T1])(using qctx: QuoteContext) : Expr[(T0, T1)] = { + def impl2[T0: Type, T1: Type](t0: Expr[T0], t1: Expr[T1])(using Quotes) : Expr[(T0, T1)] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/quote-type-matcher-2/quoted_1.scala b/tests/run-macros/quote-type-matcher-2/quoted_1.scala index 6d132c8d06a6..4decd9a65ac4 100644 --- a/tests/run-macros/quote-type-matcher-2/quoted_1.scala +++ b/tests/run-macros/quote-type-matcher-2/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def lift[A]: String = ${ matchesExpr[A] } - private def matchesExpr[A](using tp: Type[A])(using QuoteContext): Expr[String] = { + private def matchesExpr[A](using tp: Type[A])(using Quotes): Expr[String] = { def lift[T](using tp: Type[T]): String = tp match { case '[Int] => "%Int%" case '[List[t]] => s"%List[${lift[t]}]%" diff --git a/tests/run-macros/quote-type-matcher/quoted_1.scala b/tests/run-macros/quote-type-matcher/quoted_1.scala index 0b8f4f0467ee..39a5f9b784e8 100644 --- a/tests/run-macros/quote-type-matcher/quoted_1.scala +++ b/tests/run-macros/quote-type-matcher/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def matches[A, B]: Unit = ${ matchesExpr[A, B] } - private def matchesExpr[A, B](using a: Type[A], b: Type[B])(using qctx: QuoteContext) : Expr[Unit] = { + private def matchesExpr[A, B](using a: Type[A], b: Type[B])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val res = qctx.asInstanceOf[scala.quoted.runtime.QuoteMatching].TypeMatch.unapply[Tuple, Tuple](a)(using b).map { tup => diff --git a/tests/run-macros/quote-unrolled-foreach/quoted_1.scala b/tests/run-macros/quote-unrolled-foreach/quoted_1.scala index 1bfab76dfc7a..0f217201b8d0 100644 --- a/tests/run-macros/quote-unrolled-foreach/quoted_1.scala +++ b/tests/run-macros/quote-unrolled-foreach/quoted_1.scala @@ -6,10 +6,10 @@ object Macro { inline def unrolledForeach(inline unrollSize: Int, seq: Array[Int])(inline f: Int => Unit): Unit = // or f: Int => Unit ${unrolledForeachImpl('unrollSize, 'seq, 'f)} - private def unrolledForeachImpl(unrollSizeExpr: Expr[Int], seq: Expr[Array[Int]], f: Expr[Int => Unit]) (using QuoteContext): Expr[Unit] = + private def unrolledForeachImpl(unrollSizeExpr: Expr[Int], seq: Expr[Array[Int]], f: Expr[Int => Unit]) (using Quotes): Expr[Unit] = unrolledForeachImpl(unrollSizeExpr.unliftOrError, seq, f) - private def unrolledForeachImpl(unrollSize: Int, seq: Expr[Array[Int]], f: Expr[Int => Unit])(using QuoteContext): Expr[Unit] = '{ + private def unrolledForeachImpl(unrollSize: Int, seq: Expr[Array[Int]], f: Expr[Int => Unit])(using Quotes): Expr[Unit] = '{ val size = $seq.length assert(size % (${Expr(unrollSize)}) == 0) // for simplicity of the implementation var i = 0 diff --git a/tests/run-macros/quote-whitebox/Macro_1.scala b/tests/run-macros/quote-whitebox/Macro_1.scala index 8b34d3346394..995d9c9870f0 100644 --- a/tests/run-macros/quote-whitebox/Macro_1.scala +++ b/tests/run-macros/quote-whitebox/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Macros { transparent inline def defaultOf(inline str: String): Any = ${ defaultOfImpl('str) } - def defaultOfImpl(str: Expr[String]) (using QuoteContext): Expr[Any] = str.unliftOrError match { + def defaultOfImpl(str: Expr[String]) (using Quotes): Expr[Any] = str.unliftOrError match { case "int" => '{1} case "string" => '{"a"} } diff --git a/tests/run-macros/quoted-expr-block/quoted_1.scala b/tests/run-macros/quoted-expr-block/quoted_1.scala index dd1b38f3ceba..6ffacf315399 100644 --- a/tests/run-macros/quoted-expr-block/quoted_1.scala +++ b/tests/run-macros/quoted-expr-block/quoted_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def replicate(inline times: Int, code: => Any) = ${replicateImpl('times, 'code)} -private def replicateImpl(times: Expr[Int], code: Expr[Any]) (using QuoteContext)= { +private def replicateImpl(times: Expr[Int], code: Expr[Any]) (using Quotes)= { @annotation.tailrec def loop(n: Int, accum: List[Expr[Any]]): List[Expr[Any]] = if (n > 0) loop(n - 1, code :: accum) else accum Expr.block(loop(times.unliftOrError, Nil), '{}) diff --git a/tests/run-macros/quoted-matching-docs-2/Macro_1.scala b/tests/run-macros/quoted-matching-docs-2/Macro_1.scala index 0a959892f53d..9bfcabe76155 100644 --- a/tests/run-macros/quoted-matching-docs-2/Macro_1.scala +++ b/tests/run-macros/quoted-matching-docs-2/Macro_1.scala @@ -6,10 +6,10 @@ def sum(args: Int*): Int = args.sum inline def showOptimize(inline arg: Int): String = ${ showOptimizeExpr('arg) } inline def optimize(inline arg: Int): Int = ${ optimizeExpr('arg) } -private def showOptimizeExpr(body: Expr[Int])(using QuoteContext): Expr[String] = +private def showOptimizeExpr(body: Expr[Int])(using Quotes): Expr[String] = Expr(optimizeExpr(body).show) -private def optimizeExpr(body: Expr[Int])(using QuoteContext): Expr[Int] = body match { +private def optimizeExpr(body: Expr[Int])(using Quotes): Expr[Int] = body match { // Match a call to sum without any arguments case '{ sum() } => Expr(0) // Match a call to sum with an argument $n of type Int. n will be the Expr[Int] representing the argument. @@ -19,7 +19,7 @@ private def optimizeExpr(body: Expr[Int])(using QuoteContext): Expr[Int] = body case body => body } -private def sumExpr(args1: Seq[Expr[Int]])(using QuoteContext): Expr[Int] = { +private def sumExpr(args1: Seq[Expr[Int]])(using Quotes): Expr[Int] = { def flatSumArgs(arg: Expr[Int]): Seq[Expr[Int]] = arg match { case '{ sum(${Varargs(subArgs)}: _*) } => subArgs.flatMap(flatSumArgs) case arg => Seq(arg) diff --git a/tests/run-macros/quoted-matching-docs/Macro_1.scala b/tests/run-macros/quoted-matching-docs/Macro_1.scala index ca2ead0c3b0e..bff9f5d59de7 100644 --- a/tests/run-macros/quoted-matching-docs/Macro_1.scala +++ b/tests/run-macros/quoted-matching-docs/Macro_1.scala @@ -4,10 +4,10 @@ inline def sum(args: Int*): Int = ${ sumExpr('args) } inline def sumShow(args: Int*): String = ${ sumExprShow('args) } -private def sumExprShow(argsExpr: Expr[Seq[Int]]) (using QuoteContext): Expr[String] = +private def sumExprShow(argsExpr: Expr[Seq[Int]]) (using Quotes): Expr[String] = Expr(sumExpr(argsExpr).show) -private def sumExpr(argsExpr: Expr[Seq[Int]])(using qctx: QuoteContext) : Expr[Int] = { +private def sumExpr(argsExpr: Expr[Seq[Int]])(using Quotes) : Expr[Int] = { UnsafeExpr.underlyingArgument(argsExpr) match { case Varargs(Consts(args)) => // args is of type Seq[Int] Expr(args.sum) // precompute result of sum @@ -27,7 +27,7 @@ private def sumExpr(argsExpr: Expr[Seq[Int]])(using qctx: QuoteContext) : Expr[I } object UnsafeExpr { - def underlyingArgument[T](expr: Expr[T])(using qctx: QuoteContext): Expr[T] = + def underlyingArgument[T](expr: Expr[T])(using Quotes): Expr[T] = import qctx.reflect._ Term.of(expr).underlyingArgument.asExpr.asInstanceOf[Expr[T]] } \ No newline at end of file diff --git a/tests/run-macros/quoted-pattern-open-expr-0/Macro_1.scala b/tests/run-macros/quoted-pattern-open-expr-0/Macro_1.scala index f62dbda107c2..9f5fdc044415 100644 --- a/tests/run-macros/quoted-pattern-open-expr-0/Macro_1.scala +++ b/tests/run-macros/quoted-pattern-open-expr-0/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def test(inline e: Int): String = ${testExpr('e)} -private def testExpr(e: Expr[Int])(using QuoteContext): Expr[String] = { +private def testExpr(e: Expr[Int])(using Quotes): Expr[String] = { e match { case '{ val y: Int = 4; $body(y): Int } => Expr("Matched open\n" + body.show) } diff --git a/tests/run-macros/quoted-pattern-open-expr-simple-eval/Macro_1.scala b/tests/run-macros/quoted-pattern-open-expr-simple-eval/Macro_1.scala index 88067261ffb4..1e98b10c7b88 100644 --- a/tests/run-macros/quoted-pattern-open-expr-simple-eval/Macro_1.scala +++ b/tests/run-macros/quoted-pattern-open-expr-simple-eval/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def eval(inline e: Int): Int = ${ evalExpr('e) } -private def evalExpr(using QuoteContext)(e: Expr[Int]): Expr[Int] = { +private def evalExpr(using Quotes)(e: Expr[Int]): Expr[Int] = { e match { case '{ val y: Int = $x; $body(y): Int } => evalExpr(Expr.betaReduce('{$body(${evalExpr(x)})})) diff --git a/tests/run-macros/quoted-pattern-open-expr/Macro_1.scala b/tests/run-macros/quoted-pattern-open-expr/Macro_1.scala index 5718c7cf2bf2..3416c9379ca5 100644 --- a/tests/run-macros/quoted-pattern-open-expr/Macro_1.scala +++ b/tests/run-macros/quoted-pattern-open-expr/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ inline def test(inline e: Int): String = ${testExpr('e)} -private def testExpr(e: Expr[Int])(using QuoteContext): Expr[String] = { +private def testExpr(e: Expr[Int])(using Quotes): Expr[String] = { e match { case '{ val y: Int = 4; $body } => Expr("Matched closed\n" + body.show) case '{ val y: Int = 4; $body(y): Int } => Expr("Matched open\n" + body.show) diff --git a/tests/run-macros/quoted-pattern-type/Macro_1.scala b/tests/run-macros/quoted-pattern-type/Macro_1.scala index 7fa9cf6b587f..9406a6f4cd04 100644 --- a/tests/run-macros/quoted-pattern-type/Macro_1.scala +++ b/tests/run-macros/quoted-pattern-type/Macro_1.scala @@ -4,7 +4,7 @@ object Lib { inline def foo[T](inline arg: T): T = ${ impl('arg) } - private def impl[T: Type](arg: Expr[T])(using QuoteContext): Expr[T] = { + private def impl[T: Type](arg: Expr[T])(using Quotes): Expr[T] = { arg match { case e @ '{ $x: Boolean } => '{ println("Boolean: " + $e); $e } case e @ '{ $x: Int } => '{ println("Int: " + $x); $x } diff --git a/tests/run-macros/refined-selectable-macro/Macro_1.scala b/tests/run-macros/refined-selectable-macro/Macro_1.scala index 2e8f13181a23..bab36e5eef13 100644 --- a/tests/run-macros/refined-selectable-macro/Macro_1.scala +++ b/tests/run-macros/refined-selectable-macro/Macro_1.scala @@ -14,7 +14,7 @@ object Macro { transparent inline def fromTuple[T <: Tuple](inline s: T): Any = ${ fromTupleImpl('s, '{ (x: Array[(String, Any)]) => fromUntypedTuple(x: _*) } ) } } - private def toTupleImpl(s: Expr[Selectable])(using qctx:QuoteContext) : Expr[Tuple] = { + private def toTupleImpl(s: Expr[Selectable])(using qctx:Quotes) : Expr[Tuple] = { import qctx.reflect._ val repr = Term.of(s).tpe.widenTermRefExpr.dealias @@ -48,7 +48,7 @@ object Macro { Expr.ofTupleFromSeq(ret) } - private def fromTupleImpl[T: Type](s: Expr[Tuple], newRecord: Expr[Array[(String, Any)] => T])(using qctx:QuoteContext) : Expr[Any] = { + private def fromTupleImpl[T: Type](s: Expr[Tuple], newRecord: Expr[Array[(String, Any)] => T])(using qctx:Quotes) : Expr[Any] = { import qctx.reflect._ val repr = Term.of(s).tpe.widenTermRefExpr.dealias diff --git a/tests/run-macros/refined-selectable-macro/Macro_2.scala b/tests/run-macros/refined-selectable-macro/Macro_2.scala index d2f610bc9705..4fffe4f17c05 100644 --- a/tests/run-macros/refined-selectable-macro/Macro_2.scala +++ b/tests/run-macros/refined-selectable-macro/Macro_2.scala @@ -16,7 +16,7 @@ object Macro2 { inline def apply[R <: Record](elems: (String, Any)*) : R = ${ applyImpl[R]('elems) } - def applyImpl[R <: Record: Type](elems: Expr[Seq[(String, Any)]])(using qctx: QuoteContext) = { + def applyImpl[R <: Record: Type](elems: Expr[Seq[(String, Any)]])(using Quotes) = { '{ new Record($elems:_*).asInstanceOf[R] } } diff --git a/tests/run-macros/reflect-dsl/assert_1.scala b/tests/run-macros/reflect-dsl/assert_1.scala index d3f05dc30cb1..3c53b6db79a2 100644 --- a/tests/run-macros/reflect-dsl/assert_1.scala +++ b/tests/run-macros/reflect-dsl/assert_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext): Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes): Expr[Unit] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/reflect-inline/assert_1.scala b/tests/run-macros/reflect-inline/assert_1.scala index a41e0bd7a81e..87ca1e499e58 100644 --- a/tests/run-macros/reflect-inline/assert_1.scala +++ b/tests/run-macros/reflect-inline/assert_1.scala @@ -4,13 +4,13 @@ object api { extension (inline x: String) inline def stripMargin: String = ${ stripImpl('x) } - private def stripImpl(x: Expr[String])(using qctx: QuoteContext): Expr[String] = + private def stripImpl(x: Expr[String])(using Quotes): Expr[String] = Expr(augmentString(x.unliftOrError).stripMargin) inline def typeChecks(inline x: String): Boolean = ${ typeChecksImpl('{scala.compiletime.testing.typeChecks(x)}) } - private def typeChecksImpl(b: Expr[Boolean])(using qctx: QuoteContext): Expr[Boolean] = { + private def typeChecksImpl(b: Expr[Boolean])(using Quotes): Expr[Boolean] = { if (b.unliftOrError) Expr(true) else Expr(false) } } diff --git a/tests/run-macros/reflect-lambda/assert_1.scala b/tests/run-macros/reflect-lambda/assert_1.scala index 5425d4b31b0f..81d0990ec916 100644 --- a/tests/run-macros/reflect-lambda/assert_1.scala +++ b/tests/run-macros/reflect-lambda/assert_1.scala @@ -4,7 +4,7 @@ object lib { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/reflect-pos-fun/assert_1.scala b/tests/run-macros/reflect-pos-fun/assert_1.scala index 8a9806db1831..8e70eb584c15 100644 --- a/tests/run-macros/reflect-pos-fun/assert_1.scala +++ b/tests/run-macros/reflect-pos-fun/assert_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition) } - def assertImpl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean])(using Quotes) : Expr[Unit] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/reflect-select-constructor/assert_1.scala b/tests/run-macros/reflect-select-constructor/assert_1.scala index 04dd75f6516b..6f0f26e8b71f 100644 --- a/tests/run-macros/reflect-select-constructor/assert_1.scala +++ b/tests/run-macros/reflect-select-constructor/assert_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/reflect-select-copy-2/assert_1.scala b/tests/run-macros/reflect-select-copy-2/assert_1.scala index adacd9010c0e..a57370378e7f 100644 --- a/tests/run-macros/reflect-select-copy-2/assert_1.scala +++ b/tests/run-macros/reflect-select-copy-2/assert_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/reflect-select-copy/assert_1.scala b/tests/run-macros/reflect-select-copy/assert_1.scala index 96071a7283d6..32faf78472df 100644 --- a/tests/run-macros/reflect-select-copy/assert_1.scala +++ b/tests/run-macros/reflect-select-copy/assert_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ Term.of(cond).underlyingArgument match { diff --git a/tests/run-macros/reflect-select-symbol-constructor/assert_1.scala b/tests/run-macros/reflect-select-symbol-constructor/assert_1.scala index 112fefdd9427..c14352d14ba3 100644 --- a/tests/run-macros/reflect-select-symbol-constructor/assert_1.scala +++ b/tests/run-macros/reflect-select-symbol-constructor/assert_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/reflect-select-value-class/assert_1.scala b/tests/run-macros/reflect-select-value-class/assert_1.scala index 0865f3e65b37..6f0f26e8b71f 100644 --- a/tests/run-macros/reflect-select-value-class/assert_1.scala +++ b/tests/run-macros/reflect-select-value-class/assert_1.scala @@ -4,7 +4,7 @@ object scalatest { inline def assert(condition: => Boolean): Unit = ${ assertImpl('condition, '{""}) } - def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using QuoteContext) : Expr[Unit] = { + def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ import util._ diff --git a/tests/run-macros/reflect-sourceCode/Macro_1.scala b/tests/run-macros/reflect-sourceCode/Macro_1.scala index 9d841c2b3677..89a9a1bab011 100644 --- a/tests/run-macros/reflect-sourceCode/Macro_1.scala +++ b/tests/run-macros/reflect-sourceCode/Macro_1.scala @@ -4,7 +4,7 @@ object api { extension [T](x: => T) inline def reflect: String = ${ reflImpl('x) } - private def reflImpl[T](x: Expr[T])(implicit qctx: QuoteContext): Expr[String] = { + private def reflImpl[T](x: Expr[T])(implicit qctx: Quotes): Expr[String] = { import qctx.reflect._ Expr(Term.of(x).pos.sourceCode) } diff --git a/tests/run-macros/reflect-typeChecks/assert_1.scala b/tests/run-macros/reflect-typeChecks/assert_1.scala index 22a0d58e7570..db8d4fe3dd31 100644 --- a/tests/run-macros/reflect-typeChecks/assert_1.scala +++ b/tests/run-macros/reflect-typeChecks/assert_1.scala @@ -5,7 +5,7 @@ object scalatest { inline def assertCompile(inline code: String): Unit = ${ assertImpl('code, '{compiletime.testing.typeChecks(code)}, true) } inline def assertNotCompile(inline code: String): Unit = ${ assertImpl('code, '{compiletime.testing.typeChecks(code)}, false) } - def assertImpl(code: Expr[String], actual: Expr[Boolean], expect: Boolean)(using qctx: QuoteContext) : Expr[Unit] = { + def assertImpl(code: Expr[String], actual: Expr[Boolean], expect: Boolean)(using Quotes) : Expr[Unit] = { '{ assert(${Expr(expect)} == $actual) } } } diff --git a/tests/run-macros/requiredSymbols/Macro_1.scala b/tests/run-macros/requiredSymbols/Macro_1.scala index 845c42229b0b..8e1b422ea601 100644 --- a/tests/run-macros/requiredSymbols/Macro_1.scala +++ b/tests/run-macros/requiredSymbols/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object Macro { inline def foo: String = ${ fooImpl } - def fooImpl(using qctx: QuoteContext) : Expr[String] = { + def fooImpl(using Quotes) : Expr[String] = { import qctx.reflect._ val list = List( Symbol.requiredPackage("java"), diff --git a/tests/run-macros/string-context-implicits/Macro_1.scala b/tests/run-macros/string-context-implicits/Macro_1.scala index 2052e7d2f6de..98c0bf918f7f 100644 --- a/tests/run-macros/string-context-implicits/Macro_1.scala +++ b/tests/run-macros/string-context-implicits/Macro_1.scala @@ -3,7 +3,7 @@ import scala.quoted._ extension (sc: StringContext) inline def showMe(inline args: Any*): String = ${ showMeExpr('sc, 'args) } -private def showMeExpr(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext): Expr[String] = { +private def showMeExpr(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes): Expr[String] = { argsExpr match { case Varargs(argExprs) => val argShowedExprs = argExprs.map { diff --git a/tests/run-macros/tasty-argument-tree-1/quoted_1.scala b/tests/run-macros/tasty-argument-tree-1/quoted_1.scala index 1135441552ad..c32e87d96e67 100644 --- a/tests/run-macros/tasty-argument-tree-1/quoted_1.scala +++ b/tests/run-macros/tasty-argument-tree-1/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def inspect[T](x: T): Unit = ${ impl('x) } - def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { + def impl[T](x: Expr[T])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(x) '{ diff --git a/tests/run-macros/tasty-construct-types/Macro_1.scala b/tests/run-macros/tasty-construct-types/Macro_1.scala index e64cffa2965f..4f13270504e9 100644 --- a/tests/run-macros/tasty-construct-types/Macro_1.scala +++ b/tests/run-macros/tasty-construct-types/Macro_1.scala @@ -10,7 +10,7 @@ object Macros { class TestAnnotation extends scala.annotation.Annotation - def theTestBlockImpl(using qctx : QuoteContext) : Expr[Unit] = { + def theTestBlockImpl(using qctx : Quotes) : Expr[Unit] = { import qctx.reflect._ val x1T = ConstantType(Constant.Int(1)) diff --git a/tests/run-macros/tasty-create-method-symbol/Macro_1.scala b/tests/run-macros/tasty-create-method-symbol/Macro_1.scala index fa5cafbceaaa..2a1717d0b09e 100644 --- a/tests/run-macros/tasty-create-method-symbol/Macro_1.scala +++ b/tests/run-macros/tasty-create-method-symbol/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def theTestBlock : Unit = ${ theTestBlockImpl } - def theTestBlockImpl(using qctx: QuoteContext) : Expr[Unit] = { + def theTestBlockImpl(using q: Quotes) : Expr[Unit] = { import qctx.reflect._ // simple smoke test diff --git a/tests/run-macros/tasty-dealias/quoted_1.scala b/tests/run-macros/tasty-dealias/quoted_1.scala index b57137d439e4..2a32e138df83 100644 --- a/tests/run-macros/tasty-dealias/quoted_1.scala +++ b/tests/run-macros/tasty-dealias/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def dealias[T]: String = ${ impl[T] } - def impl[T: Type](using qctx: QuoteContext) : Expr[String] = { + def impl[T: Type](using Quotes) : Expr[String] = { import qctx.reflect._ Expr(TypeRepr.of[T].dealias.show) } diff --git a/tests/run-macros/tasty-definitions-1/quoted_1.scala b/tests/run-macros/tasty-definitions-1/quoted_1.scala index 059aa45e4d66..a6ac7c0d0dd2 100644 --- a/tests/run-macros/tasty-definitions-1/quoted_1.scala +++ b/tests/run-macros/tasty-definitions-1/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def testDefinitions(): Unit = ${testDefinitionsImpl} - def testDefinitionsImpl(using qctx: QuoteContext) : Expr[Unit] = { + def testDefinitionsImpl(using Quotes) : Expr[Unit] = { import qctx.reflect._ val buff = List.newBuilder[String] diff --git a/tests/run-macros/tasty-eval/quoted_1.scala b/tests/run-macros/tasty-eval/quoted_1.scala index 0228042a4ce8..3429276d3dec 100644 --- a/tests/run-macros/tasty-eval/quoted_1.scala +++ b/tests/run-macros/tasty-eval/quoted_1.scala @@ -5,18 +5,18 @@ object Macros { implicit inline def foo(i: Int): String = ${ impl('i) } - def impl(i: Expr[Int]) (using QuoteContext): Expr[String] = { + def impl(i: Expr[Int]) (using Quotes): Expr[String] = { Expr(value(i).toString) } - inline implicit def value[X](e: Expr[X])(implicit qctx: QuoteContext, ev: Valuable[X]): Option[X] = ev.value(e) + inline implicit def value[X](e: Expr[X])(implicit qctx: Quotes, ev: Valuable[X]): Option[X] = ev.value(e) trait Valuable[X] { - def value(e: Expr[X]) (using QuoteContext): Option[X] + def value(e: Expr[X]) (using Quotes): Option[X] } implicit def intIsEvalable: Valuable[Int] = new Valuable[Int] { - override def value(e: Expr[Int])(using qctx: QuoteContext) : Option[Int] = { + override def value(e: Expr[Int])(using Quotes) : Option[Int] = { import qctx.reflect._ Term.of(e).tpe match { diff --git a/tests/run-macros/tasty-extractors-1/quoted_1.scala b/tests/run-macros/tasty-extractors-1/quoted_1.scala index 10dde3d73572..699461a6d871 100644 --- a/tests/run-macros/tasty-extractors-1/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-1/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { implicit inline def printTree[T](inline x: T): Unit = ${ impl('x) } - def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { + def impl[T](x: Expr[T])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(x) diff --git a/tests/run-macros/tasty-extractors-2/quoted_1.scala b/tests/run-macros/tasty-extractors-2/quoted_1.scala index 325e5c13e4e9..6ae037c6d03a 100644 --- a/tests/run-macros/tasty-extractors-2/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-2/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { implicit inline def printTree[T](inline x: T): Unit = ${ impl('x) } - def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { + def impl[T](x: Expr[T])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(x) diff --git a/tests/run-macros/tasty-extractors-3/quoted_1.scala b/tests/run-macros/tasty-extractors-3/quoted_1.scala index a641c8583db1..0b9fe58137dc 100644 --- a/tests/run-macros/tasty-extractors-3/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-3/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { implicit inline def printTypes[T](inline x: T): Unit = ${impl('x)} - def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { + def impl[T](x: Expr[T])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val buff = new StringBuilder diff --git a/tests/run-macros/tasty-extractors-constants-1/quoted_1.scala b/tests/run-macros/tasty-extractors-constants-1/quoted_1.scala index b3b6926a0ed0..7bd6caecd85e 100644 --- a/tests/run-macros/tasty-extractors-constants-1/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-constants-1/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { implicit inline def testMacro: Unit = ${impl} - def impl(using QuoteContext): Expr[Unit] = { + def impl(using Quotes): Expr[Unit] = { val buff = new StringBuilder def stagedPrintln(x: Any): Unit = buff append java.util.Objects.toString(x) append "\n" diff --git a/tests/run-macros/tasty-extractors-types/quoted_1.scala b/tests/run-macros/tasty-extractors-types/quoted_1.scala index eba636d98416..e1952096b2ac 100644 --- a/tests/run-macros/tasty-extractors-types/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-types/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { implicit inline def printType[T]: Unit = ${ impl[T] } - def impl[T: Type](using qctx: QuoteContext) : Expr[Unit] = { + def impl[T: Type](using Quotes) : Expr[Unit] = { import qctx.reflect._ '{ println(${Expr(TypeTree.of[T].showExtractors)}) diff --git a/tests/run-macros/tasty-getfile-implicit-by-name-fun-context/Macro_1.scala b/tests/run-macros/tasty-getfile-implicit-by-name-fun-context/Macro_1.scala index 3db59d7d0f97..1f250d309c23 100644 --- a/tests/run-macros/tasty-getfile-implicit-by-name-fun-context/Macro_1.scala +++ b/tests/run-macros/tasty-getfile-implicit-by-name-fun-context/Macro_1.scala @@ -2,7 +2,7 @@ import scala.quoted._ object SourceFiles { - type Macro[X] = (=> QuoteContext) ?=> Expr[X] + type Macro[X] = (=> Quotes) ?=> Expr[X] implicit inline def getThisFile: String = ${getThisFileImpl} diff --git a/tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala b/tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala index 7de162699682..6f1c67ad1798 100644 --- a/tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala +++ b/tests/run-macros/tasty-getfile-implicit-fun-context/Macro_1.scala @@ -2,8 +2,8 @@ import scala.quoted._ object SourceFiles { - type Macro[X] = QuoteContext ?=> Expr[X] - def tastyContext(using qctx: QuoteContext): QuoteContext = qctx + type Macro[X] = Quotes ?=> Expr[X] + def tastyContext(using Quotes): Quotes = qctx implicit inline def getThisFile: String = ${getThisFileImpl} diff --git a/tests/run-macros/tasty-getfile/Macro_1.scala b/tests/run-macros/tasty-getfile/Macro_1.scala index 04b476695ce5..0130db484015 100644 --- a/tests/run-macros/tasty-getfile/Macro_1.scala +++ b/tests/run-macros/tasty-getfile/Macro_1.scala @@ -6,7 +6,7 @@ object SourceFiles { implicit inline def getThisFile: String = ${getThisFileImpl} - private def getThisFileImpl(using qctx: QuoteContext) : Expr[String] = + private def getThisFileImpl(using Quotes) : Expr[String] = Expr(qctx.reflect.Source.path.getFileName.toString) } diff --git a/tests/run-macros/tasty-implicit-fun-context-2/Macro_1.scala b/tests/run-macros/tasty-implicit-fun-context-2/Macro_1.scala index 5b252adf07bb..ab3a214605db 100644 --- a/tests/run-macros/tasty-implicit-fun-context-2/Macro_1.scala +++ b/tests/run-macros/tasty-implicit-fun-context-2/Macro_1.scala @@ -2,13 +2,13 @@ import scala.quoted._ object Foo { - type Macro[X] = QuoteContext ?=> Expr[X] - type Tastier[X] = QuoteContext ?=> X + type Macro[X] = Quotes ?=> Expr[X] + type Tastier[X] = Quotes ?=> X implicit inline def foo: String = ${fooImpl} - def fooImpl(using QuoteContext): QuoteContext ?=> Tastier[QuoteContext ?=> Macro[String]] = { + def fooImpl(using Quotes): Quotes ?=> Tastier[Quotes ?=> Macro[String]] = { '{"abc"} } diff --git a/tests/run-macros/tasty-indexed-map/quoted_1.scala b/tests/run-macros/tasty-indexed-map/quoted_1.scala index af49b7fc10ff..9ccbbf3300f0 100644 --- a/tests/run-macros/tasty-indexed-map/quoted_1.scala +++ b/tests/run-macros/tasty-indexed-map/quoted_1.scala @@ -24,7 +24,7 @@ object Index { implicit inline def succ[K, H, T](implicit prev: => Index[K, T]): Index[K, (H, T)] = ${succImpl[K, H, T]} - def succImpl[K, H, T](implicit qctx: QuoteContext, k: Type[K], h: Type[H], t: Type[T]): Expr[Index[K, (H, T)]] = { + def succImpl[K, H, T](implicit qctx: Quotes, k: Type[K], h: Type[H], t: Type[T]): Expr[Index[K, (H, T)]] = { import qctx.reflect._ def name(tp: TypeRepr): String = tp match { diff --git a/tests/run-macros/tasty-interpolation-1/Macro.scala b/tests/run-macros/tasty-interpolation-1/Macro.scala index 56f5f8c2f9d2..404ce9e629c9 100644 --- a/tests/run-macros/tasty-interpolation-1/Macro.scala +++ b/tests/run-macros/tasty-interpolation-1/Macro.scala @@ -14,24 +14,24 @@ object Macro { } object SIntepolator extends MacroStringInterpolator[String] { - protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using QuoteContext): Expr[String] = + protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using Quotes): Expr[String] = '{(${Expr(strCtx)}).s(${Expr.ofList(args)}: _*)} } object RawIntepolator extends MacroStringInterpolator[String] { - protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using QuoteContext): Expr[String] = + protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using Quotes): Expr[String] = '{(${Expr(strCtx)}).raw(${Expr.ofList(args)}: _*)} } object FooIntepolator extends MacroStringInterpolator[String] { - protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using QuoteContext): Expr[String] = + protected def interpolate(strCtx: StringContext, args: List[Expr[Any]]) (using Quotes): Expr[String] = '{(${Expr(strCtx)}).s(${Expr.ofList(args.map(_ => '{"foo"}))}: _*)} } // TODO put this class in the stdlib or separate project? abstract class MacroStringInterpolator[T] { - final def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[T] = { + final def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes) : Expr[T] = { try interpolate(strCtxExpr, argsExpr) catch { case ex: NotStaticlyKnownError => @@ -49,12 +49,12 @@ abstract class MacroStringInterpolator[T] { } } - protected def interpolate(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]]) (using QuoteContext): Expr[T] = + protected def interpolate(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]]) (using Quotes): Expr[T] = interpolate(getStaticStringContext(strCtxExpr), getArgsList(argsExpr)) - protected def interpolate(strCtx: StringContext, argExprs: List[Expr[Any]]) (using QuoteContext): Expr[T] + protected def interpolate(strCtx: StringContext, argExprs: List[Expr[Any]]) (using Quotes): Expr[T] - protected def getStaticStringContext(strCtxExpr: Expr[StringContext])(using qctx: QuoteContext) : StringContext = { + protected def getStaticStringContext(strCtxExpr: Expr[StringContext])(using Quotes) : StringContext = { import qctx.reflect._ Term.of(strCtxExpr).underlyingArgument match { case Select(Typed(Apply(_, List(Apply(_, List(Typed(Repeated(strCtxArgTrees, _), Inferred()))))), _), _) => @@ -68,7 +68,7 @@ abstract class MacroStringInterpolator[T] { } } - protected def getArgsList(argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : List[Expr[Any]] = { + protected def getArgsList(argsExpr: Expr[Seq[Any]])(using Quotes) : List[Expr[Any]] = { import qctx.reflect._ Term.of(argsExpr).underlyingArgument match { case Typed(Repeated(args, _), _) => args.map(_.asExpr) diff --git a/tests/run-macros/tasty-linenumber-2/quoted_1.scala b/tests/run-macros/tasty-linenumber-2/quoted_1.scala index e2cd171d6a16..f0a7c92ae1cb 100644 --- a/tests/run-macros/tasty-linenumber-2/quoted_1.scala +++ b/tests/run-macros/tasty-linenumber-2/quoted_1.scala @@ -8,7 +8,7 @@ object LineNumber { implicit inline def line: LineNumber = ${lineImpl} - def lineImpl(using QuoteContext) : Expr[LineNumber] = { + def lineImpl(using Quotes) : Expr[LineNumber] = { import qctx.reflect._ '{new LineNumber(${Expr(Position.ofMacroExpansion.startLine)})} } diff --git a/tests/run-macros/tasty-linenumber/quoted_1.scala b/tests/run-macros/tasty-linenumber/quoted_1.scala index 4cb719de3a16..6d06c1983b36 100644 --- a/tests/run-macros/tasty-linenumber/quoted_1.scala +++ b/tests/run-macros/tasty-linenumber/quoted_1.scala @@ -9,7 +9,7 @@ object LineNumber { implicit inline def line[T >: Unit <: Unit]: LineNumber = ${lineImpl(Type.of[T])} - def lineImpl(x: Type[Unit])(using QuoteContext) : Expr[LineNumber] = { + def lineImpl(x: Type[Unit])(using Quotes) : Expr[LineNumber] = { import qctx.reflect._ '{new LineNumber(${Expr(Position.ofMacroExpansion.startLine)})} } diff --git a/tests/run-macros/tasty-location/quoted_1.scala b/tests/run-macros/tasty-location/quoted_1.scala index 2ed4d11eab8a..7564fbe1d2b4 100644 --- a/tests/run-macros/tasty-location/quoted_1.scala +++ b/tests/run-macros/tasty-location/quoted_1.scala @@ -6,7 +6,7 @@ object Location { implicit inline def location: Location = ${impl} - def impl(using qctx: QuoteContext) : Expr[Location] = { + def impl(using Quotes) : Expr[Location] = { import qctx.reflect._ def listOwnerNames(sym: Symbol, acc: List[String]): List[String] = diff --git a/tests/run-macros/tasty-macro-assert/quoted_1.scala b/tests/run-macros/tasty-macro-assert/quoted_1.scala index a59e1bb9da5f..e301baa684bb 100644 --- a/tests/run-macros/tasty-macro-assert/quoted_1.scala +++ b/tests/run-macros/tasty-macro-assert/quoted_1.scala @@ -12,7 +12,7 @@ object Asserts { inline def macroAssert(inline cond: Boolean): Unit = ${impl('cond)} - def impl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { + def impl(cond: Expr[Boolean])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val tree = Term.of(cond) diff --git a/tests/run-macros/tasty-macro-const/quoted_1.scala b/tests/run-macros/tasty-macro-const/quoted_1.scala index 5be05dac141e..0f1fb0c8f045 100644 --- a/tests/run-macros/tasty-macro-const/quoted_1.scala +++ b/tests/run-macros/tasty-macro-const/quoted_1.scala @@ -4,7 +4,7 @@ object Macros { inline def natConst(x: Int): Int = ${ natConstImpl('x) } - def natConstImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[Int] = { + def natConstImpl(x: Expr[Int])(using Quotes) : Expr[Int] = { import qctx.reflect._ val xTree: Term = Term.of(x) xTree match { diff --git a/tests/run-macros/tasty-macro-positions/quoted_1.scala b/tests/run-macros/tasty-macro-positions/quoted_1.scala index 7fe22585c2a4..8f3ac0bc6ff1 100644 --- a/tests/run-macros/tasty-macro-positions/quoted_1.scala +++ b/tests/run-macros/tasty-macro-positions/quoted_1.scala @@ -8,7 +8,7 @@ object Macros { inline def fun3[T]: Unit = ${ impl2(using Type.of[T]) } - def impl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { + def impl(x: Expr[Any])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val pos = Term.of(x).underlyingArgument.pos val code = Term.of(x).underlyingArgument.show @@ -18,7 +18,7 @@ object Macros { } } - def impl2[T](using x: Type[T])(using qctx: QuoteContext) : Expr[Unit] = { + def impl2[T](using x: Type[T])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val pos = TypeTree.of[T].pos val code = TypeTree.of[T].show @@ -28,8 +28,8 @@ object Macros { } } - def posStr(qctx: QuoteContext)(pos: qctx.reflect.Position): Expr[String] = { - given QuoteContext = qctx + def posStr(qctx: Quotes)(pos: qctx.reflect.Position): Expr[String] = { + given Quotes = qctx import qctx.reflect._ Expr(s"${pos.sourceFile.jpath.getFileName.toString}:[${pos.start}..${pos.end}]") } diff --git a/tests/run-macros/tasty-original-source/Macros_1.scala b/tests/run-macros/tasty-original-source/Macros_1.scala index cc0d9a44f5b5..88c6ef92160f 100644 --- a/tests/run-macros/tasty-original-source/Macros_1.scala +++ b/tests/run-macros/tasty-original-source/Macros_1.scala @@ -4,7 +4,7 @@ object Macros { implicit inline def withSource(arg: Any): (String, Any) = ${ impl('arg) } - private def impl(arg: Expr[Any])(using qctx: QuoteContext) : Expr[(String, Any)] = { + private def impl(arg: Expr[Any])(using Quotes) : Expr[(String, Any)] = { import qctx.reflect._ val source = Expr(Term.of(arg).underlyingArgument.pos.sourceCode.toString) '{Tuple2($source, $arg)} diff --git a/tests/run-macros/tasty-overload-secondargs/Macro_1.scala b/tests/run-macros/tasty-overload-secondargs/Macro_1.scala index f8905eec6630..7ddfc7c548a4 100644 --- a/tests/run-macros/tasty-overload-secondargs/Macro_1.scala +++ b/tests/run-macros/tasty-overload-secondargs/Macro_1.scala @@ -21,7 +21,7 @@ object Macro: mThenImpl[A,B,PartialFunction[A,B],Option[B]]('x) } - def mThenImpl[A:Type, B:Type, S<:(A=>B) :Type, R:Type](x:Expr[S])(using qctx: QuoteContext):Expr[R]= + def mThenImpl[A:Type, B:Type, S<:(A=>B) :Type, R:Type](x:Expr[S])(using Quotes):Expr[R]= import qctx.reflect._ val fun = Term.of('{X}) val returnType = TypeRepr.of[(S) => ?] diff --git a/tests/run-macros/tasty-positioned/quoted_1.scala b/tests/run-macros/tasty-positioned/quoted_1.scala index 73ab5be5dd68..cee87f728ed6 100644 --- a/tests/run-macros/tasty-positioned/quoted_1.scala +++ b/tests/run-macros/tasty-positioned/quoted_1.scala @@ -9,7 +9,7 @@ object Positioned { implicit inline def apply[T](x: => T): Positioned[T] = ${impl('x)} - def impl[T](x: Expr[T])(implicit ev: Type[T], qctx: QuoteContext): Expr[Positioned[T]] = { + def impl[T](x: Expr[T])(implicit ev: Type[T], qctx: Quotes): Expr[Positioned[T]] = { import qctx.reflect.{Position => Pos, _} val pos = Pos.ofMacroExpansion diff --git a/tests/run-macros/tasty-seal-method/quoted_1.scala b/tests/run-macros/tasty-seal-method/quoted_1.scala index e9e10920b756..60c6876e41ee 100644 --- a/tests/run-macros/tasty-seal-method/quoted_1.scala +++ b/tests/run-macros/tasty-seal-method/quoted_1.scala @@ -6,7 +6,7 @@ object Asserts { ${ zeroLastArgsImpl('x) } /** Replaces last argument list by 0s */ - def zeroLastArgsImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[Int] = { + def zeroLastArgsImpl(x: Expr[Int])(using Quotes) : Expr[Int] = { import qctx.reflect._ // For simplicity assumes that all parameters are Int and parameter lists have no more than 3 elements Term.of(x).underlyingArgument match { @@ -28,7 +28,7 @@ object Asserts { ${ zeroAllArgsImpl('x) } /** Replaces all argument list by 0s */ - def zeroAllArgsImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[Int] = { + def zeroAllArgsImpl(x: Expr[Int])(using Quotes) : Expr[Int] = { import qctx.reflect._ // For simplicity assumes that all parameters are Int and parameter lists have no more than 3 elements def rec(term: Term): Term = term match { diff --git a/tests/run-macros/tasty-simplified/quoted_1.scala b/tests/run-macros/tasty-simplified/quoted_1.scala index da33cc8612fc..2af5aa146287 100644 --- a/tests/run-macros/tasty-simplified/quoted_1.scala +++ b/tests/run-macros/tasty-simplified/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { inline def simplified[T <: Tuple]: Seq[String] = ${ impl[T] } - def impl[T: Type](using qctx: QuoteContext) : Expr[Seq[String]] = { + def impl[T: Type](using Quotes) : Expr[Seq[String]] = { import qctx.reflect._ def unpackTuple(tp: TypeRepr): List[TypeRepr] = { diff --git a/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala b/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala index f05a656d1533..955685925e7b 100644 --- a/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala +++ b/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala @@ -18,7 +18,7 @@ object TestFooErrors { // Defined in tests object Macro { - def foo(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext): Expr[String] = { + def foo(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes): Expr[String] = { (sc, argsExpr) match { case ('{ StringContext(${Varargs(parts)}: _*) }, Varargs(args)) => val reporter = new Reporter { @@ -31,7 +31,7 @@ object Macro { } } - def fooErrors(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext): Expr[List[(Int, Int, Int, String)]] = { + def fooErrors(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes): Expr[List[(Int, Int, Int, String)]] = { (sc, argsExpr) match { case ('{ StringContext(${Varargs(parts)}: _*) }, Varargs(args)) => val errors = List.newBuilder[Expr[(Int, Int, Int, String)]] @@ -50,7 +50,7 @@ object Macro { } - private def fooCore(parts: Seq[Expr[String]], args: Seq[Expr[Any]], reporter: Reporter)(using QuoteContext): Expr[String] = { + private def fooCore(parts: Seq[Expr[String]], args: Seq[Expr[Any]], reporter: Reporter)(using Quotes): Expr[String] = { for ((part, idx) <- parts.zipWithIndex) { val Const(v: String) = part if (v.contains("#")) diff --git a/tests/run-macros/tasty-subtyping/quoted_1.scala b/tests/run-macros/tasty-subtyping/quoted_1.scala index bfbb9fd74892..7f76bfbb167d 100644 --- a/tests/run-macros/tasty-subtyping/quoted_1.scala +++ b/tests/run-macros/tasty-subtyping/quoted_1.scala @@ -8,13 +8,13 @@ object Macros { inline def isSubTypeOf[T, U]: Boolean = ${isSubTypeOfImpl[T, U]} - def isTypeEqualImpl[T: Type, U: Type](using QuoteContext) : Expr[Boolean] = { + def isTypeEqualImpl[T: Type, U: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ val isTypeEqual = TypeRepr.of[T] =:= TypeRepr.of[U] Expr(isTypeEqual) } - def isSubTypeOfImpl[T: Type, U: Type](using QuoteContext) : Expr[Boolean] = { + def isSubTypeOfImpl[T: Type, U: Type](using Quotes) : Expr[Boolean] = { import qctx.reflect._ val isTypeEqual = TypeRepr.of[T] <:< TypeRepr.of[U] Expr(isTypeEqual) diff --git a/tests/run-macros/tasty-tree-map/quoted_1.scala b/tests/run-macros/tasty-tree-map/quoted_1.scala index b4484fd983d4..fe7e8982ffe1 100644 --- a/tests/run-macros/tasty-tree-map/quoted_1.scala +++ b/tests/run-macros/tasty-tree-map/quoted_1.scala @@ -4,7 +4,7 @@ object Macros: implicit inline def identityMaped[T](x: => T): T = ${ MacrosImpl.impl('x) } object MacrosImpl: - def impl[T: Type](x: Expr[T])(using qctx: QuoteContext) : Expr[T] = { + def impl[T: Type](x: Expr[T])(using Quotes) : Expr[T] = { import qctx.reflect._ val identityMap = new TreeMap { } val transformed = identityMap.transformTerm(Term.of(x))(Symbol.spliceOwner).asExprOf[T] diff --git a/tests/run-macros/tasty-typeof/Macro_1.scala b/tests/run-macros/tasty-typeof/Macro_1.scala index 036cf3f6e65c..dd6210abda49 100644 --- a/tests/run-macros/tasty-typeof/Macro_1.scala +++ b/tests/run-macros/tasty-typeof/Macro_1.scala @@ -4,7 +4,7 @@ object Macros { inline def testTypeOf(): Unit = ${ testTypeOfImpl } - private def testTypeOfImpl(using qctx: QuoteContext) : Expr[Unit] = { + private def testTypeOfImpl(using Quotes) : Expr[Unit] = { import qctx.reflect._ '{ assert(${Expr(TypeRepr.of[Unit] =:= TypeRepr.of[Unit])}, "Unit") diff --git a/tests/run-macros/tasty-unsafe-let/quoted_1.scala b/tests/run-macros/tasty-unsafe-let/quoted_1.scala index da29c8b5d172..f83e569d43f7 100644 --- a/tests/run-macros/tasty-unsafe-let/quoted_1.scala +++ b/tests/run-macros/tasty-unsafe-let/quoted_1.scala @@ -5,7 +5,7 @@ object Macros { inline def let[T](rhs: => T)(inline body: T => Unit): Unit = ${ impl('rhs, 'body) } - private def impl[T: Type](rhs: Expr[T], body: Expr[T => Unit])(using qctx: QuoteContext) : Expr[Unit] = { + private def impl[T: Type](rhs: Expr[T], body: Expr[T => Unit])(using Quotes) : Expr[Unit] = { import qctx.reflect._ val rhsTerm = Term.of(rhs) diff --git a/tests/run-macros/type-show/Macro_1.scala b/tests/run-macros/type-show/Macro_1.scala index 4be7ec722dfd..c20f592dbfef 100644 --- a/tests/run-macros/type-show/Macro_1.scala +++ b/tests/run-macros/type-show/Macro_1.scala @@ -2,6 +2,6 @@ import scala.quoted._ object TypeToolbox { inline def show[A]: String = ${ showImpl[A] } - private def showImpl[A: Type](using qctx: QuoteContext) : Expr[String] = + private def showImpl[A: Type](using Quotes) : Expr[String] = Expr(Type.show[A]) } diff --git a/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala index bfa24ab3b7f5..f34846902b73 100644 --- a/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala @@ -12,7 +12,7 @@ object XmlQuote { } def impl(receiver: Expr[SCOps], args: Expr[Seq[Any]]) - (using qctx: QuoteContext) : Expr[Xml] = { + (using Quotes) : Expr[Xml] = { import qctx.reflect._ // for debugging purpose diff --git a/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala index cf9d3c6866e3..f5e7ff5a3ce1 100644 --- a/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala @@ -13,7 +13,7 @@ object XmlQuote { } implicit inline def SCOps(ctx: => StringContext): SCOps = new SCOps(ctx) - def impl(receiver: Expr[SCOps], args: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[Xml] = { + def impl(receiver: Expr[SCOps], args: Expr[Seq[Any]])(using Quotes) : Expr[Xml] = { import qctx.reflect._ // for debugging purpose diff --git a/tests/run-macros/xml-interpolation-3/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-3/XmlQuote_1.scala index c022b3146a0d..d96d63972613 100644 --- a/tests/run-macros/xml-interpolation-3/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-3/XmlQuote_1.scala @@ -11,7 +11,7 @@ object XmlQuote { ${XmlQuote.impl('ctx, 'args)} } - def impl(receiver: Expr[StringContext], args: Expr[Seq[Any]])(using QuoteContext): Expr[Xml] = { + def impl(receiver: Expr[StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[Xml] = { val string = receiver.unliftOrError.parts.mkString("??") '{new Xml(${Expr(string)}, $args.toList)} } diff --git a/tests/run-macros/xml-interpolation-4/Macros_1.scala b/tests/run-macros/xml-interpolation-4/Macros_1.scala index ff73ca92c468..6eba65baba00 100644 --- a/tests/run-macros/xml-interpolation-4/Macros_1.scala +++ b/tests/run-macros/xml-interpolation-4/Macros_1.scala @@ -9,7 +9,7 @@ object XmlQuote { ${XmlQuote.impl('ctx, 'args, '{implicitly[Scope]})} } - private def impl(receiver: Expr[StringContext], args: Expr[Seq[Scope ?=> Any]], scope: Expr[Scope])(using QuoteContext): Expr[String] = '{ + private def impl(receiver: Expr[StringContext], args: Expr[Seq[Scope ?=> Any]], scope: Expr[Scope])(using Quotes): Expr[String] = '{ $receiver.s($args.map(_(using $scope.inner)): _*) } } diff --git a/tests/run-macros/xml-interpolation-5/Macros_1.scala b/tests/run-macros/xml-interpolation-5/Macros_1.scala index 6b4895ed087d..14eba46b3e1a 100644 --- a/tests/run-macros/xml-interpolation-5/Macros_1.scala +++ b/tests/run-macros/xml-interpolation-5/Macros_1.scala @@ -24,7 +24,7 @@ object XmlQuote { // extension (inline ctx: SCOps.StringContext) inline def unapplySeq(...): Xml = ... - def impl(receiver: Expr[SCOps.StringContext], args: Expr[Seq[Any]])(using QuoteContext): Expr[Xml] = { + def impl(receiver: Expr[SCOps.StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[Xml] = { val string = receiver match { case '{ SCOps(${Unlifted(sc)}) } => Expr(sc.parts.mkString("??")) } diff --git a/tests/run-macros/xml-interpolation-6/Macros_1.scala b/tests/run-macros/xml-interpolation-6/Macros_1.scala index 11b837c70bd1..0810b30058e4 100644 --- a/tests/run-macros/xml-interpolation-6/Macros_1.scala +++ b/tests/run-macros/xml-interpolation-6/Macros_1.scala @@ -24,7 +24,7 @@ object XmlQuote { // extension (inline ctx: SCOps.StringContext) inline def unapplySeq(...): Xml = ... - def impl(receiver: Expr[SCOps.StringContext], args: Expr[Seq[Any]])(using QuoteContext): Expr[Xml] = { + def impl(receiver: Expr[SCOps.StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[Xml] = { val string = receiver match { case '{ SCOps(${Unlifted(sc)}): SCOps.StringContext } => sc.parts.mkString("??") } diff --git a/tests/run-macros/xml-interpolation-7/Macros_1.scala b/tests/run-macros/xml-interpolation-7/Macros_1.scala index 5cf4e3e3ee41..19e2b5654898 100644 --- a/tests/run-macros/xml-interpolation-7/Macros_1.scala +++ b/tests/run-macros/xml-interpolation-7/Macros_1.scala @@ -24,7 +24,7 @@ object XmlQuote { // extension (inline ctx: SCOps.StringContext) inline def unapplySeq(...): Xml = ... - def impl(receiver: Expr[XMLOps.StringContext], args: Expr[Seq[Any]])(using QuoteContext): Expr[Xml] = { + def impl(receiver: Expr[XMLOps.StringContext], args: Expr[Seq[Any]])(using Quotes): Expr[Xml] = { val string = receiver match { case '{ XMLOps.xml(${Unlifted(sc)}) } => sc.parts.mkString("??") } diff --git a/tests/run-staging/abstract-int-quote.scala b/tests/run-staging/abstract-int-quote.scala index 00411042cbaf..dbff291d8051 100644 --- a/tests/run-staging/abstract-int-quote.scala +++ b/tests/run-staging/abstract-int-quote.scala @@ -6,11 +6,11 @@ object Test: given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = - def reduce[T: Type](using QuoteContext)(succ: Expr[T] => Expr[T], zero: Expr[T]): Expr[T] = '{ + def reduce[T: Type](using Quotes)(succ: Expr[T] => Expr[T], zero: Expr[T]): Expr[T] = '{ var z = $zero ${ succ('z) } } - def resCode2(using QuoteContext): Expr[Int] = + def resCode2(using Quotes): Expr[Int] = reduce[Int](x => '{$x + 1}, '{0}) - println(withQuoteContext(resCode2.show)) + println(withQuotes(resCode2.show)) diff --git a/tests/run-staging/expr-matches.scala b/tests/run-staging/expr-matches.scala index 2f0255fbadfb..cbfc6275108a 100644 --- a/tests/run-staging/expr-matches.scala +++ b/tests/run-staging/expr-matches.scala @@ -4,7 +4,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { assert('{1} matches '{1}) assert('{println("foo")} matches '{println("foo")}) assert('{println("foo")} matches '{println(${Expr("foo")})}) diff --git a/tests/run-staging/i3823-b.scala b/tests/run-staging/i3823-b.scala index 3946fde75e99..ce8888dae36d 100644 --- a/tests/run-staging/i3823-b.scala +++ b/tests/run-staging/i3823-b.scala @@ -2,7 +2,7 @@ import scala.quoted._ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { def f[T](x: Expr[T])(implicit t: Type[T]) = '{ val z: t.Underlying = $x } diff --git a/tests/run-staging/i3823-c.scala b/tests/run-staging/i3823-c.scala index 5be94d95d678..1bdfacadcfc4 100644 --- a/tests/run-staging/i3823-c.scala +++ b/tests/run-staging/i3823-c.scala @@ -2,7 +2,7 @@ import scala.quoted._ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { def f[T](x: Expr[T])(implicit t: Type[T]) = '{ val z = $x } diff --git a/tests/run-staging/i3823.scala b/tests/run-staging/i3823.scala index 283dd0364383..0ef706539da1 100644 --- a/tests/run-staging/i3823.scala +++ b/tests/run-staging/i3823.scala @@ -2,7 +2,7 @@ import scala.quoted._ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { def f[T](x: Expr[T])(using t: Type[T]) = '{ val z: t.Underlying = $x } diff --git a/tests/run-staging/i3847-b.scala b/tests/run-staging/i3847-b.scala index f941a1487f4a..ac64211e8fed 100644 --- a/tests/run-staging/i3847-b.scala +++ b/tests/run-staging/i3847-b.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ import scala.reflect.ClassTag object Arrays { - implicit def ArrayIsLiftable[T: Liftable](implicit t: Type[T], qctx: QuoteContext): Liftable[Array[List[T]]] = { + implicit def ArrayIsLiftable[T: Liftable](implicit t: Type[T], qctx: Quotes): Liftable[Array[List[T]]] = { new Liftable[Array[List[T]]] { def toExpr(arr: Array[List[T]]) = '{ new Array[List[T]](${Expr(arr.length)}) @@ -15,7 +15,7 @@ object Arrays { object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { import Arrays._ implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int} val arr: Expr[Array[List[Int]]] = Expr(Array[List[Int]](List(1, 2, 3))) diff --git a/tests/run-staging/i3847.scala b/tests/run-staging/i3847.scala index da68f1379995..832feee4c943 100644 --- a/tests/run-staging/i3847.scala +++ b/tests/run-staging/i3847.scala @@ -15,7 +15,7 @@ object Arrays { object Test { implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(this.getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { import Arrays._ implicit val ct: Expr[ClassTag[Int]] = '{ClassTag.Int} val arr: Expr[Array[Int]] = Expr(Array[Int](1, 2, 3)) diff --git a/tests/run-staging/i3876-b.scala b/tests/run-staging/i3876-b.scala index b83a7749606c..50356d509ccb 100644 --- a/tests/run-staging/i3876-b.scala +++ b/tests/run-staging/i3876-b.scala @@ -4,15 +4,15 @@ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def x(using QuoteContext): Expr[Int] = '{3} + def x(using Quotes): Expr[Int] = '{3} - def f2(using QuoteContext): Expr[Int => Int] = '{ + def f2(using Quotes): Expr[Int => Int] = '{ def f(x: Int): Int = x + x f } - def expr(using QuoteContext) = '{$f2($x)} + def expr(using Quotes) = '{$f2($x)} println(run(Expr.betaReduce(expr))) - println(withQuoteContext(Expr.betaReduce(expr).show)) // TODO improve printer + println(withQuotes(Expr.betaReduce(expr).show)) // TODO improve printer } } diff --git a/tests/run-staging/i3876-c.scala b/tests/run-staging/i3876-c.scala index b614d934b954..62df7fd9b5a1 100644 --- a/tests/run-staging/i3876-c.scala +++ b/tests/run-staging/i3876-c.scala @@ -4,14 +4,14 @@ object Test { def main(args: Array[String]): Unit = { implicit def toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) - def x(using QuoteContext): Expr[Int] = '{3} + def x(using Quotes): Expr[Int] = '{3} - def f3(using QuoteContext): Expr[Int => Int] = '{ + def f3(using Quotes): Expr[Int => Int] = '{ val f: (x: Int) => Int = x => x + x f } - def expr(using QuoteContext) = '{$f3($x)} + def expr(using Quotes) = '{$f3($x)} println(run(Expr.betaReduce(expr))) - println(withQuoteContext(Expr.betaReduce(expr).show)) // TODO improve printer + println(withQuotes(Expr.betaReduce(expr).show)) // TODO improve printer } } diff --git a/tests/run-staging/i3876-d.scala b/tests/run-staging/i3876-d.scala index 982a4bea5660..a7da39bf670f 100644 --- a/tests/run-staging/i3876-d.scala +++ b/tests/run-staging/i3876-d.scala @@ -4,13 +4,13 @@ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def x(using QuoteContext): Expr[Int] = '{3} + def x(using Quotes): Expr[Int] = '{3} - def f4(using QuoteContext): Expr[Int => Int] = '{ + def f4(using Quotes): Expr[Int => Int] = '{ inlineLambda } println(run(Expr.betaReduce('{$f4($x)}))) - println(withQuoteContext(Expr.betaReduce('{$f4($x)}).show)) + println(withQuotes(Expr.betaReduce('{$f4($x)}).show)) } transparent inline def inlineLambda: Int => Int = x => x + x diff --git a/tests/run-staging/i3876-e.scala b/tests/run-staging/i3876-e.scala index c68ea0d64009..369044ea61eb 100644 --- a/tests/run-staging/i3876-e.scala +++ b/tests/run-staging/i3876-e.scala @@ -4,13 +4,13 @@ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def x(using QuoteContext): Expr[Int] = '{ println(); 3 } + def x(using Quotes): Expr[Int] = '{ println(); 3 } - def f4(using QuoteContext): Expr[Int => Int] = '{ + def f4(using Quotes): Expr[Int => Int] = '{ inlineLambda } println(run(Expr.betaReduce('{$f4($x)}))) - println(withQuoteContext(Expr.betaReduce('{$f4($x)}).show)) + println(withQuotes(Expr.betaReduce('{$f4($x)}).show)) } transparent inline def inlineLambda: Int => Int = x => x + x diff --git a/tests/run-staging/i3876.scala b/tests/run-staging/i3876.scala index 4296ba73330a..92a91d20fb24 100644 --- a/tests/run-staging/i3876.scala +++ b/tests/run-staging/i3876.scala @@ -4,11 +4,11 @@ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def x(using QuoteContext): Expr[Int] = '{3} + def x(using Quotes): Expr[Int] = '{3} - def f(using QuoteContext): Expr[Int => Int] = '{ (x: Int) => x + x } + def f(using Quotes): Expr[Int => Int] = '{ (x: Int) => x + x } println(run(Expr.betaReduce('{$f($x)}))) - println(withQuoteContext(Expr.betaReduce('{$f($x)}).show)) + println(withQuotes(Expr.betaReduce('{$f($x)}).show)) } } diff --git a/tests/run-staging/i3946.scala b/tests/run-staging/i3946.scala index 1bfbdc10658d..79c80bad6666 100644 --- a/tests/run-staging/i3946.scala +++ b/tests/run-staging/i3946.scala @@ -3,8 +3,8 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def u(using QuoteContext): Expr[Unit] = '{} - println(withQuoteContext(u.show)) + def u(using Quotes): Expr[Unit] = '{} + println(withQuotes(u.show)) println(run(u)) } } diff --git a/tests/run-staging/i3947b2.scala b/tests/run-staging/i3947b2.scala index f2959802aec2..375bdabe2a2c 100644 --- a/tests/run-staging/i3947b2.scala +++ b/tests/run-staging/i3947b2.scala @@ -7,7 +7,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { - def test[T: Type](clazz: QuoteContext ?=> java.lang.Class[T]) = { + def test[T: Type](clazz: Quotes ?=> java.lang.Class[T]) = { val lclazz = Expr(clazz) val name = '{ ($lclazz).getCanonicalName } println() diff --git a/tests/run-staging/i4044a.scala b/tests/run-staging/i4044a.scala index b93b2c202717..200f7ce9d243 100644 --- a/tests/run-staging/i4044a.scala +++ b/tests/run-staging/i4044a.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ class Foo { given Toolbox = Toolbox.make(getClass.getClassLoader) - def foo: Unit = withQuoteContext { + def foo: Unit = withQuotes { val e: Expr[Int] = '{3} val q = '{ ${ '{ $e } } } println(q.show) diff --git a/tests/run-staging/i4044b.scala b/tests/run-staging/i4044b.scala index c23774c5fb02..c7917a36fe53 100644 --- a/tests/run-staging/i4044b.scala +++ b/tests/run-staging/i4044b.scala @@ -2,17 +2,17 @@ import scala.quoted._ import scala.quoted.staging._ sealed abstract class VarRef[T] { - def update(expr: Expr[T])(using QuoteContext): Expr[Unit] - def expr(using QuoteContext): Expr[T] + def update(expr: Expr[T])(using Quotes): Expr[Unit] + def expr(using Quotes): Expr[T] } object VarRef { - def apply[T: Type, U: Type](init: Expr[T])(body: VarRef[T] => Expr[U])(using QuoteContext): Expr[U] = '{ + def apply[T: Type, U: Type](init: Expr[T])(body: VarRef[T] => Expr[U])(using Quotes): Expr[U] = '{ var x = $init ${body( new VarRef { - def update(e: Expr[T])(using QuoteContext): Expr[Unit] = '{ x = $e } - def expr(using QuoteContext): Expr[T] = 'x + def update(e: Expr[T])(using Quotes): Expr[Unit] = '{ x = $e } + def expr(using Quotes): Expr[T] = 'x } )} } @@ -21,7 +21,7 @@ object VarRef { object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val q = VarRef('{4})(varRef => '{ ${varRef.update('{3})}; ${varRef.expr} }) println(q.show) } diff --git a/tests/run-staging/i4044c.scala b/tests/run-staging/i4044c.scala index b7fc78f4595e..3ce5effae154 100644 --- a/tests/run-staging/i4044c.scala +++ b/tests/run-staging/i4044c.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ class Foo { given Toolbox = Toolbox.make(getClass.getClassLoader) - def foo: Unit = withQuoteContext { + def foo: Unit = withQuotes { val q = '{ ${ '{ ${ '{ 5 } } } } } println(q.show) } diff --git a/tests/run-staging/i4044e.scala b/tests/run-staging/i4044e.scala index cb2029d42b61..0f83cd1f8b07 100644 --- a/tests/run-staging/i4044e.scala +++ b/tests/run-staging/i4044e.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ class Foo { given Toolbox = Toolbox.make(getClass.getClassLoader) - def foo: Unit = withQuoteContext { + def foo: Unit = withQuotes { val e: Expr[Int] = '{3} val f: Expr[Int] = '{5} val t: Type[Int] = Type.of[Int] diff --git a/tests/run-staging/i4044f.scala b/tests/run-staging/i4044f.scala index 6f2563cc1bf1..72691c19cd4a 100644 --- a/tests/run-staging/i4044f.scala +++ b/tests/run-staging/i4044f.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ class Foo { given Toolbox = Toolbox.make(getClass.getClassLoader) - def foo: Unit = withQuoteContext { + def foo: Unit = withQuotes { 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-staging/i4350.scala b/tests/run-staging/i4350.scala index 908a5e63613e..314e0c4f49ad 100644 --- a/tests/run-staging/i4350.scala +++ b/tests/run-staging/i4350.scala @@ -3,12 +3,12 @@ import scala.quoted._ import scala.quoted.staging._ class Foo[T: Type] { - def q(using QuoteContext) = '{(null: Any).asInstanceOf[T]} + def q(using Quotes) = '{(null: Any).asInstanceOf[T]} } object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { println((new Foo[Object]).q.show) println((new Foo[String]).q.show) } diff --git a/tests/run-staging/i4591.scala b/tests/run-staging/i4591.scala index c4653c799ebe..7ad91b8afeb5 100644 --- a/tests/run-staging/i4591.scala +++ b/tests/run-staging/i4591.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ object Test { - def foo[T: Type](init: Expr[T])(using QuoteContext): Expr[Unit] = '{ + def foo[T: Type](init: Expr[T])(using Quotes): Expr[Unit] = '{ var x = $init println(x) } diff --git a/tests/run-staging/i4730.scala b/tests/run-staging/i4730.scala index 966e90d175ab..2b889270681b 100644 --- a/tests/run-staging/i4730.scala +++ b/tests/run-staging/i4730.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def ret(using QuoteContext): Expr[Int => Int] = '{ (x: Int) => + def ret(using Quotes): Expr[Int => Int] = '{ (x: Int) => ${ val z = run('{x + 1}) // throws scala.quoted.runtime.impl.ScopeException => Expr(z) diff --git a/tests/run-staging/i5144.scala b/tests/run-staging/i5144.scala index a79a4e795bdb..a8cb4ce5a771 100644 --- a/tests/run-staging/i5144.scala +++ b/tests/run-staging/i5144.scala @@ -3,13 +3,13 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def eval1(ff: Expr[Int => Int])(using QuoteContext): Expr[Int] = '{$ff(42)} + def eval1(ff: Expr[Int => Int])(using Quotes): Expr[Int] = '{$ff(42)} - def peval1()(using QuoteContext): Expr[Unit] = '{ + def peval1()(using Quotes): Expr[Unit] = '{ def f(x: Int): Int = ${eval1('f)} } - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val p = peval1() println(p.show) } diff --git a/tests/run-staging/i5144b.scala b/tests/run-staging/i5144b.scala index bf551a5507c3..6ab808ec6894 100644 --- a/tests/run-staging/i5144b.scala +++ b/tests/run-staging/i5144b.scala @@ -3,14 +3,14 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def eval1(ff: Expr[Int => Int])(using QuoteContext): Expr[Int] = + def eval1(ff: Expr[Int => Int])(using Quotes): Expr[Int] = Expr.betaReduce('{ $ff(42) }) - def peval1()(using QuoteContext): Expr[Unit] = '{ + def peval1()(using Quotes): Expr[Unit] = '{ def f(x: Int): Int = ${eval1('f)} } - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val p = peval1() println(p.show) } diff --git a/tests/run-staging/i5152.scala b/tests/run-staging/i5152.scala index 45b379f2594b..f745ea5865c1 100644 --- a/tests/run-staging/i5152.scala +++ b/tests/run-staging/i5152.scala @@ -3,13 +3,13 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def eval1(ff: Expr[Int => Int])(using QuoteContext): Expr[Int => Int] = '{identity} + def eval1(ff: Expr[Int => Int])(using Quotes): Expr[Int => Int] = '{identity} - def peval1()(using QuoteContext): Expr[Unit] = '{ + def peval1()(using Quotes): Expr[Unit] = '{ lazy val f: Int => Int = ${eval1('{(y: Int) => f(y)})} } - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val p = peval1() println(p.show) } diff --git a/tests/run-staging/i5161.scala b/tests/run-staging/i5161.scala index 9f2e6abaa4d4..e7ec50e72aed 100644 --- a/tests/run-staging/i5161.scala +++ b/tests/run-staging/i5161.scala @@ -10,7 +10,7 @@ object Test { } import Exp._ - def evalTest(e: Exp)(using QuoteContext): Expr[Option[Int]] = e match { + def evalTest(e: Exp)(using Quotes): Expr[Option[Int]] = e match { case Int2(x) => '{ Some(${Expr(x)}) } case Add(e1, e2) => '{ @@ -25,8 +25,8 @@ object Test { def main(args: Array[String]): Unit = { val test = Add(Int2(1), Int2(1)) - def res(using QuoteContext) = evalTest(test) + def res(using Quotes) = evalTest(test) println("run : " + run(res)) - println("show : " + withQuoteContext(res.show)) + println("show : " + withQuotes(res.show)) } } diff --git a/tests/run-staging/i5161b.scala b/tests/run-staging/i5161b.scala index f99c0adf15cf..e11f5e4255c2 100644 --- a/tests/run-staging/i5161b.scala +++ b/tests/run-staging/i5161b.scala @@ -5,14 +5,14 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { - def res(using QuoteContext) = '{ + def res(using Quotes) = '{ val x: Option[Int] = Option(3) if (x.isInstanceOf[Some[_]]) Option(1) else None } - println("show0 : " + withQuoteContext(res.show)) + println("show0 : " + withQuotes(res.show)) println("run1 : " + run(res)) println("run2 : " + run(res)) - println("show3 : " + withQuoteContext(res.show)) + println("show3 : " + withQuotes(res.show)) } } diff --git a/tests/run-staging/i5247.scala b/tests/run-staging/i5247.scala index fb5ef726621a..c406a404d022 100644 --- a/tests/run-staging/i5247.scala +++ b/tests/run-staging/i5247.scala @@ -3,15 +3,15 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { println(foo[Object].show) println(bar[Object].show) } - def foo[H : Type](using QuoteContext): Expr[H] = { + def foo[H : Type](using Quotes): Expr[H] = { val t = Type.of[H] '{ null.asInstanceOf[t.Underlying] } } - def bar[H : Type](using QuoteContext): Expr[List[H]] = { + def bar[H : Type](using Quotes): Expr[List[H]] = { val t = Type.of[List[H]] '{ null.asInstanceOf[t.Underlying] } } diff --git a/tests/run-staging/i5376.scala b/tests/run-staging/i5376.scala index 5105e1a2ac35..bca4ac5a2daa 100644 --- a/tests/run-staging/i5376.scala +++ b/tests/run-staging/i5376.scala @@ -4,7 +4,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { var e = '{1} e = '{$e + 1} e = '{$e + 2} diff --git a/tests/run-staging/i5965.scala b/tests/run-staging/i5965.scala index c77a8747ff7c..866aedfb1c7b 100644 --- a/tests/run-staging/i5965.scala +++ b/tests/run-staging/i5965.scala @@ -5,22 +5,22 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = { - withQuoteContext(Type.of[List]) + withQuotes(Type.of[List]) - def list(using QuoteContext) = bound('{List(1, 2, 3)}) - println(withQuoteContext(list.show)) + def list(using Quotes) = bound('{List(1, 2, 3)}) + println(withQuotes(list.show)) println(run(list)) - def opt(using QuoteContext) = bound('{Option(4)}) - println(withQuoteContext(opt.show)) + def opt(using Quotes) = bound('{Option(4)}) + println(withQuotes(opt.show)) println(run(opt)) - def map(using QuoteContext) = bound('{Map(4 -> 1)}) - println(withQuoteContext(map.show)) + def map(using Quotes) = bound('{Map(4 -> 1)}) + println(withQuotes(map.show)) println(run(map)) } - def bound[T: Type, S[_]: Type](x: Expr[S[T]])(using QuoteContext): Expr[S[T]] = '{ + def bound[T: Type, S[_]: Type](x: Expr[S[T]])(using Quotes): Expr[S[T]] = '{ val y: S[T] = $x y } diff --git a/tests/run-staging/i5965b.scala b/tests/run-staging/i5965b.scala index a76c6382e08d..1cc64ca1a797 100644 --- a/tests/run-staging/i5965b.scala +++ b/tests/run-staging/i5965b.scala @@ -6,21 +6,21 @@ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - withQuoteContext(Type.of[List]) - def list(using QuoteContext) = bound('{List(1, 2, 3)}) - println(withQuoteContext(list.show)) + withQuotes(Type.of[List]) + def list(using Quotes) = bound('{List(1, 2, 3)}) + println(withQuotes(list.show)) println(run(list)) - def opt(using QuoteContext) = bound('{Option(4)}) - println(withQuoteContext(opt.show)) + def opt(using Quotes) = bound('{Option(4)}) + println(withQuotes(opt.show)) println(run(opt)) - def map(using QuoteContext) = bound('{Map(4 -> 1)}) - println(withQuoteContext(map.show)) + def map(using Quotes) = bound('{Map(4 -> 1)}) + println(withQuotes(map.show)) println(run(map)) } - def bound[T: Type, S[_]: Type](x: Expr[S[T]])(using QuoteContext): Expr[S[T]] = '{ + def bound[T: Type, S[_]: Type](x: Expr[S[T]])(using Quotes): Expr[S[T]] = '{ val y = $x y } diff --git a/tests/run-staging/i5997.scala b/tests/run-staging/i5997.scala index 73c201722f95..d07c94490f94 100644 --- a/tests/run-staging/i5997.scala +++ b/tests/run-staging/i5997.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val v = '{ (if true then Some(1) else None).map(v => v+1) } println(v.show) } diff --git a/tests/run-staging/i6263.scala b/tests/run-staging/i6263.scala index 2c4706853daa..e8bac932fb0a 100644 --- a/tests/run-staging/i6263.scala +++ b/tests/run-staging/i6263.scala @@ -5,7 +5,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { fn("foo") fn((1,2)) fn(O) diff --git a/tests/run-staging/i6281.scala b/tests/run-staging/i6281.scala index 9071986c7b34..2f19bc641d1b 100644 --- a/tests/run-staging/i6281.scala +++ b/tests/run-staging/i6281.scala @@ -26,7 +26,7 @@ object Test extends App { def reflect[A](using Type[A]) = m => m } // for reify, we need type tags for E and also strangely for L. - implicit def cons [E, L <: HList](using Effects[L])(using Type[E])(using Type[L])(using QuoteContext): Effects[E :: L] = new Effects[E :: L] { + implicit def cons [E, L <: HList](using Effects[L])(using Type[E])(using Type[L])(using Quotes): Effects[E :: L] = new Effects[E :: L] { def reify[A](using Type[A]) = m => '{ k => ${ Effects[L].reify[E] { m( a => Effects[L].reflect[E]('{k($a)})) } }} def reflect[A](using Type[A]) = m => k => Effects[L].reflect[E] { '{ $m(a => ${ Effects[L].reify[E]( k('a)) }) } } } @@ -35,11 +35,11 @@ object Test extends App { type RS = Boolean :: RS2 type RS2 = Int :: String :: HNil - def m(using QuoteContext): STM[Int, RS] = k => k('{42}) + def m(using Quotes): STM[Int, RS] = k => k('{42}) implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) - withQuoteContext { + withQuotes { println(Effects[RS].reify[Int] { m }.show) val effects = cons[Boolean, RS2](using cons[Int, String :: HNil](using cons[String, HNil](using empty))) diff --git a/tests/run-staging/i6754.scala b/tests/run-staging/i6754.scala index aef0b52c9437..c3ce89138dc2 100644 --- a/tests/run-staging/i6754.scala +++ b/tests/run-staging/i6754.scala @@ -12,8 +12,8 @@ package scala { implicit val tbx: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) def myTest() = { - def y(using QuoteContext): Expr[Unit] = '{ - def x(using QuoteContext): Expr[Unit] = '{println("bar")} + def y(using Quotes): Expr[Unit] = '{ + def x(using Quotes): Expr[Unit] = '{println("bar")} println("foo") run(x) } diff --git a/tests/run-staging/i6992/Macro_1.scala b/tests/run-staging/i6992/Macro_1.scala index 6481aaeaf1e0..a7d766424695 100644 --- a/tests/run-staging/i6992/Macro_1.scala +++ b/tests/run-staging/i6992/Macro_1.scala @@ -8,7 +8,7 @@ object macros { class Foo { val x = 10 } - def mcrImpl(body: Expr[Any])(using ctx: QuoteContext): Expr[Any] = + def mcrImpl(body: Expr[Any])(using ctx: Quotes): Expr[Any] = MyTest.mcrImpl(body) } @@ -18,7 +18,7 @@ package scala { given Toolbox = Toolbox.make(getClass.getClassLoader) - def mcrImpl(body: Expr[Any])(using ctx: QuoteContext): Expr[Any] = { + def mcrImpl(body: Expr[Any])(using ctx: Quotes): Expr[Any] = { import ctx.reflect._ try { body match { diff --git a/tests/run-staging/i7381.scala b/tests/run-staging/i7381.scala index d9190e88e88c..239158ca94b8 100644 --- a/tests/run-staging/i7381.scala +++ b/tests/run-staging/i7381.scala @@ -5,7 +5,7 @@ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - withQuoteContext { + withQuotes { val expr = Expr(List(1, 2, 3)) println(expr.show) } diff --git a/tests/run-staging/i8178.scala b/tests/run-staging/i8178.scala index 300a06c588fd..57001e9a7415 100644 --- a/tests/run-staging/i8178.scala +++ b/tests/run-staging/i8178.scala @@ -1,7 +1,7 @@ import scala.quoted._ import scala.quoted.staging._ -def foo(n: Int, t: Expr[Int])(using QuoteContext): Expr[Int] = +def foo(n: Int, t: Expr[Int])(using Quotes): Expr[Int] = if (n == 0) t else '{ val a = ${Expr(n)}; ${foo(n - 1, 'a)} + $t } diff --git a/tests/run-staging/i8585.scala b/tests/run-staging/i8585.scala index 4c6b3a1e42a4..814fe10824a7 100644 --- a/tests/run-staging/i8585.scala +++ b/tests/run-staging/i8585.scala @@ -1,5 +1,5 @@ import scala.quoted._ -import scala.quoted.staging.{run, withQuoteContext, Toolbox} +import scala.quoted.staging.{run, withQuotes, Toolbox} object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) @@ -13,13 +13,13 @@ object Test { } def stagedPower(n: Int): Double => Double = { - def code(using QuoteContext) = '{ (x: Double) => ${ powerCode(n, 'x) } } + def code(using Quotes) = '{ (x: Double) => ${ powerCode(n, 'x) } } println("The following would not compile:") - println(withQuoteContext(code.show)) + println(withQuotes(code.show)) run(code) } - def powerCode(n: Int, x: Expr[Double])(using ctx: QuoteContext): Expr[Double] = + def powerCode(n: Int, x: Expr[Double])(using ctx: Quotes): Expr[Double] = if (n == 1) x else if (n == 2) '{ $x * $x } else if (n % 2 == 1) '{ $x * ${ powerCode(n - 1, x) } } diff --git a/tests/run-staging/inline-quote.scala b/tests/run-staging/inline-quote.scala index cd48b4b773b8..9b8c794b363f 100644 --- a/tests/run-staging/inline-quote.scala +++ b/tests/run-staging/inline-quote.scala @@ -3,14 +3,14 @@ import scala.quoted.staging._ object Test { - inline def foo(x: Expr[Int])(using QuoteContext): Expr[Int] = '{ + inline def foo(x: Expr[Int])(using Quotes): Expr[Int] = '{ println("foo") $x } implicit val toolbox: scala.quoted.staging.Toolbox = scala.quoted.staging.Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val y = '{45} println(foo(y).show) } diff --git a/tests/run-staging/liftables.scala b/tests/run-staging/liftables.scala index 80ffff7b3fcf..df5c62d4ec25 100644 --- a/tests/run-staging/liftables.scala +++ b/tests/run-staging/liftables.scala @@ -2,7 +2,7 @@ import scala.quoted._ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { println(Expr(true).show) println(Expr(false).show) println() diff --git a/tests/run-staging/multi-staging.check b/tests/run-staging/multi-staging.check index 2f85879cf975..fcdab8891c45 100644 --- a/tests/run-staging/multi-staging.check +++ b/tests/run-staging/multi-staging.check @@ -1,5 +1,5 @@ -stage1 code: ((qctx1: scala.quoted.QuoteContext) ?=> { +stage1 code: ((q1: scala.quoted.Quotes) ?=> { val x1: scala.Int = 2 - scala.quoted.runtime.Expr.quote[scala.Int](1.+(scala.quoted.runtime.Expr.nestedSplice[scala.Int](qctx1)(((evidence$5: qctx1.Nested) ?=> scala.quoted.Expr.apply[scala.Int](x1)(evidence$5, scala.quoted.Liftable.IntLiftable[scala.Int]))))).apply(using qctx1) + scala.quoted.runtime.Expr.quote[scala.Int](1.+(scala.quoted.runtime.Expr.nestedSplice[scala.Int](q1)(((evidence$5: q1.Nested) ?=> scala.quoted.Expr.apply[scala.Int](x1)(scala.quoted.Liftable.IntLiftable[scala.Int])(evidence$5))))).apply(using q1) }) 3 diff --git a/tests/run-staging/multi-staging.scala b/tests/run-staging/multi-staging.scala index 78bd3e8ffd96..57e916502022 100644 --- a/tests/run-staging/multi-staging.scala +++ b/tests/run-staging/multi-staging.scala @@ -4,16 +4,16 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = - val s1: QuoteContext ?=> Expr[Int] = { + val s1: Quotes ?=> Expr[Int] = { given Toolbox = Toolbox.make(getClass.getClassLoader) - run[QuoteContext ?=> Expr[Int]] { stage1('{2}) } + run[Quotes ?=> Expr[Int]] { stage1('{2}) } } { given Toolbox = Toolbox.make(getClass.getClassLoader) println(run(s1)) } - def stage1(x: Expr[Int])(using qctx: QuoteContext): Expr[QuoteContext ?=> Expr[Int]] = - val code = '{ (using qctx1: QuoteContext) => + def stage1(x: Expr[Int])(using Quotes): Expr[Quotes ?=> Expr[Int]] = + val code = '{ (using q1: Quotes) => val x1 = $x '{ 1 + ${Expr(x1)} } } diff --git a/tests/run-staging/quote-ackermann-1.scala b/tests/run-staging/quote-ackermann-1.scala index 8b27ebde0f71..c167e0f77d29 100644 --- a/tests/run-staging/quote-ackermann-1.scala +++ b/tests/run-staging/quote-ackermann-1.scala @@ -12,7 +12,7 @@ object Test { println(ack3(4)) } - def ackermann(m: Int)(using QuoteContext): Expr[Int => Int] = { + def ackermann(m: Int)(using Quotes): Expr[Int => Int] = { if (m == 0) '{ n => n + 1 } else '{ n => def `ackermann(m-1)`(n: Int): Int = ${Expr.betaReduce('{ ${ackermann(m - 1)}(n)})} // Expr[Int => Int] applied to Expr[Int] diff --git a/tests/run-staging/quote-fun-app-1.scala b/tests/run-staging/quote-fun-app-1.scala index 76e4ff2cb798..c2c1848901ec 100644 --- a/tests/run-staging/quote-fun-app-1.scala +++ b/tests/run-staging/quote-fun-app-1.scala @@ -12,8 +12,8 @@ object Test { println(f(43)) } - def f1(using QuoteContext): Expr[Int => Int] = '{ n => ${Expr.betaReduce('{$f2(n)})} } - def f2(using QuoteContext): Expr[Int => Int] = '{ n => ${Expr.betaReduce('{$f3(n)})} } - def f3(using QuoteContext): Expr[Int => Int] = '{ n => ${Expr.betaReduce('{$f4(n)})} } - def f4(using QuoteContext): Expr[Int => Int] = '{ n => n } + def f1(using Quotes): Expr[Int => Int] = '{ n => ${Expr.betaReduce('{$f2(n)})} } + def f2(using Quotes): Expr[Int => Int] = '{ n => ${Expr.betaReduce('{$f3(n)})} } + def f3(using Quotes): Expr[Int => Int] = '{ n => ${Expr.betaReduce('{$f4(n)})} } + def f4(using Quotes): Expr[Int => Int] = '{ n => n } } diff --git a/tests/run-staging/quote-function-applied-to.scala b/tests/run-staging/quote-function-applied-to.scala index 7bb69e00284e..805294c4e17c 100644 --- a/tests/run-staging/quote-function-applied-to.scala +++ b/tests/run-staging/quote-function-applied-to.scala @@ -4,7 +4,7 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def show(expr: QuoteContext ?=> Expr[_]): String = withQuoteContext(expr.show) + def show(expr: Quotes ?=> Expr[_]): String = withQuotes(expr.show) println(show(Expr.betaReduce('{ (() => x(0))() }))) println(show(Expr.betaReduce('{ ((x1: Int) => x1)(x(1)) }))) println(show(Expr.betaReduce('{ ((x1: Int, x2: Int) => x1 + x2)(x(1), x(2)) }))) diff --git a/tests/run-staging/quote-lambda.scala b/tests/run-staging/quote-lambda.scala index de8e222ffad0..6dc04547e74c 100644 --- a/tests/run-staging/quote-lambda.scala +++ b/tests/run-staging/quote-lambda.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { '{ (x: Int) => ${'x} } } } diff --git a/tests/run-staging/quote-lib.scala b/tests/run-staging/quote-lib.scala index 794ac02cb205..b45e6df2d75c 100644 --- a/tests/run-staging/quote-lib.scala +++ b/tests/run-staging/quote-lib.scala @@ -10,7 +10,7 @@ import liftable.Exprs._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val liftedUnit: Expr[Unit] = '{} letVal('{1})(a => '{ $a + 1 }).show @@ -115,7 +115,7 @@ package liftable { object Exprs { implicit class LiftExprOps[T](x: T) extends AnyVal { - def toExpr(using Liftable[T], QuoteContext): Expr[T] = + def toExpr(using Liftable[T], Quotes): Expr[T] = summon[Liftable[T]].toExpr(x) } } @@ -127,30 +127,30 @@ package liftable { } object Lets { - def letVal[T: Type, U: Type](expr: Expr[T])(body: Expr[T] => Expr[U])(implicit qctx: QuoteContext): Expr[U] = + def letVal[T: Type, U: Type](expr: Expr[T])(body: Expr[T] => Expr[U])(implicit qctx: Quotes): Expr[U] = '{ val letVal: T = $expr; ${ body('letVal) } } - def letLazyVal[T: Type, U: Type](expr: Expr[T])(body: Expr[T] => Expr[U])(implicit qctx: QuoteContext): Expr[U] = + def letLazyVal[T: Type, U: Type](expr: Expr[T])(body: Expr[T] => Expr[U])(implicit qctx: Quotes): Expr[U] = '{ lazy val letLazyVal: T = $expr; ${ body('letLazyVal) } } - def letDef[T: Type, U: Type](expr: Expr[T])(body: Expr[T] => Expr[U])(implicit qctx: QuoteContext): Expr[U] = + def letDef[T: Type, U: Type](expr: Expr[T])(body: Expr[T] => Expr[U])(implicit qctx: Quotes): Expr[U] = '{ def letDef: T = $expr; ${ body('letDef) } } } object Loops { - def liftedWhile(cond: Expr[Boolean])(body: Expr[Unit])(using QuoteContext): Expr[Unit] = '{ while ($cond) $body } - def liftedDoWhile(body: Expr[Unit])(cond: Expr[Boolean])(using QuoteContext): Expr[Unit] = '{ while { $body ; $cond } do () } + def liftedWhile(cond: Expr[Boolean])(body: Expr[Unit])(using Quotes): Expr[Unit] = '{ while ($cond) $body } + def liftedDoWhile(body: Expr[Unit])(cond: Expr[Boolean])(using Quotes): Expr[Unit] = '{ while { $body ; $cond } do () } } object Lists { implicit class LiftedOps[T: Liftable](list: Expr[List[T]])(implicit t: Type[T]) { - def foldLeft[U](acc: Expr[U])(f: Expr[(U, T) => U])(implicit u: Type[U], qctx: QuoteContext): Expr[U] = + def foldLeft[U](acc: Expr[U])(f: Expr[(U, T) => U])(implicit u: Type[U], qctx: Quotes): Expr[U] = '{ ($list).foldLeft[U]($acc)($f) } - def foreach(f: Expr[T => Unit])(using QuoteContext): Expr[Unit] = + def foreach(f: Expr[T => Unit])(using Quotes): Expr[Unit] = '{ ($list).foreach($f) } } - implicit class UnrolledOps[T: Liftable](list: List[T])(implicit t: Type[T], qctx: QuoteContext) { + implicit class UnrolledOps[T: Liftable](list: List[T])(implicit t: Type[T], qctx: Quotes) { def unrolledFoldLeft[U](acc: Expr[U])(f: Expr[(U, T) => U])(implicit u: Type[U]): Expr[U] = list match { case x :: xs => xs.unrolledFoldLeft('{ ($f).apply($acc, ${Expr(x)}) })(f) case Nil => acc diff --git a/tests/run-staging/quote-nested-1.check b/tests/run-staging/quote-nested-1.check index 7aa1d3637e5c..455e123a642c 100644 --- a/tests/run-staging/quote-nested-1.check +++ b/tests/run-staging/quote-nested-1.check @@ -1 +1 @@ -((qctx: scala.quoted.QuoteContext) ?=> scala.quoted.runtime.Expr.quote[scala.Int](3).apply(using qctx)) +((q: scala.quoted.Quotes) ?=> scala.quoted.runtime.Expr.quote[scala.Int](3).apply(using q)) diff --git a/tests/run-staging/quote-nested-1.scala b/tests/run-staging/quote-nested-1.scala index 7c467da7edff..2c00a4e79105 100644 --- a/tests/run-staging/quote-nested-1.scala +++ b/tests/run-staging/quote-nested-1.scala @@ -3,8 +3,8 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { - val q = '{ (using qctx: QuoteContext) => '{3} } + def main(args: Array[String]): Unit = withQuotes { + val q = '{ (using q: Quotes) => '{3} } println(q.show) } } diff --git a/tests/run-staging/quote-nested-2.check b/tests/run-staging/quote-nested-2.check index c197cb613e00..ee2c5eccf702 100644 --- a/tests/run-staging/quote-nested-2.check +++ b/tests/run-staging/quote-nested-2.check @@ -1,4 +1,4 @@ -((qctx: scala.quoted.QuoteContext) ?=> { - val a: scala.quoted.Expr[scala.Int] = scala.quoted.runtime.Expr.quote[scala.Int](4).apply(using qctx) - ((evidence$2: qctx.Nested) ?=> a).asInstanceOf[scala.ContextFunction1[scala.quoted.QuoteContext, scala.quoted.Expr[scala.Int]]].apply(using qctx) +((q: scala.quoted.Quotes) ?=> { + val a: scala.quoted.Expr[scala.Int] = scala.quoted.runtime.Expr.quote[scala.Int](4).apply(using q) + ((evidence$2: q.Nested) ?=> a).asInstanceOf[scala.ContextFunction1[scala.quoted.Quotes, scala.quoted.Expr[scala.Int]]].apply(using q) }) diff --git a/tests/run-staging/quote-nested-2.scala b/tests/run-staging/quote-nested-2.scala index 87ea1a79fabc..5b3588e2dcd2 100644 --- a/tests/run-staging/quote-nested-2.scala +++ b/tests/run-staging/quote-nested-2.scala @@ -4,8 +4,8 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { - val q = '{(using qctx: QuoteContext) => + def main(args: Array[String]): Unit = withQuotes { + val q = '{(using q: Quotes) => val a = '{4} '{${a}} } diff --git a/tests/run-staging/quote-nested-3.scala b/tests/run-staging/quote-nested-3.scala index f0e56cd68ba2..e4aa0c757704 100644 --- a/tests/run-staging/quote-nested-3.scala +++ b/tests/run-staging/quote-nested-3.scala @@ -4,7 +4,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val q = '{ type T = String val x = "foo" diff --git a/tests/run-staging/quote-nested-4.check b/tests/run-staging/quote-nested-4.check index 16e3ef5d6899..2e326526d898 100644 --- a/tests/run-staging/quote-nested-4.check +++ b/tests/run-staging/quote-nested-4.check @@ -1,5 +1,5 @@ -((qctx: scala.quoted.QuoteContext) ?=> { - val t: scala.quoted.Type[scala.Predef.String] = scala.quoted.Type.of[scala.Predef.String].apply(using qctx) +((q: scala.quoted.Quotes) ?=> { + val t: scala.quoted.Type[scala.Predef.String] = scala.quoted.Type.of[scala.Predef.String].apply(using q) (t: scala.quoted.Type[scala.Predef.String]) }) diff --git a/tests/run-staging/quote-nested-4.scala b/tests/run-staging/quote-nested-4.scala index 658a07b233b1..95c4491dd9e0 100644 --- a/tests/run-staging/quote-nested-4.scala +++ b/tests/run-staging/quote-nested-4.scala @@ -3,9 +3,9 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { - val q = '{ (using qctx: QuoteContext) => + val q = '{ (using q: Quotes) => val t = Type.of[String] t } diff --git a/tests/run-staging/quote-nested-5.check b/tests/run-staging/quote-nested-5.check index bf4593594e31..72d31bfb23cc 100644 --- a/tests/run-staging/quote-nested-5.check +++ b/tests/run-staging/quote-nested-5.check @@ -1,4 +1,4 @@ -((qctx: scala.quoted.QuoteContext) ?=> { - val a: scala.quoted.Expr[scala.Int] = scala.quoted.runtime.Expr.quote[scala.Int](4).apply(using qctx) - ((qctx2: scala.quoted.QuoteContext) ?=> ((evidence$3: qctx2.Nested) ?=> a).asInstanceOf[scala.ContextFunction1[scala.quoted.QuoteContext, scala.quoted.Expr[scala.Int]]].apply(using qctx2)).apply(using qctx) +((q: scala.quoted.Quotes) ?=> { + val a: scala.quoted.Expr[scala.Int] = scala.quoted.runtime.Expr.quote[scala.Int](4).apply(using q) + ((q2: scala.quoted.Quotes) ?=> ((evidence$3: q2.Nested) ?=> a).asInstanceOf[scala.ContextFunction1[scala.quoted.Quotes, scala.quoted.Expr[scala.Int]]].apply(using q2)).apply(using q) }) diff --git a/tests/run-staging/quote-nested-5.scala b/tests/run-staging/quote-nested-5.scala index fdbf7a2c56b0..0b8c82baa9dd 100644 --- a/tests/run-staging/quote-nested-5.scala +++ b/tests/run-staging/quote-nested-5.scala @@ -3,11 +3,11 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { - val q = '{(using qctx: QuoteContext) => + val q = '{(using q: Quotes) => val a = '{4} - ${'{(using qctx2: QuoteContext) => + ${'{(using q2: Quotes) => '{${a}} }} diff --git a/tests/run-staging/quote-nested-6.scala b/tests/run-staging/quote-nested-6.scala index eae08a79328b..a482495f9923 100644 --- a/tests/run-staging/quote-nested-6.scala +++ b/tests/run-staging/quote-nested-6.scala @@ -4,7 +4,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val q = '{ type T[X] = List[X] val x = "foo" diff --git a/tests/run-staging/quote-owners-2.scala b/tests/run-staging/quote-owners-2.scala index 894ed18e029f..7eccb14a3ddb 100644 --- a/tests/run-staging/quote-owners-2.scala +++ b/tests/run-staging/quote-owners-2.scala @@ -10,7 +10,7 @@ object Test { '{ println($q) } } - def f(t: Type[List[Int]])(using QuoteContext): Expr[Int] = '{ + def f(t: Type[List[Int]])(using Quotes): Expr[Int] = '{ def ff: Int = { val a: t.Underlying = { type T = t.Underlying @@ -22,5 +22,5 @@ object Test { ff } - def g[T](a: Type[T])(using QuoteContext): Type[List[T]] = Type.of[List[a.Underlying]] + def g[T](a: Type[T])(using Quotes): Type[List[T]] = Type.of[List[a.Underlying]] } diff --git a/tests/run-staging/quote-owners.scala b/tests/run-staging/quote-owners.scala index c7746c247425..ae235c32574f 100644 --- a/tests/run-staging/quote-owners.scala +++ b/tests/run-staging/quote-owners.scala @@ -4,19 +4,19 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def q(using QuoteContext) = f + def q(using Quotes) = f println(run(q)) - println(withQuoteContext(q.show)) + println(withQuotes(q.show)) } - def f(using QuoteContext): Expr[Int] = '{ + def f(using Quotes): Expr[Int] = '{ def ff: Int = { $g } ff } - def g(using QuoteContext): Expr[Int] = '{ + def g(using Quotes): Expr[Int] = '{ val a = 9 a + 0 } diff --git a/tests/run-staging/quote-run-2.scala b/tests/run-staging/quote-run-2.scala index 88567f333949..763bfb38c865 100644 --- a/tests/run-staging/quote-run-2.scala +++ b/tests/run-staging/quote-run-2.scala @@ -4,7 +4,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { def powerCode(n: Int, x: Expr[Double]): Expr[Double] = if (n == 0) '{1.0} else if (n == 1) x diff --git a/tests/run-staging/quote-run-b.scala b/tests/run-staging/quote-run-b.scala index dc8d487e2507..efed8e9d0b65 100644 --- a/tests/run-staging/quote-run-b.scala +++ b/tests/run-staging/quote-run-b.scala @@ -5,7 +5,7 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def lambdaExpr(using QuoteContext) = '{ + def lambdaExpr(using Quotes) = '{ (x: Int) => println("lambda(" + x + ")") } println() diff --git a/tests/run-staging/quote-run-c.scala b/tests/run-staging/quote-run-c.scala index f9303333c59d..b031c9d6e2d4 100644 --- a/tests/run-staging/quote-run-c.scala +++ b/tests/run-staging/quote-run-c.scala @@ -5,13 +5,13 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def classExpr(using QuoteContext) = '{ + def classExpr(using Quotes) = '{ class A { override def toString: String = "Foo" } new A } - def classExpr2(using QuoteContext) = '{ + def classExpr2(using Quotes) = '{ class A { override def toString: String = "Bar" } diff --git a/tests/run-staging/quote-run-constants.scala b/tests/run-staging/quote-run-constants.scala index 22d7a5788896..4e30760cd683 100644 --- a/tests/run-staging/quote-run-constants.scala +++ b/tests/run-staging/quote-run-constants.scala @@ -6,7 +6,7 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def runAndPrint[T](expr: QuoteContext ?=> Expr[T]): Unit = println(run(expr)) + def runAndPrint[T](expr: Quotes ?=> Expr[T]): Unit = println(run(expr)) runAndPrint(Expr(true)) runAndPrint(Expr('a')) @@ -23,7 +23,7 @@ object Test { println("======") - withQuoteContext { + withQuotes { def show[T](expr: Expr[T]): Unit = println(expr.show) show(Expr(true)) diff --git a/tests/run-staging/quote-run-large.scala b/tests/run-staging/quote-run-large.scala index e2526cdcd067..a03d2b889440 100644 --- a/tests/run-staging/quote-run-large.scala +++ b/tests/run-staging/quote-run-large.scala @@ -3,7 +3,7 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { - def a(using QuoteContext) = '{ // ' + def a(using Quotes) = '{ // ' class Foo(x: Int) { override def toString(): String = s"Foo($x)" def foo1: Int = x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x + x @@ -62,7 +62,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - withQuoteContext { + withQuotes { a.show // Force unpiclking of the expression } } diff --git a/tests/run-staging/quote-run-many.scala b/tests/run-staging/quote-run-many.scala index 9874c2a32e0e..68305fbb42a7 100644 --- a/tests/run-staging/quote-run-many.scala +++ b/tests/run-staging/quote-run-many.scala @@ -4,7 +4,7 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def expr(i: Int)(using QuoteContext) = '{ + def expr(i: Int)(using Quotes) = '{ val a = 3 + ${Expr(i)} 2 + a } diff --git a/tests/run-staging/quote-run-staged-interpreter.scala b/tests/run-staging/quote-run-staged-interpreter.scala index 4209b1bd70c3..ea45cb8ae3c8 100644 --- a/tests/run-staging/quote-run-staged-interpreter.scala +++ b/tests/run-staging/quote-run-staged-interpreter.scala @@ -11,7 +11,7 @@ enum Exp { object Test { import Exp._ - def compile(e: Exp, env: Map[String, Expr[Int]], keepLets: Boolean)(using QuoteContext): Expr[Int] = { + def compile(e: Exp, env: Map[String, Expr[Int]], keepLets: Boolean)(using Quotes): Expr[Int] = { def compileImpl(e: Exp, env: Map[String, Expr[Int]]): Expr[Int] = e match { case Num(n) => Expr(n) case Plus(e1, e2) => '{${compileImpl(e1, env)} + ${compileImpl(e2, env)}} @@ -31,10 +31,10 @@ object Test { val exp = Plus(Plus(Num(2), Var("x")), Num(4)) val letExp = Let("x", Num(3), exp) - def res1(using QuoteContext) = '{ (x: Int) => ${compile(exp, Map("x" -> 'x), false)} } + def res1(using Quotes) = '{ (x: Int) => ${compile(exp, Map("x" -> 'x), false)} } - println(withQuoteContext(res1.show)) + println(withQuotes(res1.show)) val fn = run(res1) println(fn(0)) @@ -43,14 +43,14 @@ object Test { println("---") - def res2(using QuoteContext) = compile(letExp, Map(), false) - println(withQuoteContext(res2.show)) + def res2(using Quotes) = compile(letExp, Map(), false) + println(withQuotes(res2.show)) println(run(res2)) println("---") - def res3(using QuoteContext) = compile(letExp, Map(), true) - println(withQuoteContext(res3.show)) + def res3(using Quotes) = compile(letExp, Map(), true) + println(withQuotes(res3.show)) println(run(res3)) } } diff --git a/tests/run-staging/quote-run-with-settings.scala b/tests/run-staging/quote-run-with-settings.scala index 2ec3c1f36c68..a0d54db942e4 100644 --- a/tests/run-staging/quote-run-with-settings.scala +++ b/tests/run-staging/quote-run-with-settings.scala @@ -7,12 +7,12 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def expr(using QuoteContext) = '{ + def expr(using Quotes) = '{ val a = 3 println("foo") 2 + a } - println(withQuoteContext(expr.show)) + println(withQuotes(expr.show)) println(run(expr)) println() diff --git a/tests/run-staging/quote-run.scala b/tests/run-staging/quote-run.scala index c816f102409f..f0b543cfee47 100644 --- a/tests/run-staging/quote-run.scala +++ b/tests/run-staging/quote-run.scala @@ -4,13 +4,13 @@ import scala.quoted.staging._ object Test { def main(args: Array[String]): Unit = { given Toolbox = Toolbox.make(getClass.getClassLoader) - def expr(using QuoteContext) = '{ + def expr(using Quotes) = '{ val a = 3 println("foo") 2 + a } println(run(expr)) println(run(expr)) - println(withQuoteContext(expr.show)) + println(withQuotes(expr.show)) } } diff --git a/tests/run-staging/quote-simple-hole.scala b/tests/run-staging/quote-simple-hole.scala index 45fecd13b840..6c165c8de30d 100644 --- a/tests/run-staging/quote-simple-hole.scala +++ b/tests/run-staging/quote-simple-hole.scala @@ -4,7 +4,7 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val x = '{0} val y = '{$x} val z = '{${'{$y}}} diff --git a/tests/run-staging/quote-type-matcher.scala b/tests/run-staging/quote-type-matcher.scala index 46edb7c9267b..97e2efedd34e 100644 --- a/tests/run-staging/quote-type-matcher.scala +++ b/tests/run-staging/quote-type-matcher.scala @@ -4,7 +4,7 @@ import scala.reflect.ClassTag object Test { given Toolbox = Toolbox.make(this.getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { val '[List[Int]] = Type.of[List[Int]] Type.of[List[Int]] match diff --git a/tests/run-staging/quote-unrolled-foreach.scala b/tests/run-staging/quote-unrolled-foreach.scala index 93641d50cc12..b697c99846c6 100644 --- a/tests/run-staging/quote-unrolled-foreach.scala +++ b/tests/run-staging/quote-unrolled-foreach.scala @@ -5,31 +5,31 @@ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) def main(args: Array[String]): Unit = run { - def code1(using QuoteContext) = '{ (arr: Array[Int], f: Int => Unit) => ${ foreach1('arr, 'f) } } + def code1(using Quotes) = '{ (arr: Array[Int], f: Int => Unit) => ${ foreach1('arr, 'f) } } println(code1.show) println() - def code1Tpe(using QuoteContext) = '{ (arr: Array[String], f: String => Unit) => ${ foreach1Tpe1('arr, 'f) } } + def code1Tpe(using Quotes) = '{ (arr: Array[String], f: String => Unit) => ${ foreach1Tpe1('arr, 'f) } } println(code1Tpe.show) println() - def code1Tpe2(using QuoteContext) = '{ (arr: Array[String], f: String => Unit) => ${ foreach1Tpe1('arr, 'f) } } + def code1Tpe2(using Quotes) = '{ (arr: Array[String], f: String => Unit) => ${ foreach1Tpe1('arr, 'f) } } println(code1Tpe2.show) println() - def code2(using QuoteContext) = '{ (arr: Array[Int]) => ${ foreach1('arr, '{i => System.out.println(i)}) } } + def code2(using Quotes) = '{ (arr: Array[Int]) => ${ foreach1('arr, '{i => System.out.println(i)}) } } println(code2.show) println() - def code3(using QuoteContext) = '{ (arr: Array[Int], f: Int => Unit) => ${ foreach3('arr, 'f) } } + def code3(using Quotes) = '{ (arr: Array[Int], f: Int => Unit) => ${ foreach3('arr, 'f) } } println(code3.show) println() - def code4(using QuoteContext) = '{ (arr: Array[Int], f: Int => Unit) => ${ foreach4('arr, 'f, 4) } } + def code4(using Quotes) = '{ (arr: Array[Int], f: Int => Unit) => ${ foreach4('arr, 'f, 4) } } println(code4.show) println() - def liftedArray(using QuoteContext): Expr[Array[Int]] = Expr(Array(1, 2, 3, 4)) + def liftedArray(using Quotes): Expr[Array[Int]] = Expr(Array(1, 2, 3, 4)) println(liftedArray.show) println() @@ -43,7 +43,7 @@ object Test { '{} } - def foreach1(arrRef: Expr[Array[Int]], f: Expr[Int => Unit])(using QuoteContext): Expr[Unit] = '{ + def foreach1(arrRef: Expr[Array[Int]], f: Expr[Int => Unit])(using Quotes): Expr[Unit] = '{ val size = ($arrRef).length var i = 0 while (i < size) { @@ -53,7 +53,7 @@ object Test { } } - def foreach1Tpe1[T](arrRef: Expr[Array[T]], f: Expr[T => Unit])(implicit t: Type[T], qctx: QuoteContext): Expr[Unit] = '{ + def foreach1Tpe1[T](arrRef: Expr[Array[T]], f: Expr[T => Unit])(implicit t: Type[T], qctx: Quotes): Expr[Unit] = '{ val size = ($arrRef).length var i = 0 while (i < size) { @@ -63,7 +63,7 @@ object Test { } } - def foreach1Tpe2[T: Type](arrRef: Expr[Array[T]], f: Expr[T => Unit])(using QuoteContext): Expr[Unit] = '{ + def foreach1Tpe2[T: Type](arrRef: Expr[Array[T]], f: Expr[T => Unit])(using Quotes): Expr[Unit] = '{ val size = ($arrRef).length var i = 0 while (i < size) { @@ -73,7 +73,7 @@ object Test { } } - def foreach2(arrRef: Expr[Array[Int]], f: Expr[Int => Unit])(using QuoteContext): Expr[Unit] = '{ + def foreach2(arrRef: Expr[Array[Int]], f: Expr[Int => Unit])(using Quotes): Expr[Unit] = '{ val size = ($arrRef).length var i = 0 while (i < size) { @@ -83,7 +83,7 @@ object Test { } } - def foreach3(arrRef: Expr[Array[Int]], f: Expr[Int => Unit])(using QuoteContext): Expr[Unit] = '{ + def foreach3(arrRef: Expr[Array[Int]], f: Expr[Int => Unit])(using Quotes): Expr[Unit] = '{ val size = ($arrRef).length var i = 0 if (size % 3 != 0) throw new Exception("...")// for simplicity of the implementation @@ -95,7 +95,7 @@ object Test { } } - def foreach3_2(arrRef: Expr[Array[Int]], f: Expr[Int => Unit])(using QuoteContext): Expr[Unit] = '{ + def foreach3_2(arrRef: Expr[Array[Int]], f: Expr[Int => Unit])(using Quotes): Expr[Unit] = '{ val size = ($arrRef).length var i = 0 if (size % 3 != 0) throw new Exception("...")// for simplicity of the implementation @@ -107,7 +107,7 @@ object Test { } } - def foreach4(arrRef: Expr[Array[Int]], f: Expr[Int => Unit], unrollSize: Int)(using QuoteContext): Expr[Unit] = '{ + def foreach4(arrRef: Expr[Array[Int]], f: Expr[Int => Unit], unrollSize: Int)(using Quotes): Expr[Unit] = '{ val size = ($arrRef).length var i = 0 if (size % ${Expr(unrollSize)} != 0) throw new Exception("...") // for simplicity of the implementation @@ -125,7 +125,7 @@ object Test { } } - def foreachInRange(start: Int, end: Int)(f: Int => Expr[Unit])(using QuoteContext): Expr[Unit] = { + def foreachInRange(start: Int, end: Int)(f: Int => Expr[Unit])(using Quotes): Expr[Unit] = { @tailrec def unroll(i: Int, acc: Expr[Unit]): Expr[Unit] = if (i < end) unroll(i + 1, '{ $acc; ${f(i)} }) else acc if (start < end) unroll(start + 1, f(start)) else '{} diff --git a/tests/run-staging/quote-valueof-list.scala b/tests/run-staging/quote-valueof-list.scala index b48444dd7dc0..102c1d593060 100644 --- a/tests/run-staging/quote-valueof-list.scala +++ b/tests/run-staging/quote-valueof-list.scala @@ -5,7 +5,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { implicit def UnliftableInt: Unliftable[Int] = new { def fromExpr(n: Expr[Int]) = n match { diff --git a/tests/run-staging/quote-valueof.scala b/tests/run-staging/quote-valueof.scala index 7c40d3e0ad4e..6eaab5465d16 100644 --- a/tests/run-staging/quote-valueof.scala +++ b/tests/run-staging/quote-valueof.scala @@ -5,7 +5,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { println(('{}).unlift) println(('{true}).unlift) println(('{1}).unlift) diff --git a/tests/run-staging/quote-var.scala b/tests/run-staging/quote-var.scala index 4efc90dd5766..d72408ca05e3 100644 --- a/tests/run-staging/quote-var.scala +++ b/tests/run-staging/quote-var.scala @@ -4,18 +4,18 @@ import scala.quoted.staging._ object Test { sealed trait Var { - def get(using QuoteContext): Expr[String] - def update(x: Expr[String])(using QuoteContext): Expr[Unit] + def get(using Quotes): Expr[String] + def update(x: Expr[String])(using Quotes): Expr[Unit] } object Var { - def apply(init: Expr[String])(body: Var => Expr[String])(using QuoteContext): Expr[String] = '{ + def apply(init: Expr[String])(body: Var => Expr[String])(using Quotes): Expr[String] = '{ var x = $init ${ body( new Var { - def get(using QuoteContext): Expr[String] = 'x - def update(e: Expr[String])(using QuoteContext): Expr[Unit] = '{ x = $e } + def get(using Quotes): Expr[String] = 'x + def update(e: Expr[String])(using Quotes): Expr[Unit] = '{ x = $e } } ) } @@ -23,7 +23,7 @@ object Test { } - def test1()(using QuoteContext): Expr[String] = Var('{"abc"}) { x => + def test1()(using Quotes): Expr[String] = Var('{"abc"}) { x => '{ ${ x.update('{"xyz"}) } ${ x.get } diff --git a/tests/run-staging/shonan-hmm-simple.scala b/tests/run-staging/shonan-hmm-simple.scala index 01409d8f1f0e..5b40b7d878e7 100644 --- a/tests/run-staging/shonan-hmm-simple.scala +++ b/tests/run-staging/shonan-hmm-simple.scala @@ -17,7 +17,7 @@ class RingInt extends Ring[Int]: val mul = (x, y) => x * y -class RingIntExpr(using QuoteContext) extends Ring[Expr[Int]]: +class RingIntExpr(using Quotes) extends Ring[Expr[Int]]: val zero = '{0} val one = '{1} val add = (x, y) => '{$x + $y} @@ -32,15 +32,15 @@ class RingComplex[U](u: Ring[U]) extends Ring[Complex[U]]: val mul = (x, y) => Complex(u.sub(u.mul(x.re, y.re), u.mul(x.im, y.im)), u.add(u.mul(x.re, y.im), u.mul(x.im, y.re))) sealed trait PV[T]: - def expr(using Liftable[T], QuoteContext): Expr[T] + def expr(using Liftable[T], Quotes): Expr[T] case class Sta[T](x: T) extends PV[T]: - def expr(using Liftable[T], QuoteContext): Expr[T] = Expr(x) + def expr(using Liftable[T], Quotes): Expr[T] = Expr(x) case class Dyn[T](x: Expr[T]) extends PV[T]: - def expr(using Liftable[T], QuoteContext): Expr[T] = x + def expr(using Liftable[T], Quotes): Expr[T] = x -class RingPV[U: Liftable](u: Ring[U], eu: Ring[Expr[U]])(using QuoteContext) extends Ring[PV[U]]: +class RingPV[U: Liftable](u: Ring[U], eu: Ring[Expr[U]])(using Quotes) extends Ring[PV[U]]: val zero: PV[U] = Sta(u.zero) val one: PV[U] = Sta(u.one) val add = (x: PV[U], y: PV[U]) => (x, y) match @@ -83,7 +83,7 @@ class StaticVecOps[T] extends VecOps[Int, T]: sum = plus(sum, vec.get(i)) sum -class ExprVecOps[T: Type](using QuoteContext) extends VecOps[Expr[Int], Expr[T]]: +class ExprVecOps[T: Type](using Quotes) extends VecOps[Expr[Int], Expr[T]]: val reduce: ((Expr[T], Expr[T]) => Expr[T], Expr[T], Vec[Expr[Int], Expr[T]]) => Expr[T] = (plus, zero, vec) => '{ var sum = $zero var i = 0 @@ -123,17 +123,17 @@ object Test: println(res2) println() - def blasStaticIntExpr(using QuoteContext) = new Blas1(new RingIntExpr, new StaticVecOps) - def resCode1(using QuoteContext) = blasStaticIntExpr.dot( + def blasStaticIntExpr(using Quotes) = new Blas1(new RingIntExpr, new StaticVecOps) + def resCode1(using Quotes) = blasStaticIntExpr.dot( vec1.map(Expr(_)), vec2.map(Expr(_)) ) - println(withQuoteContext(resCode1.show)) + println(withQuotes(resCode1.show)) println(run(resCode1)) println() - def blasExprIntExpr(using QuoteContext) = new Blas1(new RingIntExpr, new ExprVecOps) - def resCode2(using QuoteContext): Expr[(Array[Int], Array[Int]) => Int] = '{ + def blasExprIntExpr(using Quotes) = new Blas1(new RingIntExpr, new ExprVecOps) + def resCode2(using Quotes): Expr[(Array[Int], Array[Int]) => Int] = '{ (arr1, arr2) => if (arr1.length != arr2.length) throw new Exception("...") ${ @@ -143,21 +143,21 @@ object Test: ) } } - println(withQuoteContext(resCode2.show)) + println(withQuotes(resCode2.show)) println(run(resCode2).apply(arr1, arr2)) println() - def blasStaticIntPVExpr(using QuoteContext) = new Blas1(new RingPV[Int](new RingInt, new RingIntExpr), new StaticVecOps) - def resCode3(using QuoteContext) = blasStaticIntPVExpr.dot( + def blasStaticIntPVExpr(using Quotes) = new Blas1(new RingPV[Int](new RingInt, new RingIntExpr), new StaticVecOps) + def resCode3(using Quotes) = blasStaticIntPVExpr.dot( vec1.map(i => Dyn(Expr(i))), vec2.map(i => Sta(i)) ).expr - println(withQuoteContext(resCode3.show)) + println(withQuotes(resCode3.show)) println(run(resCode3)) println() - def blasExprIntPVExpr(using QuoteContext) = new Blas1(new RingPV[Int](new RingInt, new RingIntExpr), new StaticVecOps) - def resCode4(using QuoteContext): Expr[Array[Int] => Int] = '{ + def blasExprIntPVExpr(using Quotes) = new Blas1(new RingPV[Int](new RingInt, new RingIntExpr), new StaticVecOps) + def resCode4(using Quotes): Expr[Array[Int] => Int] = '{ arr => if (arr.length != ${Expr(vec2.size)}) throw new Exception("...") ${ @@ -168,13 +168,13 @@ object Test: } } - println(withQuoteContext(resCode4.show)) + println(withQuotes(resCode4.show)) println(run(resCode4).apply(arr1)) println() import Complex.isLiftable - def blasExprComplexPVInt(using QuoteContext) = new Blas1[Int, Complex[PV[Int]]](new RingComplex(new RingPV[Int](new RingInt, new RingIntExpr)), new StaticVecOps) - def resCode5(using QuoteContext): Expr[Array[Complex[Int]] => Complex[Int]] = '{ + def blasExprComplexPVInt(using Quotes) = new Blas1[Int, Complex[PV[Int]]](new RingComplex(new RingPV[Int](new RingInt, new RingIntExpr)), new StaticVecOps) + def resCode5(using Quotes): Expr[Array[Complex[Int]] => Complex[Int]] = '{ arr => if (arr.length != ${Expr(cmpxVec2.size)}) throw new Exception("...") ${ @@ -185,16 +185,16 @@ object Test: '{Complex(${cpx.re.expr}, ${cpx.im.expr})} } } - println(withQuoteContext(resCode5.show)) + println(withQuotes(resCode5.show)) println(run(resCode5).apply(cmpxArr1)) println() - def RingPVInt(using QuoteContext) = new RingPV[Int](new RingInt, new RingIntExpr) + def RingPVInt(using Quotes) = new RingPV[Int](new RingInt, new RingIntExpr) // Staged loop of dot product on vectors of Int or Expr[Int] - def dotIntOptExpr(using QuoteContext) = new Blas1(RingPVInt, new StaticVecOps).dot + def dotIntOptExpr(using Quotes) = new Blas1(RingPVInt, new StaticVecOps).dot // will generate the code '{ ((arr: scala.Array[scala.Int]) => arr.apply(1).+(arr.apply(3))) } - def staticVec(using QuoteContext) = Vec[Int, PV[Int]](5, i => Sta((i % 2))) - def code(using QuoteContext) = '{(arr: Array[Int]) => ${dotIntOptExpr(Vec(5, i => Dyn('{arr(${Expr(i)})})), staticVec).expr} } - println(withQuoteContext(code.show)) + def staticVec(using Quotes) = Vec[Int, PV[Int]](5, i => Sta((i % 2))) + def code(using Quotes) = '{(arr: Array[Int]) => ${dotIntOptExpr(Vec(5, i => Dyn('{arr(${Expr(i)})})), staticVec).expr} } + println(withQuotes(code.show)) println() diff --git a/tests/run-staging/shonan-hmm/Complex.scala b/tests/run-staging/shonan-hmm/Complex.scala index 85c3ee76762d..48f39314b59a 100644 --- a/tests/run-staging/shonan-hmm/Complex.scala +++ b/tests/run-staging/shonan-hmm/Complex.scala @@ -8,8 +8,8 @@ object Complex { def toExpr(c: Complex[T]) = '{ Complex(${Expr(c.re)}, ${Expr(c.im)}) } } - def of_complex_expr(x: Expr[Complex[Int]])(using QuoteContext): Complex[Expr[Int]] = Complex('{$x.re}, '{$x.im}) - def of_expr_complex(x: Complex[Expr[Int]])(using QuoteContext): Expr[Complex[Int]] = '{Complex(${x.re}, ${x.im})} + def of_complex_expr(x: Expr[Complex[Int]])(using Quotes): Complex[Expr[Int]] = Complex('{$x.re}, '{$x.im}) + def of_expr_complex(x: Complex[Expr[Int]])(using Quotes): Expr[Complex[Int]] = '{Complex(${x.re}, ${x.im})} } \ No newline at end of file diff --git a/tests/run-staging/shonan-hmm/Lifters.scala b/tests/run-staging/shonan-hmm/Lifters.scala index b0eacfb71f44..94381a84aff0 100644 --- a/tests/run-staging/shonan-hmm/Lifters.scala +++ b/tests/run-staging/shonan-hmm/Lifters.scala @@ -5,7 +5,7 @@ import scala.reflect.ClassTag import scala.quoted._ object Lifters { - implicit def LiftedClassTag[T: Type: ClassTag] (using QuoteContext): Expr[ClassTag[T]] = { + implicit def LiftedClassTag[T: Type: ClassTag] (using Quotes): Expr[ClassTag[T]] = { '{ ClassTag(${Expr(summon[ClassTag[T]].runtimeClass.asInstanceOf[Class[T]])}) } } @@ -23,7 +23,7 @@ object Lifters { } } - private def initArray[T : Liftable : Type](arr: Array[T], array: Expr[Array[T]])(using QuoteContext): Expr[Array[T]] = { + private def initArray[T : Liftable : Type](arr: Array[T], array: Expr[Array[T]])(using Quotes): Expr[Array[T]] = { UnrolledExpr.block( arr.zipWithIndex.map { case (x, i) => '{ $array(${Expr(i)}) = ${Expr(x)} } diff --git a/tests/run-staging/shonan-hmm/MVmult.scala b/tests/run-staging/shonan-hmm/MVmult.scala index b6ef09639d56..5a26c7c629b4 100644 --- a/tests/run-staging/shonan-hmm/MVmult.scala +++ b/tests/run-staging/shonan-hmm/MVmult.scala @@ -21,7 +21,7 @@ object MVmult { MV.mvmult(vout_, a_, v_) } - def mvmult_c(using QuoteContext): Expr[(Array[Int], Array[Array[Int]], Array[Int]) => Unit] = '{ + def mvmult_c(using Quotes): Expr[(Array[Int], Array[Array[Int]], Array[Int]) => Unit] = '{ (vout, a, v) => { val n = vout.length val m = v.length @@ -36,7 +36,7 @@ object MVmult { } } - def mvmult_mc(n: Int, m: Int)(using QuoteContext): Expr[(Array[Int], Array[Array[Int]], Array[Int]) => Unit] = { + def mvmult_mc(n: Int, m: Int)(using Quotes): Expr[(Array[Int], Array[Array[Int]], Array[Int]) => Unit] = { val MV = new MVmult[Int, Expr[Int], Expr[Unit]](new RingIntExpr, new VecRStaDim(new RingIntExpr)) '{ (vout, a, v) => { @@ -53,7 +53,7 @@ object MVmult { } } - def mvmult_ac(a: Array[Array[Int]])(using QuoteContext): Expr[(Array[Int], Array[Int]) => Unit] = { + def mvmult_ac(a: Array[Array[Int]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { import Lifters._ '{ val arr = ${Expr(a)} @@ -64,7 +64,7 @@ object MVmult { } } - def mvmult_opt(a: Array[Array[Int]])(using QuoteContext): Expr[(Array[Int], Array[Int]) => Unit] = { + def mvmult_opt(a: Array[Array[Int]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { import Lifters._ '{ val arr = ${Expr(a)} @@ -75,7 +75,7 @@ object MVmult { } } - def mvmult_roll(a: Array[Array[Int]])(using QuoteContext): Expr[(Array[Int], Array[Int]) => Unit] = { + def mvmult_roll(a: Array[Array[Int]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { import Lifters._ '{ val arr = ${Expr(a)} @@ -86,19 +86,19 @@ object MVmult { } } - def mvmult_let1(a: Array[Array[Int]])(using QuoteContext): Expr[(Array[Int], Array[Int]) => Unit] = { + def mvmult_let1(a: Array[Array[Int]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { val (n, m, a2) = amatCopy(a, copy_row1) mvmult_abs0(new RingIntOPExpr, new VecRStaOptDynInt(new RingIntPExpr))(n, m, a2) } - def mvmult_let(a: Array[Array[Int]])(using QuoteContext): Expr[(Array[Int], Array[Int]) => Unit] = { + def mvmult_let(a: Array[Array[Int]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { initRows(a) { rows => val (n, m, a2) = amat2(a, rows) mvmult_abs0(new RingIntOPExpr, new VecRStaOptDynInt(new RingIntPExpr))(n, m, a2) } } - def initRows[T: Type](a: Array[Array[Int]])(cont: Array[Expr[Array[Int]]] => Expr[T])(using QuoteContext): Expr[T] = { + def initRows[T: Type](a: Array[Array[Int]])(cont: Array[Expr[Array[Int]]] => Expr[T])(using Quotes): Expr[T] = { import Lifters._ def loop(i: Int, acc: List[Expr[Array[Int]]]): Expr[T] = { if (i >= a.length) cont(acc.toArray.reverse) @@ -113,7 +113,7 @@ object MVmult { loop(0, Nil) } - def amat1(a: Array[Array[Int]], aa: Expr[Array[Array[Int]]])(using QuoteContext): (Int, Int, Vec[PV[Int], Vec[PV[Int], PV[Int]]]) = { + def amat1(a: Array[Array[Int]], aa: Expr[Array[Array[Int]]])(using Quotes): (Int, Int, Vec[PV[Int], Vec[PV[Int], PV[Int]]]) = { val n = a.length val m = a(0).length val vec: Vec[PV[Int], Vec[PV[Int], PV[Int]]] = Vec(Sta(n), i => Vec(Sta(m), j => (i, j) match { @@ -124,7 +124,7 @@ object MVmult { (n, m, vec) } - def amat2(a: Array[Array[Int]], refs: Array[Expr[Array[Int]]])(using QuoteContext): (Int, Int, Vec[PV[Int], Vec[PV[Int], PV[Int]]]) = { + def amat2(a: Array[Array[Int]], refs: Array[Expr[Array[Int]]])(using Quotes): (Int, Int, Vec[PV[Int], Vec[PV[Int], PV[Int]]]) = { val n = a.length val m = a(0).length val vec: Vec[PV[Int], Vec[PV[Int], PV[Int]]] = Vec(Sta(n), i => Vec(Sta(m), j => (i, j) match { @@ -134,7 +134,7 @@ object MVmult { (n, m, vec) } - def amatCopy(a: Array[Array[Int]], copyRow: Array[Int] => (Expr[Int] => Expr[Int]))(using QuoteContext): (Int, Int, Vec[PV[Int], Vec[PV[Int], PV[Int]]]) = { + def amatCopy(a: Array[Array[Int]], copyRow: Array[Int] => (Expr[Int] => Expr[Int]))(using Quotes): (Int, Int, Vec[PV[Int], Vec[PV[Int], PV[Int]]]) = { val n = a.length val m = a(0).length val vec: Vec[PV[Int], Vec[PV[Int], PV[Int]]] = Vec(Sta(n), i => Vec(Sta(m), j => (i, j) match { @@ -147,19 +147,19 @@ object MVmult { (n, m, vec) } - def copy_row1(using QuoteContext): Array[Int] => (Expr[Int] => Expr[Int]) = v => { + def copy_row1(using Quotes): Array[Int] => (Expr[Int] => Expr[Int]) = v => { import Lifters._ val arr = Expr(v) i => '{ ($arr).apply($i) } } - def copy_row_let(using QuoteContext): Array[Int] => (Expr[Int] => Expr[Int]) = v => { + def copy_row_let(using Quotes): Array[Int] => (Expr[Int] => Expr[Int]) = v => { import Lifters._ val arr: Expr[Array[Int]] = ??? // FIXME used genlet v i => '{ ($arr).apply($i) } } - private def mvmult_abs0(ring: Ring[PV[Int]], vecOp: VecROp[PV[Int], PV[Int], Expr[Unit]])(n: Int, m: Int, a: Vec[PV[Int], Vec[PV[Int], PV[Int]]])(using QuoteContext): Expr[(Array[Int], Array[Int]) => Unit] = { + private def mvmult_abs0(ring: Ring[PV[Int]], vecOp: VecROp[PV[Int], PV[Int], Expr[Unit]])(n: Int, m: Int, a: Vec[PV[Int], Vec[PV[Int], PV[Int]]])(using Quotes): Expr[(Array[Int], Array[Int]) => Unit] = { '{ (vout, v) => { if (${Expr(n)} != vout.length) throw new IndexOutOfBoundsException(${Expr(n.toString)}) diff --git a/tests/run-staging/shonan-hmm/PV.scala b/tests/run-staging/shonan-hmm/PV.scala index cea37bb67cc3..a68158f9f5ed 100644 --- a/tests/run-staging/shonan-hmm/PV.scala +++ b/tests/run-staging/shonan-hmm/PV.scala @@ -8,12 +8,12 @@ case class Sta[T](x: T) extends PV[T] case class Dyn[T](x: Expr[T]) extends PV[T] object Dyn: - def apply[T: Liftable](x: T)(using QuoteContext): Dyn[T] = Dyn(Expr(x)) + def apply[T: Liftable](x: T)(using Quotes): Dyn[T] = Dyn(Expr(x)) object Dyns { - def dyn[T: Liftable](pv: PV[T])(using QuoteContext): Expr[T] = pv match { + def dyn[T: Liftable](pv: PV[T])(using Quotes): Expr[T] = pv match { case Sta(x) => Expr(x) case Dyn(x) => x } - def dyni(using QuoteContext): PV[Int] => Expr[Int] = dyn[Int] + def dyni(using Quotes): PV[Int] => Expr[Int] = dyn[Int] } diff --git a/tests/run-staging/shonan-hmm/Ring.scala b/tests/run-staging/shonan-hmm/Ring.scala index 02c930175446..594a4b60cc84 100644 --- a/tests/run-staging/shonan-hmm/Ring.scala +++ b/tests/run-staging/shonan-hmm/Ring.scala @@ -24,7 +24,7 @@ object RingInt extends Ring[Int] { override def toString(): String = "RingInt" } -class RingIntExpr(using QuoteContext) extends Ring[Expr[Int]] { +class RingIntExpr(using Quotes) extends Ring[Expr[Int]] { val zero = '{0} val one = '{1} val add = (x, y) => '{$x + $y} @@ -43,7 +43,7 @@ case class RingComplex[U](u: Ring[U]) extends Ring[Complex[U]] { override def toString(): String = s"RingComplex($u)" } -case class RingPV[U: Liftable](staRing: Ring[U], dynRing: Ring[Expr[U]])(using QuoteContext) extends Ring[PV[U]] { +case class RingPV[U: Liftable](staRing: Ring[U], dynRing: Ring[Expr[U]])(using Quotes) extends Ring[PV[U]] { type T = PV[U] val dyn = Dyns.dyn[U] @@ -66,9 +66,9 @@ case class RingPV[U: Liftable](staRing: Ring[U], dynRing: Ring[Expr[U]])(using Q } } -class RingIntPExpr(using QuoteContext) extends RingPV(RingInt, new RingIntExpr) +class RingIntPExpr(using Quotes) extends RingPV(RingInt, new RingIntExpr) -class RingIntOPExpr(using QuoteContext) extends RingIntPExpr { +class RingIntOPExpr(using Quotes) extends RingIntPExpr { override def add = (x: PV[Int], y: PV[Int]) => (x, y) match { case (Sta(0), y) => y case (x, Sta(0)) => x diff --git a/tests/run-staging/shonan-hmm/Test.scala b/tests/run-staging/shonan-hmm/Test.scala index 93f8b0cce4c3..83780ab0be8e 100644 --- a/tests/run-staging/shonan-hmm/Test.scala +++ b/tests/run-staging/shonan-hmm/Test.scala @@ -7,7 +7,7 @@ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { { val intComplex = new RingComplex(RingInt) diff --git a/tests/run-staging/shonan-hmm/UnrolledExpr.scala b/tests/run-staging/shonan-hmm/UnrolledExpr.scala index a761496bd948..773508e2f0a7 100644 --- a/tests/run-staging/shonan-hmm/UnrolledExpr.scala +++ b/tests/run-staging/shonan-hmm/UnrolledExpr.scala @@ -8,7 +8,7 @@ object UnrolledExpr { } // TODO support blocks in the compiler to avoid creating trees of blocks? - def block[T: Type](stats: Iterable[Expr[_]], expr: Expr[T])(using QuoteContext): Expr[T] = { + def block[T: Type](stats: Iterable[Expr[_]], expr: Expr[T])(using Quotes): Expr[T] = { def rec(stats: List[Expr[_]]): Expr[T] = stats match { case x :: xs => '{ $x; ${rec(xs)} } case Nil => expr @@ -21,10 +21,10 @@ object UnrolledExpr { class UnrolledExpr[T: Liftable, It <: Iterable[T]](xs: It) { import UnrolledExpr._ - def foreach[U](f: T => Expr[U])(using QuoteContext): Expr[Unit] = block(xs.map(f), '{}) + def foreach[U](f: T => Expr[U])(using Quotes): Expr[Unit] = block(xs.map(f), '{}) - def withFilter(f: T => Boolean)(using QuoteContext): UnrolledExpr[T, Iterable[T]] = new UnrolledExpr(xs.filter(f)) + def withFilter(f: T => Boolean)(using Quotes): UnrolledExpr[T, Iterable[T]] = new UnrolledExpr(xs.filter(f)) - def foldLeft[U](acc: Expr[U])(f: (Expr[U], T) => Expr[U])(using QuoteContext): Expr[U] = + def foldLeft[U](acc: Expr[U])(f: (Expr[U], T) => Expr[U])(using Quotes): Expr[U] = xs.foldLeft(acc)((acc, x) => f(acc, x)) } diff --git a/tests/run-staging/shonan-hmm/VecOp.scala b/tests/run-staging/shonan-hmm/VecOp.scala index 011657deffbe..930330640f8c 100644 --- a/tests/run-staging/shonan-hmm/VecOp.scala +++ b/tests/run-staging/shonan-hmm/VecOp.scala @@ -12,7 +12,7 @@ class VecSta extends VecOp[Int, Unit] { override def toString(): String = s"StaticVec" } -class VecDyn(using QuoteContext) extends VecOp[Expr[Int], Expr[Unit]] { +class VecDyn(using Quotes) extends VecOp[Expr[Int], Expr[Unit]] { def iter: Vec[Expr[Int], Expr[Unit]] => Expr[Unit] = arr => '{ var i = 0 while (i < ${arr.size}) { diff --git a/tests/run-staging/shonan-hmm/VecROp.scala b/tests/run-staging/shonan-hmm/VecROp.scala index 14bbe1570c06..b4f1eaf3e902 100644 --- a/tests/run-staging/shonan-hmm/VecROp.scala +++ b/tests/run-staging/shonan-hmm/VecROp.scala @@ -16,7 +16,7 @@ class StaticVecR[T](r: Ring[T]) extends VecSta with VecROp[Int, T, Unit] { override def toString(): String = s"StaticVecR($r)" } -class VecRDyn[T: Type](using QuoteContext) extends VecDyn with VecROp[Expr[Int], Expr[T], Expr[Unit]] { +class VecRDyn[T: Type](using Quotes) extends VecDyn with VecROp[Expr[Int], Expr[T], Expr[Unit]] { def reduce: ((Expr[T], Expr[T]) => Expr[T], Expr[T], Vec[Expr[Int], Expr[T]]) => Expr[T] = { (plus, zero, vec) => '{ var sum = $zero @@ -31,7 +31,7 @@ class VecRDyn[T: Type](using QuoteContext) extends VecDyn with VecROp[Expr[Int], override def toString(): String = s"VecRDyn" } -class VecRStaDim[T: Type](r: Ring[T])(using QuoteContext) extends VecROp[Int, T, Expr[Unit]] { +class VecRStaDim[T: Type](r: Ring[T])(using Quotes) extends VecROp[Int, T, Expr[Unit]] { val M = new StaticVecR[T](r) def reduce: ((T, T) => T, T, Vec[Int, T]) => T = M.reduce val seq: (Expr[Unit], Expr[Unit]) => Expr[Unit] = (e1, e2) => '{ $e1; $e2 } @@ -45,7 +45,7 @@ class VecRStaDim[T: Type](r: Ring[T])(using QuoteContext) extends VecROp[Int, T, override def toString(): String = s"VecRStaDim($r)" } -class VecRStaDyn[T : Type : Liftable](r: Ring[PV[T]])(using QuoteContext) extends VecROp[PV[Int], PV[T], Expr[Unit]] { +class VecRStaDyn[T : Type : Liftable](r: Ring[PV[T]])(using Quotes) extends VecROp[PV[Int], PV[T], Expr[Unit]] { val VSta: VecROp[Int, PV[T], Expr[Unit]] = new VecRStaDim(r) val VDyn = new VecRDyn val dyn = Dyns.dyn[T] @@ -73,7 +73,7 @@ object VecRStaOptDynInt { val threshold = 3 } -class VecRStaOptDynInt(r: Ring[PV[Int]]) (using QuoteContext) extends VecRStaDyn(r) { +class VecRStaOptDynInt(r: Ring[PV[Int]]) (using Quotes) extends VecRStaDyn(r) { val M: VecROp[PV[Int], PV[Int], Expr[Unit]] = new VecRStaDyn(r) override def reduce: ((PV[Int], PV[Int]) => PV[Int], PV[Int], Vec[PV[Int], PV[Int]]) => PV[Int] = (plus, zero, vec) => vec match { diff --git a/tests/run-staging/shonan-hmm/Vmults.scala b/tests/run-staging/shonan-hmm/Vmults.scala index e61b5bd7837b..982104399ec2 100644 --- a/tests/run-staging/shonan-hmm/Vmults.scala +++ b/tests/run-staging/shonan-hmm/Vmults.scala @@ -19,7 +19,7 @@ object Vmults { V.vmult(vout_, v1_, v2_) } - def vmultCA(using QuoteContext): Expr[(Array[Complex[Int]], Array[Complex[Int]], Array[Complex[Int]]) => Unit] = '{ + def vmultCA(using Quotes): Expr[(Array[Complex[Int]], Array[Complex[Int]], Array[Complex[Int]]) => Unit] = '{ (vout, v1, v2) => { val n = vout.length ${ diff --git a/tests/run-staging/staged-streams_1.scala b/tests/run-staging/staged-streams_1.scala index 48966daae6e3..a7af15f9ef6e 100644 --- a/tests/run-staging/staged-streams_1.scala +++ b/tests/run-staging/staged-streams_1.scala @@ -7,7 +7,7 @@ import language.experimental.namedTypeArguments */ object Test { - type E[T] = QuoteContext ?=> Expr[T] + type E[T] = Quotes ?=> Expr[T] /*** Producer represents a linear production of values with a loop structure. * @@ -204,7 +204,7 @@ object Test { * @return a new stream consisting of all elements of the input stream that do satisfy the given * predicate `pred`. */ - def filter(pred: (Expr[A] => Expr[Boolean]))(using QuoteContext): Stream[A] = { + def filter(pred: (Expr[A] => Expr[Boolean]))(using Quotes): Stream[A] = { val filterStream = (a: Expr[A]) => new Producer[Expr[A]] { @@ -304,7 +304,7 @@ object Test { * @tparam A the type of the producer's elements. * @return a linear or nested stream aware of the variable reference to decrement. */ - private def takeRaw[A: Type](n: Expr[Int], stream: StagedStream[A])(using QuoteContext): StagedStream[A] = { + private def takeRaw[A: Type](n: Expr[Int], stream: StagedStream[A])(using Quotes): StagedStream[A] = { stream match { case linear: Linear[A] => { val enhancedProducer: Producer[(Var[Int], A)] = addCounter[A](n, linear.producer) @@ -333,9 +333,9 @@ object Test { } /** A stream containing the first `n` elements of this stream. */ - def take(n: Expr[Int])(using QuoteContext): Stream[A] = Stream(takeRaw[Expr[A]](n, stream)) + def take(n: Expr[Int])(using Quotes): Stream[A] = Stream(takeRaw[Expr[A]](n, stream)) - private def zipRaw[A: Type, B: Type](stream1: StagedStream[Expr[A]], stream2: StagedStream[B])(using QuoteContext): StagedStream[(Expr[A], B)] = { + private def zipRaw[A: Type, B: Type](stream1: StagedStream[Expr[A]], stream2: StagedStream[B])(using Quotes): StagedStream[(Expr[A], B)] = { (stream1, stream2) match { case (Linear(producer1), Linear(producer2)) => @@ -403,7 +403,7 @@ object Test { * @tparam A * @return */ - private def makeLinear[A: Type](stream: StagedStream[Expr[A]])(using QuoteContext): Producer[Expr[A]] = { + private def makeLinear[A: Type](stream: StagedStream[Expr[A]])(using Quotes): Producer[Expr[A]] = { stream match { case Linear(producer) => producer case Nested(producer, nestedf) => { @@ -506,7 +506,7 @@ object Test { } } - private def pushLinear[A, B, C](producer: Producer[A], nestedProducer: Producer[B], nestedf: (B => StagedStream[C]))(using QuoteContext): StagedStream[(A, C)] = { + private def pushLinear[A, B, C](producer: Producer[A], nestedProducer: Producer[B], nestedf: (B => StagedStream[C]))(using Quotes): StagedStream[(A, C)] = { val newProducer = new Producer[(Var[Boolean], producer.St, B)] { type St = (Var[Boolean], producer.St, nestedProducer.St) @@ -564,14 +564,14 @@ object Test { } /** zip **/ - def zip[B: Type, C: Type](f: (Expr[A] => Expr[B] => Expr[C]), stream2: Stream[B])(using QuoteContext): Stream[C] = { + def zip[B: Type, C: Type](f: (Expr[A] => Expr[B] => Expr[C]), stream2: Stream[B])(using Quotes): Stream[C] = { val Stream(stream_b) = stream2 Stream(mapRaw[(Expr[A], Expr[B]), Expr[C]]((t => k => k(f(t._1)(t._2))), zipRaw[A, Expr[B]](stream, stream_b))) } } object Stream { - def of[A: Type](arr: Expr[Array[A]])(using QuoteContext): Stream[A] = { + def of[A: Type](arr: Expr[Array[A]])(using Quotes): Stream[A] = { val prod = new Producer[Expr[A]] { type St = (Var[Int], Var[Int], Expr[Array[A]]) @@ -606,52 +606,52 @@ object Test { } } - def test1()(using QuoteContext) = Stream + def test1()(using Quotes) = Stream .of('{Array(1, 2, 3)}) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test2()(using QuoteContext) = Stream + def test2()(using Quotes) = Stream .of('{Array(1, 2, 3)}) .map((a: Expr[Int]) => '{ $a * 2 }) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test3()(using QuoteContext) = Stream + def test3()(using Quotes) = Stream .of('{Array(1, 2, 3)}) .flatMap((d: Expr[Int]) => Stream.of('{Array(1, 2, 3)}).map((dp: Expr[Int]) => '{ $d * $dp })) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test4()(using QuoteContext) = Stream + def test4()(using Quotes) = Stream .of('{Array(1, 2, 3)}) .filter((d: Expr[Int]) => '{ $d % 2 == 0 }) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test5()(using QuoteContext) = Stream + def test5()(using Quotes) = Stream .of('{Array(1, 2, 3)}) .take('{2}) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test6()(using QuoteContext) = Stream + def test6()(using Quotes) = Stream .of('{Array(1, 1, 1)}) .flatMap((d: Expr[Int]) => Stream.of('{Array(1, 2, 3)}).take('{2})) .take('{5}) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test7()(using QuoteContext) = Stream + def test7()(using Quotes) = Stream .of('{Array(1, 2, 3)}) .zip(((a : Expr[Int]) => (b : Expr[Int]) => '{ $a + $b }), Stream.of('{Array(1, 2, 3)})) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test8()(using QuoteContext) = Stream + def test8()(using Quotes) = Stream .of('{Array(1, 2, 3)}) .zip(((a : Expr[Int]) => (b : Expr[Int]) => '{ $a + $b }), Stream.of('{Array(1, 2, 3)}).flatMap((d: Expr[Int]) => Stream.of('{Array(1, 2, 3)}).map((dp: Expr[Int]) => '{ $d + $dp }))) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test9()(using QuoteContext) = Stream + def test9()(using Quotes) = Stream .of('{Array(1, 2, 3)}).flatMap((d: Expr[Int]) => Stream.of('{Array(1, 2, 3)}).map((dp: Expr[Int]) => '{ $d + $dp })) .zip(((a : Expr[Int]) => (b : Expr[Int]) => '{ $a + $b }), Stream.of('{Array(1, 2, 3)}) ) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) - def test10()(using QuoteContext) = Stream + def test10()(using Quotes) = Stream .of('{Array(1, 2, 3)}).flatMap((d: Expr[Int]) => Stream.of('{Array(1, 2, 3)}).map((dp: Expr[Int]) => '{ $d + $dp })) .zip(((a : Expr[Int]) => (b : Expr[Int]) => '{ $a + $b }), Stream.of('{Array(1, 2, 3)}).flatMap((d: Expr[Int]) => Stream.of('{Array(1, 2, 3)}).map((dp: Expr[Int]) => '{ $d + $dp })) ) .fold('{0}, ((a: Expr[Int], b : Expr[Int]) => '{ $a + $b })) @@ -681,18 +681,18 @@ object Test { } sealed trait Var[T] { - def get(using qctx: QuoteContext): Expr[T] - def update(e: Expr[T])(using qctx: QuoteContext): Expr[Unit] + def get(using Quotes): Expr[T] + def update(e: Expr[T])(using Quotes): Expr[Unit] } object Var { - def apply[T: Type, U: Type](init: Expr[T])(body: Var[T] => Expr[U])(using qctx: QuoteContext): Expr[U] = '{ + def apply[T: Type, U: Type](init: Expr[T])(body: Var[T] => Expr[U])(using Quotes): Expr[U] = '{ var x = $init ${ body( new Var[T] { - def get(using qctx: QuoteContext): Expr[T] = 'x - def update(e: Expr[T])(using qctx: QuoteContext): Expr[Unit] = '{ x = $e } + def get(using Quotes): Expr[T] = 'x + def update(e: Expr[T])(using Quotes): Expr[Unit] = '{ x = $e } } ) } diff --git a/tests/run-staging/staged-tuples/StagedTuple.scala b/tests/run-staging/staged-tuples/StagedTuple.scala index 9640a0640e81..9cc4f045abe5 100644 --- a/tests/run-staging/staged-tuples/StagedTuple.scala +++ b/tests/run-staging/staged-tuples/StagedTuple.scala @@ -15,7 +15,7 @@ object StagedTuple { private final val specialize = true - def toArrayStaged(tup: Expr[Tuple], size: Option[Int])(using QuoteContext): Expr[Array[Object]] = { + def toArrayStaged(tup: Expr[Tuple], size: Option[Int])(using Quotes): Expr[Array[Object]] = { if (!specialize) '{scala.runtime.Tuple.toArray($tup)} else size match { case Some(0) => @@ -35,7 +35,7 @@ object StagedTuple { } } - def fromArrayStaged[T <: Tuple : Type](xs: Expr[Array[Object]], size: Option[Int])(using QuoteContext): Expr[T] = { + def fromArrayStaged[T <: Tuple : Type](xs: Expr[Array[Object]], size: Option[Int])(using Quotes): Expr[T] = { if (!specialize) '{scala.runtime.Tuple.fromArray($xs)}.as[T] else xs.bind { xs => val tup: Expr[Any] = size match { @@ -69,7 +69,7 @@ object StagedTuple { } } - def sizeStaged[Res <: Int : Type](tup: Expr[Tuple], size: Option[Int])(using QuoteContext): Expr[Res] = { + def sizeStaged[Res <: Int : Type](tup: Expr[Tuple], size: Option[Int])(using Quotes): Expr[Res] = { val res = if (!specialize) '{scala.runtime.Tuple.size($tup)} else size match { @@ -79,7 +79,7 @@ object StagedTuple { res.as[Res] } - def headStaged[Tup <: NonEmptyTuple : Type](tup: Expr[Tup], size: Option[Int])(using QuoteContext): Expr[Head[Tup]] = { + def headStaged[Tup <: NonEmptyTuple : Type](tup: Expr[Tup], size: Option[Int])(using Quotes): Expr[Head[Tup]] = { if (!specialize) '{scala.runtime.Tuple.apply($tup, 0)}.as[Head[Tup]] else { val resVal = size match { @@ -102,7 +102,7 @@ object StagedTuple { } } - def tailStaged[Tup <: NonEmptyTuple : Type](tup: Expr[Tup], size: Option[Int])(using QuoteContext): Expr[Tail[Tup]] = { + def tailStaged[Tup <: NonEmptyTuple : Type](tup: Expr[Tup], size: Option[Int])(using Quotes): Expr[Tail[Tup]] = { if (!specialize) '{scala.runtime.Tuple.tail($tup)}.as[Tail[Tup]] else { val res = size match { @@ -126,7 +126,7 @@ object StagedTuple { } } - def applyStaged[Tup <: NonEmptyTuple : Type, N <: Int : Type](tup: Expr[Tup], size: Option[Int], n: Expr[N], nValue: Option[Int])(using qctx: QuoteContext): Expr[Elem[Tup, N]] = { + def applyStaged[Tup <: NonEmptyTuple : Type, N <: Int : Type](tup: Expr[Tup], size: Option[Int], n: Expr[N], nValue: Option[Int])(using Quotes): Expr[Elem[Tup, N]] = { if (!specialize) '{scala.runtime.Tuple.apply($tup, $n)}.as[Elem[Tup, N]] else { @@ -185,7 +185,7 @@ object StagedTuple { } } - def consStaged[T <: Tuple & Singleton : Type, H : Type](self: Expr[T], x: Expr[H], tailSize: Option[Int])(using QuoteContext): Expr[H *: T] = + def consStaged[T <: Tuple & Singleton : Type, H : Type](self: Expr[T], x: Expr[H], tailSize: Option[Int])(using Quotes): Expr[H *: T] = if (!specialize) '{scala.runtime.Tuple.cons($x, $self)}.as[H *: T] else { val res = tailSize match { @@ -205,7 +205,7 @@ object StagedTuple { res.as[H *: T] } - def concatStaged[Self <: Tuple & Singleton : Type, That <: Tuple & Singleton : Type](self: Expr[Self], selfSize: Option[Int], that: Expr[That], thatSize: Option[Int])(using QuoteContext): Expr[Concat[Self, That]] = { + def concatStaged[Self <: Tuple & Singleton : Type, That <: Tuple & Singleton : Type](self: Expr[Self], selfSize: Option[Int], that: Expr[That], thatSize: Option[Int])(using Quotes): Expr[Concat[Self, That]] = { if (!specialize) '{scala.runtime.Tuple.concat($self, $that)}.as[Concat[Self, That]] else { def genericConcat(xs: Expr[Tuple], ys: Expr[Tuple]): Expr[Tuple] = @@ -256,9 +256,9 @@ object StagedTuple { private implicit class ExprOps[U: Type](expr: Expr[U]) { - def as[T: Type](using QuoteContext): Expr[T] = '{ $expr.asInstanceOf[T] } + def as[T: Type](using Quotes): Expr[T] = '{ $expr.asInstanceOf[T] } - def bind[T: Type](in: Expr[U] => Expr[T])(using QuoteContext): Expr[T] = '{ + def bind[T: Type](in: Expr[U] => Expr[T])(using Quotes): Expr[T] = '{ val t: U = $expr ${in('t)} } diff --git a/tests/run-staging/tasty-extractors-constants-2/quoted_1.scala b/tests/run-staging/tasty-extractors-constants-2/quoted_1.scala index 74191d4879c5..70d6aed1f832 100644 --- a/tests/run-staging/tasty-extractors-constants-2/quoted_1.scala +++ b/tests/run-staging/tasty-extractors-constants-2/quoted_1.scala @@ -5,24 +5,24 @@ object Macros { inline def testMacro: Unit = ${impl} - def impl(using QuoteContext): Expr[Unit] = { + def impl(using Quotes): Expr[Unit] = { given Toolbox = Toolbox.make(getClass.getClassLoader) // 2 is a lifted constant - val show1 = withQuoteContext(power('{2}, '{3.0}).show) + val show1 = withQuotes(power('{2}, '{3.0}).show) val run1 = run(power('{2}, '{3.0})) // n is a lifted constant val n = 2 - val show2 = withQuoteContext(power(Expr(n), '{4.0}).show) + val show2 = withQuotes(power(Expr(n), '{4.0}).show) val run2 = run(power(Expr(n), '{4.0})) // n is a constant in a quote - val show3 = withQuoteContext(power('{2}, '{5.0}).show) + val show3 = withQuotes(power('{2}, '{5.0}).show) val run3 = run(power('{2}, '{5.0})) // n2 is not a constant - def n2(using QuoteContext) = '{ println("foo"); 2 } - val show4 = withQuoteContext(power(n2, '{6.0}).show) + def n2(using Quotes) = '{ println("foo"); 2 } + val show4 = withQuotes(power(n2, '{6.0}).show) val run4 = run(power(n2, '{6.0})) '{ @@ -40,14 +40,14 @@ object Macros { } } - def power(n: Expr[Int], x: Expr[Double])(using QuoteContext): Expr[Double] = { + def power(n: Expr[Int], x: Expr[Double])(using Quotes): Expr[Double] = { n.unlift match { case Some(n1) => powerCode(n1, x) case _ => '{ dynamicPower($n, $x) } } } - def powerCode(n: Int, x: Expr[Double])(using QuoteContext): Expr[Double] = + def powerCode(n: Int, x: Expr[Double])(using Quotes): Expr[Double] = if (n == 0) '{1.0} else if (n == 1) x else if (n % 2 == 0) '{ { val y = $x * $x; ${powerCode(n / 2, 'y)} } } diff --git a/tests/run-staging/unliftables.scala b/tests/run-staging/unliftables.scala index 45db63eabed3..fbc76762c50d 100644 --- a/tests/run-staging/unliftables.scala +++ b/tests/run-staging/unliftables.scala @@ -2,7 +2,7 @@ import scala.quoted._ import scala.quoted.staging._ object Test { given Toolbox = Toolbox.make(getClass.getClassLoader) - def main(args: Array[String]): Unit = withQuoteContext { + def main(args: Array[String]): Unit = withQuotes { println('{ true }.unlift) println('{ false }.unlift) println()