From b25eb23ff4825d3c780df81bed0a7f3d78093231 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Thu, 12 Nov 2020 09:15:27 +0100 Subject: [PATCH] Use asReflectTree --- .../community-projects/dotty-cps-async | 2 +- community-build/community-projects/munit | 2 +- community-build/community-projects/scalatest | 2 +- community-build/community-projects/shapeless | 2 +- community-build/community-projects/sourcecode | 2 +- community-build/community-projects/utest | 2 +- .../community-projects/xml-interpolator | 2 +- .../src-bootstrapped/scala/quoted/Const.scala | 2 +- .../src-bootstrapped/scala/quoted/Expr.scala | 4 +-- .../scala/quoted/ExprMap.scala | 4 +-- .../scala/quoted/Varargs.scala | 4 +-- library/src/scala/quoted/QuoteContext.scala | 3 -- library/src/scala/quoted/report.scala | 4 +-- tests/neg-macros/i6432/Macro_1.scala | 2 +- tests/neg-macros/i6432b/Macro_1.scala | 2 +- tests/neg-macros/i6976/Macro_1.scala | 2 +- tests/neg-macros/i7698.scala | 2 +- tests/neg-macros/i9801/Macro_1.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 | 6 ++-- .../Macro_1.scala | 2 +- .../Macro_1.scala | 2 +- tests/neg-staging/i5941/macro_1.scala | 6 ++-- .../pending/run/tasty-comments/quoted_1.scala | 2 +- tests/pos-macros/i6171/Macro_1.scala | 2 +- tests/pos-macros/i6535/Macro_1.scala | 4 +-- tests/pos-macros/i7011/Macros_1.scala | 2 +- tests/pos-macros/i7030/Macros_1.scala | 2 +- tests/pos-macros/i8325/Macro_1.scala | 2 +- tests/pos-macros/i8325b/Macro_1.scala | 2 +- tests/pos-macros/i8866/Macro_1.scala | 2 +- tests/pos-macros/i8866b/Macro_1.scala | 2 +- tests/pos-macros/i9251/Macro_1.scala | 2 +- tests/pos-macros/i9518/Macro_1.scala | 2 +- tests/pos-macros/i9687/Macro_1.scala | 6 ++-- tests/pos-macros/i9894/Macro_1.scala | 4 +-- tests/pos-macros/treemap-unapply/Macro.scala | 2 +- .../tasty-definitions-2/Macro_1.scala | 2 +- .../tasty-definitions-3/Macro_1.scala | 2 +- .../tasty-extractors-owners/quoted_1.scala | 2 +- .../tasty-load-tree-1/quoted_1.scala | 2 +- .../tasty-load-tree-2/quoted_1.scala | 2 +- .../f-interpolation-1/FQuote_1.scala | 4 +-- tests/run-macros/i10011/Macro_1.scala | 2 +- tests/run-macros/i5119/Macro_1.scala | 2 +- tests/run-macros/i5119b/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 | 2 +- tests/run-macros/i5715/Macro_1.scala | 2 +- tests/run-macros/i5941/macro_1.scala | 10 +++--- tests/run-macros/i6171/Macro_1.scala | 6 ++-- tests/run-macros/i6679/Macro_1.scala | 2 +- tests/run-macros/i7887/Macro_1.scala | 4 +-- tests/run-macros/i7898/Macro_1.scala | 4 +-- tests/run-macros/i8007/Macro_2.scala | 2 +- .../inferred-repeated-result/test_1.scala | 2 +- tests/run-macros/paramSymss/Macro_1.scala | 2 +- .../quote-matcher-runtime/quoted_1.scala | 4 +-- .../quote-matcher-symantics-1/quoted_1.scala | 2 +- .../quote-matcher-symantics-2/quoted_1.scala | 8 ++--- .../quote-matcher-symantics-3/quoted_1.scala | 4 +-- .../quote-matching-open/Macro_1.scala | 8 ++--- .../quoted-matching-docs/Macro_1.scala | 2 +- .../refined-selectable-macro/Macro_1.scala | 4 +-- tests/run-macros/reflect-dsl/assert_1.scala | 6 ++-- .../run-macros/reflect-lambda/assert_1.scala | 2 +- .../run-macros/reflect-pos-fun/assert_1.scala | 4 +-- .../reflect-select-constructor/assert_1.scala | 6 ++-- .../reflect-select-copy-2/assert_1.scala | 6 ++-- .../reflect-select-copy/assert_1.scala | 2 +- .../assert_1.scala | 6 ++-- .../reflect-select-value-class/assert_1.scala | 6 ++-- .../reflect-sourceCode/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 | 32 +++++++++---------- tests/run-macros/tasty-eval/quoted_1.scala | 2 +- .../tasty-extractors-1/quoted_1.scala | 2 +- .../tasty-extractors-2/quoted_1.scala | 2 +- .../tasty-extractors-3/quoted_1.scala | 2 +- .../tasty-interpolation-1/Macro.scala | 4 +-- .../tasty-macro-assert/quoted_1.scala | 2 +- .../tasty-macro-const/quoted_1.scala | 2 +- .../tasty-macro-positions/quoted_1.scala | 4 +-- .../tasty-original-source/Macros_1.scala | 2 +- .../tasty-overload-secondargs/Macro_1.scala | 4 +-- .../tasty-seal-method/quoted_1.scala | 12 +++---- .../Macros_1.scala | 4 +-- .../run-macros/tasty-tree-map/quoted_1.scala | 2 +- .../tasty-unsafe-let/quoted_1.scala | 4 +-- .../xml-interpolation-1/XmlQuote_1.scala | 4 +-- .../xml-interpolation-2/XmlQuote_1.scala | 4 +-- 96 files changed, 163 insertions(+), 166 deletions(-) diff --git a/community-build/community-projects/dotty-cps-async b/community-build/community-projects/dotty-cps-async index bb1eec6166dc..490d5b8d5383 160000 --- a/community-build/community-projects/dotty-cps-async +++ b/community-build/community-projects/dotty-cps-async @@ -1 +1 @@ -Subproject commit bb1eec6166dcef7e2fbe74a6baaee8041764471c +Subproject commit 490d5b8d5383aaf86035c8ac44d77a78ff0d1344 diff --git a/community-build/community-projects/munit b/community-build/community-projects/munit index 1ac6990e3906..4d0838585b3e 160000 --- a/community-build/community-projects/munit +++ b/community-build/community-projects/munit @@ -1 +1 @@ -Subproject commit 1ac6990e3906a5bc8cb927f50c864f530984f10c +Subproject commit 4d0838585b3eae5e3cf3981facab005fdd398bfb diff --git a/community-build/community-projects/scalatest b/community-build/community-projects/scalatest index 8572cb694988..70886a68b25b 160000 --- a/community-build/community-projects/scalatest +++ b/community-build/community-projects/scalatest @@ -1 +1 @@ -Subproject commit 8572cb6949889c08e5161dfed53e7dcce3a78793 +Subproject commit 70886a68b25b825bfe3951d168fb8584827392f8 diff --git a/community-build/community-projects/shapeless b/community-build/community-projects/shapeless index ed6a44f8a470..833f55065ce4 160000 --- a/community-build/community-projects/shapeless +++ b/community-build/community-projects/shapeless @@ -1 +1 @@ -Subproject commit ed6a44f8a4701dfd7d16e65c760c07b9611bacea +Subproject commit 833f55065ce4c7755abfe8bd92ed34231db86a4c diff --git a/community-build/community-projects/sourcecode b/community-build/community-projects/sourcecode index e03cb3ee6e79..db45b6e5f4b0 160000 --- a/community-build/community-projects/sourcecode +++ b/community-build/community-projects/sourcecode @@ -1 +1 @@ -Subproject commit e03cb3ee6e79407ff836197d00ae91bf81367b49 +Subproject commit db45b6e5f4b0303fbfef73589c913760836b816c diff --git a/community-build/community-projects/utest b/community-build/community-projects/utest index 566012ede653..1790701963a8 160000 --- a/community-build/community-projects/utest +++ b/community-build/community-projects/utest @@ -1 +1 @@ -Subproject commit 566012ede653bc1a6f3181291f03295bc34ece01 +Subproject commit 1790701963a8f700b95647cb67d8d142e69a102d diff --git a/community-build/community-projects/xml-interpolator b/community-build/community-projects/xml-interpolator index 52e0f24b01cf..d8b2254fcc9a 160000 --- a/community-build/community-projects/xml-interpolator +++ b/community-build/community-projects/xml-interpolator @@ -1 +1 @@ -Subproject commit 52e0f24b01cffd114375db4c741e1ff3ea71fbc8 +Subproject commit d8b2254fcc9a69091dd32ef5f0cdaf380c476473 diff --git a/library/src-bootstrapped/scala/quoted/Const.scala b/library/src-bootstrapped/scala/quoted/Const.scala index db45d2d8acc6..39c4ed0c0e08 100644 --- a/library/src-bootstrapped/scala/quoted/Const.scala +++ b/library/src-bootstrapped/scala/quoted/Const.scala @@ -23,7 +23,7 @@ object Const { case Inlined(_, Nil, e) => rec(e) case _ => None } - rec(expr.unseal) + rec(expr.asReflectTree) } } diff --git a/library/src-bootstrapped/scala/quoted/Expr.scala b/library/src-bootstrapped/scala/quoted/Expr.scala index 33e536d1fbda..d4f580b06fad 100644 --- a/library/src-bootstrapped/scala/quoted/Expr.scala +++ b/library/src-bootstrapped/scala/quoted/Expr.scala @@ -14,7 +14,7 @@ object Expr { * Some bindings may be elided as an early optimization. */ def betaReduce[T](expr: Expr[T])(using qctx: QuoteContext): Expr[T] = - qctx.reflect.Term.betaReduce(expr.unseal) match + qctx.reflect.Term.betaReduce(expr.asReflectTree) match case Some(expr1) => expr1.asExpr.asInstanceOf[Expr[T]] case _ => expr @@ -24,7 +24,7 @@ object Expr { */ def block[T](statements: List[Expr[Any]], expr: Expr[T])(using qctx: QuoteContext): Expr[T] = { import qctx.reflect._ - Block(statements.map(_.unseal), expr.unseal).asExpr.asInstanceOf[Expr[T]] + Block(statements.map(_.asReflectTree), expr.asReflectTree).asExpr.asInstanceOf[Expr[T]] } /** Lift a value into an expression containing the construction of that value */ diff --git a/library/src-bootstrapped/scala/quoted/ExprMap.scala b/library/src-bootstrapped/scala/quoted/ExprMap.scala index e609bf036f5d..d2076e6a8bce 100644 --- a/library/src-bootstrapped/scala/quoted/ExprMap.scala +++ b/library/src-bootstrapped/scala/quoted/ExprMap.scala @@ -104,7 +104,7 @@ trait ExprMap: type X val expr = tree.asExpr.asInstanceOf[Expr[X]] val t = tpe.asType.asInstanceOf[Type[X]] - transform(expr)(using qctx, t).unseal + transform(expr)(using qctx, t).asReflectTree case _ => transformTermChildren(tree, tpe) @@ -144,7 +144,7 @@ trait ExprMap: trees mapConserve (transformTypeCaseDef(_)) } - new MapChildren().transformTermChildren(e.unseal, TypeRepr.of[T]).asExprOf[T] + new MapChildren().transformTermChildren(e.asReflectTree, TypeRepr.of[T]).asExprOf[T] } end ExprMap diff --git a/library/src-bootstrapped/scala/quoted/Varargs.scala b/library/src-bootstrapped/scala/quoted/Varargs.scala index 5811dd338a25..4358c20653a8 100644 --- a/library/src-bootstrapped/scala/quoted/Varargs.scala +++ b/library/src-bootstrapped/scala/quoted/Varargs.scala @@ -17,7 +17,7 @@ object Varargs { */ def apply[T](xs: Seq[Expr[T]])(using tp: Type[T], qctx: QuoteContext): Expr[Seq[T]] = { import qctx.reflect._ - Repeated(xs.map[Term](_.unseal).toList, TypeTree.of[T]).asExpr.asInstanceOf[Expr[Seq[T]]] + Repeated(xs.map[Term](_.asReflectTree).toList, TypeTree.of[T]).asExpr.asInstanceOf[Expr[Seq[T]]] } /** Matches a literal sequence of expressions and return a sequence of expressions. @@ -40,7 +40,7 @@ object Varargs { case Inlined(_, Nil, e) => rec(e) case _ => None } - rec(expr.unseal) + rec(expr.asReflectTree) } } diff --git a/library/src/scala/quoted/QuoteContext.scala b/library/src/scala/quoted/QuoteContext.scala index ede10f80f1d0..e40f1dd4e679 100644 --- a/library/src/scala/quoted/QuoteContext.scala +++ b/library/src/scala/quoted/QuoteContext.scala @@ -47,9 +47,6 @@ trait QuoteContext { self: internal.QuoteUnpickler & internal.QuoteMatching => report.throwError(msg, self)(using QuoteContext.this) unlift.fromExpr(self)(using QuoteContext.this).getOrElse(reportError) - /** View this expression `quoted.Expr[T]` as a `Term` */ - def unseal: reflect.Term = self.asReflectTree // TODO remove - /** View this expression `quoted.Expr[T]` as a `Term` */ def asReflectTree: reflect.Term end extension diff --git a/library/src/scala/quoted/report.scala b/library/src/scala/quoted/report.scala index 6ea786d4d7bd..b91028d2f152 100644 --- a/library/src/scala/quoted/report.scala +++ b/library/src/scala/quoted/report.scala @@ -8,7 +8,7 @@ object report: /** Report an error at the on the position of `expr` */ def error(msg: => String, expr: Expr[Any])(using qctx: QuoteContext): Unit = - qctx.reflect.Reporting.error(msg, expr.unseal.pos) + qctx.reflect.Reporting.error(msg, expr.asReflectTree.pos) /** Report an error at the position of the macro expansion and throws a StopQuotedContext */ def throwError(msg: => String)(using qctx: QuoteContext): Nothing = { @@ -27,7 +27,7 @@ object report: /** Report a warning at the on the position of `expr` */ def warning(msg: => String, expr: Expr[_])(using qctx: QuoteContext): Unit = - qctx.reflect.Reporting.warning(msg, expr.unseal.pos) + qctx.reflect.Reporting.warning(msg, expr.asReflectTree.pos) /** Throwable used to stop the expansion of a macro after an error was reported */ class StopQuotedContext extends Throwable diff --git a/tests/neg-macros/i6432/Macro_1.scala b/tests/neg-macros/i6432/Macro_1.scala index aad59f362ebd..a8898df96f1b 100644 --- a/tests/neg-macros/i6432/Macro_1.scala +++ b/tests/neg-macros/i6432/Macro_1.scala @@ -10,7 +10,7 @@ object Macro { sc match { case '{ StringContext(${Varargs(parts)}: _*) } => for (part @ Const(s) <- parts) - Reporting.error(s, part.unseal.pos) + Reporting.error(s, part.asReflectTree.pos) } '{} } diff --git a/tests/neg-macros/i6432b/Macro_1.scala b/tests/neg-macros/i6432b/Macro_1.scala index aad59f362ebd..a8898df96f1b 100644 --- a/tests/neg-macros/i6432b/Macro_1.scala +++ b/tests/neg-macros/i6432b/Macro_1.scala @@ -10,7 +10,7 @@ object Macro { sc match { case '{ StringContext(${Varargs(parts)}: _*) } => for (part @ Const(s) <- parts) - Reporting.error(s, part.unseal.pos) + Reporting.error(s, part.asReflectTree.pos) } '{} } diff --git a/tests/neg-macros/i6976/Macro_1.scala b/tests/neg-macros/i6976/Macro_1.scala index 1a95b572f456..051d9d4b9d4d 100644 --- a/tests/neg-macros/i6976/Macro_1.scala +++ b/tests/neg-macros/i6976/Macro_1.scala @@ -7,6 +7,6 @@ object macros { def mcrImpl(body: Expr[Any])(using ctx: QuoteContext) : Expr[Any] = { import ctx.reflect._ - body.unseal match { case Block(_, _) => '{2} } + body.asReflectTree match { case Block(_, _) => '{2} } } } diff --git a/tests/neg-macros/i7698.scala b/tests/neg-macros/i7698.scala index 0cbc8ac0dcd3..5a4e3473704c 100644 --- a/tests/neg-macros/i7698.scala +++ b/tests/neg-macros/i7698.scala @@ -5,7 +5,7 @@ trait Show[T] { } def showInterpolatorImpl(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext): Expr[String] = - argsExpr.unseal match + argsExpr.asReflectTree match case '{ $arg: $t } => // error case '[ Int ] => // error ??? diff --git a/tests/neg-macros/i9801/Macro_1.scala b/tests/neg-macros/i9801/Macro_1.scala index c72cf54cade8..f2247298513c 100644 --- a/tests/neg-macros/i9801/Macro_1.scala +++ b/tests/neg-macros/i9801/Macro_1.scala @@ -15,6 +15,6 @@ def impl(prog: Expr[Double])(using QuoteContext) : Expr[Double] = triggerStackOverflow(0) } catch { case e => - qctx.reflect.Reporting.error(e.getMessage, prog.unseal.pos) + qctx.reflect.Reporting.error(e.getMessage, prog.asReflectTree.pos) '{ 42.0 } } 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 cfeb19ca93fc..2a000c404893 100644 --- a/tests/neg-macros/tasty-macro-assert-1/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-assert-1/quoted_1.scala @@ -15,7 +15,7 @@ object Asserts { def impl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = cond.unseal + val tree = cond.asReflectTree def isOps(tpe: TypeRepr): Boolean = tpe match { case tpe: TermRef => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts 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 32bbdbbc086a..d3042c46edec 100644 --- a/tests/neg-macros/tasty-macro-assert-2/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-assert-2/quoted_1.scala @@ -15,7 +15,7 @@ object Asserts { def impl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = cond.unseal + val tree = cond.asReflectTree def isOps(tpe: TypeRepr): Boolean = tpe match { case tpe: TermRef => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts diff --git a/tests/neg-macros/tasty-macro-error/quoted_1.scala b/tests/neg-macros/tasty-macro-error/quoted_1.scala index 361fa6d3abb5..6ecac8f898f7 100644 --- a/tests/neg-macros/tasty-macro-error/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-error/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { def impl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - Reporting.error("here is the the argument is " + x.unseal.underlyingArgument.show, x.unseal.underlyingArgument.pos) + Reporting.error("here is the the argument is " + x.asReflectTree.underlyingArgument.show, x.asReflectTree.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 bd3ef586b728..3b753303df74 100644 --- a/tests/neg-macros/tasty-macro-positions/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-positions/quoted_1.scala @@ -6,9 +6,9 @@ object Macros { def impl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val pos = x.unseal.underlyingArgument.pos - Reporting.error("here is the the argument is " + x.unseal.underlyingArgument.show, pos) - Reporting.error("here (+5) is the the argument is " + x.unseal.underlyingArgument.show, pos.sourceFile, pos.start + 5, pos.end + 5) + val pos = x.asReflectTree.underlyingArgument.pos + Reporting.error("here is the the argument is " + x.asReflectTree.underlyingArgument.show, pos) + Reporting.error("here (+5) is the the argument is " + x.asReflectTree.underlyingArgument.show, pos.sourceFile, pos.start + 5, pos.end + 5) '{} } 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 10fcdfee830e..29a2e12d7b7d 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 @@ -11,7 +11,7 @@ object FIntepolator { def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = { import qctx.reflect._ - Reporting.error("there are no parts", strCtxExpr.unseal.underlyingArgument.pos) + Reporting.error("there are no parts", strCtxExpr.asReflectTree.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 720b09640262..b13830093fe0 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 @@ -10,7 +10,7 @@ object Macro { object FIntepolator { def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : Expr[String] = { import qctx.reflect._ - Reporting.error("there are no args", argsExpr.unseal.underlyingArgument.pos) + Reporting.error("there are no args", argsExpr.asReflectTree.underlyingArgument.pos) '{ ($strCtxExpr).s($argsExpr: _*) } } diff --git a/tests/neg-staging/i5941/macro_1.scala b/tests/neg-staging/i5941/macro_1.scala index e37dda7c307e..2bd70dd3c231 100644 --- a/tests/neg-staging/i5941/macro_1.scala +++ b/tests/neg-staging/i5941/macro_1.scala @@ -17,10 +17,10 @@ object Lens { import util._ // obj.copy(field = value) def setterBody(obj: Expr[S], value: Expr[T], field: String): Expr[S] = - Select.overloaded(obj.unseal, "copy", Nil, NamedArg(field, value.unseal) :: Nil, TypeBounds.empty).asExprOf[S] + Select.overloaded(obj.asReflectTree, "copy", Nil, NamedArg(field, value.asReflectTree) :: Nil, TypeBounds.empty).asExprOf[S] - // exception: getter.unseal.underlyingArgument - getter.unseal match { + // exception: getter.asReflectTree.underlyingArgument + getter.asReflectTree match { case Inlined( None, Nil, Block( diff --git a/tests/pending/run/tasty-comments/quoted_1.scala b/tests/pending/run/tasty-comments/quoted_1.scala index 46d076eda59c..96631a290073 100644 --- a/tests/pending/run/tasty-comments/quoted_1.scala +++ b/tests/pending/run/tasty-comments/quoted_1.scala @@ -9,7 +9,7 @@ object Macros { def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = x.unseal + val tree = x.asReflectTree tree.symbol.comment.map(_.raw) match { case Some(str) => '{ println(${str}) } case None => '{ println() } diff --git a/tests/pos-macros/i6171/Macro_1.scala b/tests/pos-macros/i6171/Macro_1.scala index 23ddc95b2e66..a4e918775951 100644 --- a/tests/pos-macros/i6171/Macro_1.scala +++ b/tests/pos-macros/i6171/Macro_1.scala @@ -6,7 +6,7 @@ object scalatest { def assertImpl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - x.unseal.underlyingArgument + x.asReflectTree.underlyingArgument '{ () } } } diff --git a/tests/pos-macros/i6535/Macro_1.scala b/tests/pos-macros/i6535/Macro_1.scala index 145cedc6184a..5189868a7fa9 100644 --- a/tests/pos-macros/i6535/Macro_1.scala +++ b/tests/pos-macros/i6535/Macro_1.scala @@ -9,7 +9,7 @@ object scalatest { import util._ import ValDef.let - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case t @ Apply(Select(lhs, op), rhs :: Nil) => let(lhs) { left => let(rhs) { right => @@ -19,7 +19,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] diff --git a/tests/pos-macros/i7011/Macros_1.scala b/tests/pos-macros/i7011/Macros_1.scala index 1557a75c7283..0b301330071b 100644 --- a/tests/pos-macros/i7011/Macros_1.scala +++ b/tests/pos-macros/i7011/Macros_1.scala @@ -5,7 +5,7 @@ inline def mcr(body: => Any): Unit = ${mcrImpl('body)} def mcrImpl[T](body: Expr[Any])(using QuoteContext) : Expr[Any] = { import qctx.reflect._ - val bTree = body.unseal + val bTree = body.asReflectTree val under = bTree.underlyingArgument val res = '{Box(${under.asInstanceOf[Term].asExpr})} diff --git a/tests/pos-macros/i7030/Macros_1.scala b/tests/pos-macros/i7030/Macros_1.scala index ec6c41753811..5ce54d9b2e4b 100644 --- a/tests/pos-macros/i7030/Macros_1.scala +++ b/tests/pos-macros/i7030/Macros_1.scala @@ -7,5 +7,5 @@ def innerImpl(exprs: Expr[Any])(using QuoteContext): Expr[Any] = inline def outer(expr: => Any): Any = ${outerImpl('expr)} def outerImpl(body: Expr[Any])(using QuoteContext): Expr[Any] = { import qctx.reflect._ - body.unseal.underlyingArgument.asExpr + body.asReflectTree.underlyingArgument.asExpr } diff --git a/tests/pos-macros/i8325/Macro_1.scala b/tests/pos-macros/i8325/Macro_1.scala index 97b652f245fd..e6e8eb55200f 100644 --- a/tests/pos-macros/i8325/Macro_1.scala +++ b/tests/pos-macros/i8325/Macro_1.scala @@ -13,7 +13,7 @@ object A: def transformImplExpr[A:Type](using qctx: QuoteContext)(expr: Expr[A]): Expr[A] = { import qctx.reflect._ - expr.unseal match { + expr.asReflectTree match { case Inlined(x,y,z) => transformImplExpr(z.asExpr.asInstanceOf[Expr[A]]) case Apply(fun,args) => '{ A.pure(${Apply(fun,args).asExpr.asInstanceOf[Expr[A]]}) } case other => expr diff --git a/tests/pos-macros/i8325b/Macro_1.scala b/tests/pos-macros/i8325b/Macro_1.scala index 70dc5ab63772..50c54551e5a1 100644 --- a/tests/pos-macros/i8325b/Macro_1.scala +++ b/tests/pos-macros/i8325b/Macro_1.scala @@ -13,7 +13,7 @@ object A: def transformImplExpr[A:Type](using qctx: QuoteContext)(expr: Expr[A]): Expr[A] = { import qctx.reflect._ - expr.unseal match { + expr.asReflectTree match { case Inlined(x,y,z) => transformImplExpr(z.asExpr.asInstanceOf[Expr[A]]) case r@Apply(fun,args) => '{ A.pure(${r.asExpr.asInstanceOf[Expr[A]]}) } diff --git a/tests/pos-macros/i8866/Macro_1.scala b/tests/pos-macros/i8866/Macro_1.scala index c71f4add314f..ae0c93f0c558 100644 --- a/tests/pos-macros/i8866/Macro_1.scala +++ b/tests/pos-macros/i8866/Macro_1.scala @@ -16,7 +16,7 @@ object Macro { ValDef.let( Select.unique( - '{ OtherMacro }.unseal, + '{ OtherMacro }.asReflectTree, "apply" ) )(identity).asExprOf[Int] diff --git a/tests/pos-macros/i8866b/Macro_1.scala b/tests/pos-macros/i8866b/Macro_1.scala index f23bf1d7ee69..37d0bda2ed51 100644 --- a/tests/pos-macros/i8866b/Macro_1.scala +++ b/tests/pos-macros/i8866b/Macro_1.scala @@ -11,7 +11,7 @@ object Macro { ValDef.let( Select.unique( - '{ Other }.unseal, + '{ Other }.asReflectTree, "apply" ) )(identity).asExprOf[Int] diff --git a/tests/pos-macros/i9251/Macro_1.scala b/tests/pos-macros/i9251/Macro_1.scala index d0c3264f0c97..220b54c20e77 100644 --- a/tests/pos-macros/i9251/Macro_1.scala +++ b/tests/pos-macros/i9251/Macro_1.scala @@ -21,7 +21,7 @@ object Async { def checkPrintTypeImpl[F[_]:Type,T:Type](f: Expr[T])(using qctx: QuoteContext): Expr[Unit] = import qctx.reflect._ - val fu = f.unseal + val fu = f.asReflectTree fu match case Inlined(_,_,Block(_,Apply(TypeApply(Select(q,n),tparams),List(param)))) => param.tpe match diff --git a/tests/pos-macros/i9518/Macro_1.scala b/tests/pos-macros/i9518/Macro_1.scala index 587fe75c0459..2b40ddd69289 100644 --- a/tests/pos-macros/i9518/Macro_1.scala +++ b/tests/pos-macros/i9518/Macro_1.scala @@ -7,7 +7,7 @@ inline def shift : Unit = ${ shiftTerm } def shiftTerm(using QuoteContext): Expr[Unit] = { import qctx.reflect._ - val nTree = '{ ??? : CB[Int] }.unseal + val nTree = '{ ??? : CB[Int] }.asReflectTree val tp1 = TypeRepr.of[CB[Int]] val tp2 = TypeRepr.of[([X] =>> CB[X])[Int]] val ta = Type.of[[X] =>> CB[X]] diff --git a/tests/pos-macros/i9687/Macro_1.scala b/tests/pos-macros/i9687/Macro_1.scala index 2bb4abf379ec..446af7bdba65 100644 --- a/tests/pos-macros/i9687/Macro_1.scala +++ b/tests/pos-macros/i9687/Macro_1.scala @@ -24,8 +24,8 @@ object X { def transformImpl[A:Type](x:Expr[A])(using qctx: QuoteContext):Expr[A] = { import qctx.reflect._ - val slowPath = '{ SlowPath }.unseal - val fastPath = '{ FastPath }.unseal + val slowPath = '{ SlowPath }.asReflectTree + val fastPath = '{ FastPath }.asReflectTree val transformer = new TreeMap() { override def transformTerm(term:Term)(using ctx:Context):Term = { term match @@ -37,7 +37,7 @@ object X { case _ => super.transformTerm(term) } } - val r = transformer.transformTerm(x.unseal).asExprOf[A] + val r = transformer.transformTerm(x.asReflectTree).asExprOf[A] s"result: ${r.show}" r } diff --git a/tests/pos-macros/i9894/Macro_1.scala b/tests/pos-macros/i9894/Macro_1.scala index 8f274c3a75b7..5e96e5cd0c58 100644 --- a/tests/pos-macros/i9894/Macro_1.scala +++ b/tests/pos-macros/i9894/Macro_1.scala @@ -36,7 +36,7 @@ object X: case Block(stats, last) => Block(stats, transform(last)) case Inlined(x,List(),body) => transform(body) case l@Literal(x) => - '{ CBM.pure(${term.asExpr}) }.unseal + '{ CBM.pure(${term.asExpr}) }.asReflectTree case other => throw RuntimeException(s"Not supported $other") @@ -64,4 +64,4 @@ object X: } changes.transformTerm(body) - transform(f.unseal).asExprOf[CB[T]] + transform(f.asReflectTree).asExprOf[CB[T]] diff --git a/tests/pos-macros/treemap-unapply/Macro.scala b/tests/pos-macros/treemap-unapply/Macro.scala index aa0c863e1e83..aa07089a95f4 100644 --- a/tests/pos-macros/treemap-unapply/Macro.scala +++ b/tests/pos-macros/treemap-unapply/Macro.scala @@ -3,6 +3,6 @@ import scala.quoted._ inline def mcr(x: => Unit): Unit = ${mcrImpl('x)} def mcrImpl(x: Expr[Unit])(using QuoteContext) : Expr[Unit] = import qctx.reflect._ - val tr: Term = x.unseal + val tr: Term = x.asReflectTree object m extends TreeMap m.transformTerm(tr).asExprOf[Unit] 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 cf85367e82e6..97342fccbd8c 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 @@ -7,7 +7,7 @@ object Foo { def inspectBodyImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[String] = { import qctx.reflect._ - x.unseal match { + x.asReflectTree match { case Inlined(None, Nil, arg) => Expr(arg.symbol.tree.showExtractors) case arg => Expr(arg.symbol.tree.showExtractors) // TODO should all by name parameters be in an inline node? } 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 128df22798a0..04f8ca874494 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 @@ -7,7 +7,7 @@ object Foo { def inspectBodyImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[String] = { import qctx.reflect._ - x.unseal match { + x.asReflectTree match { case Inlined(None, Nil, arg) => Expr(arg.symbol.tree.showExtractors) case arg => Expr(arg.symbol.tree.showExtractors) // TODO should all by name parameters be in an inline node? } 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 24b8f34608b9..4512c1c95c1c 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 @@ -12,7 +12,7 @@ object Macros { val output = myTraverser(buff) - val tree = x.unseal + val tree = x.asReflectTree output.traverseTree(tree) '{print(${Expr(buff.result())})} } 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 29ccd42e1329..e7f81bf82cae 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 @@ -13,7 +13,7 @@ object Foo { if sym.isClassDef || sym.isDefDef || sym.isValDef then Expr(sym.tree.showExtractors) else '{"NO DEFINTION"} - x.unseal match { + x.asReflectTree match { case Inlined(None, Nil, arg) => definitionString(arg.symbol) case arg => definitionString(arg.symbol) // TODO should all by name parameters be in an inline node } 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 01c41da0f37c..fa1fb62906f6 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 @@ -12,7 +12,7 @@ object Foo { if sym.isClassDef || sym.isDefDef || sym.isValDef then Expr(sym.tree.showExtractors) else '{"NO DEFINTION"} - x.unseal match { + x.asReflectTree match { case Inlined(None, Nil, arg) => definitionString(arg.symbol) case arg => definitionString(arg.symbol) // TODO should all by name parameters be in an inline node } diff --git a/tests/run-macros/f-interpolation-1/FQuote_1.scala b/tests/run-macros/f-interpolation-1/FQuote_1.scala index 5f63fab7255a..9c03ab4adeb6 100644 --- a/tests/run-macros/f-interpolation-1/FQuote_1.scala +++ b/tests/run-macros/f-interpolation-1/FQuote_1.scala @@ -31,7 +31,7 @@ object FQuote { tree.symbol.fullName == "scala.StringContext$.apply" // FQuote.SCOps(StringContext.apply([p0, ...]: String*) - val parts = receiver.unseal.underlyingArgument match { + val parts = receiver.asReflectTree.underlyingArgument match { case Apply(conv, List(Apply(fun, List(Typed(Repeated(values, _), _))))) if isSCOpsConversion(conv) && isStringContextApply(fun) && @@ -43,7 +43,7 @@ object FQuote { } // [a0, ...]: Any* - val Typed(Repeated(allArgs, _), _) = args.unseal.underlyingArgument + val Typed(Repeated(allArgs, _), _) = args.asReflectTree.underlyingArgument for ((arg, part) <- allArgs.zip(parts.tail)) { if (part.startsWith("%d") && !(arg.tpe <:< TypeRepr.of[Int])) { diff --git a/tests/run-macros/i10011/Macro_1.scala b/tests/run-macros/i10011/Macro_1.scala index 38ca19989cc1..63f252ab43a7 100644 --- a/tests/run-macros/i10011/Macro_1.scala +++ b/tests/run-macros/i10011/Macro_1.scala @@ -4,5 +4,5 @@ inline def printPos[T](inline expr: T): (Int, Int) = ${ printPos('expr) } private def printPos[T](expr: Expr[T])(using QuoteContext): Expr[(Int, Int)] = - val pos = expr.unseal.pos + val pos = expr.asReflectTree.pos Expr((pos.start, pos.end)) diff --git a/tests/run-macros/i5119/Macro_1.scala b/tests/run-macros/i5119/Macro_1.scala index 345a0027183a..3b6c6fd94877 100644 --- a/tests/run-macros/i5119/Macro_1.scala +++ b/tests/run-macros/i5119/Macro_1.scala @@ -7,6 +7,6 @@ object Macro { 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] = { import qctx.reflect._ - Expr(sc.unseal.underlyingArgument.showExtractors + "\n" + args.unseal.underlyingArgument.showExtractors) + Expr(sc.asReflectTree.underlyingArgument.showExtractors + "\n" + args.asReflectTree.underlyingArgument.showExtractors) } } diff --git a/tests/run-macros/i5119b/Macro_1.scala b/tests/run-macros/i5119b/Macro_1.scala index f518dd26dc7e..c06d3ee9548d 100644 --- a/tests/run-macros/i5119b/Macro_1.scala +++ b/tests/run-macros/i5119b/Macro_1.scala @@ -6,6 +6,6 @@ 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] = - Expr(arg1.unseal.underlyingArgument.showExtractors + "\n" + arg2.unseal.underlyingArgument.showExtractors) + Expr(arg1.asReflectTree.underlyingArgument.showExtractors + "\n" + arg2.asReflectTree.underlyingArgument.showExtractors) } diff --git a/tests/run-macros/i5533/Macro_1.scala b/tests/run-macros/i5533/Macro_1.scala index a60c447a4882..d6ded92805da 100644 --- a/tests/run-macros/i5533/Macro_1.scala +++ b/tests/run-macros/i5533/Macro_1.scala @@ -10,7 +10,7 @@ object scalatest { def assertImpl(condition: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = condition.unseal + val tree = condition.asReflectTree val expr = tree.asExprOf[Boolean] diff --git a/tests/run-macros/i5533b/Macro_1.scala b/tests/run-macros/i5533b/Macro_1.scala index a6cc9d13941f..6e44a812c2c2 100644 --- a/tests/run-macros/i5533b/Macro_1.scala +++ b/tests/run-macros/i5533b/Macro_1.scala @@ -8,7 +8,7 @@ object scalatest { def assertImpl(condition: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = condition.unseal + val tree = condition.asReflectTree def exprStr: String = condition.show tree.underlyingArgument match { diff --git a/tests/run-macros/i5536/Macro_1.scala b/tests/run-macros/i5536/Macro_1.scala index 09cf6b06106f..0c391598bd13 100644 --- a/tests/run-macros/i5536/Macro_1.scala +++ b/tests/run-macros/i5536/Macro_1.scala @@ -5,7 +5,7 @@ object scalatest { def assertImpl(condition: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = condition.unseal + val tree = condition.asReflectTree def exprStr: String = condition.show tree.underlyingArgument match { diff --git a/tests/run-macros/i5629/Macro_1.scala b/tests/run-macros/i5629/Macro_1.scala index e7d945823d5f..2013ffba2092 100644 --- a/tests/run-macros/i5629/Macro_1.scala +++ b/tests/run-macros/i5629/Macro_1.scala @@ -6,7 +6,7 @@ object Macros { def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val b = cond.unseal.underlyingArgument.asExprOf[Boolean] + val b = cond.asReflectTree.underlyingArgument.asExprOf[Boolean] '{ scala.Predef.assert($b) } } diff --git a/tests/run-macros/i5715/Macro_1.scala b/tests/run-macros/i5715/Macro_1.scala index e3ff2ef4d4a1..b9a362d6b840 100644 --- a/tests/run-macros/i5715/Macro_1.scala +++ b/tests/run-macros/i5715/Macro_1.scala @@ -7,7 +7,7 @@ object scalatest { def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case app @ Apply(select @ Select(lhs, op), rhs :: Nil) => val cond = Apply(Select.copy(select)(lhs, "exists"), rhs :: Nil).asExprOf[Boolean] '{ scala.Predef.assert($cond) } diff --git a/tests/run-macros/i5941/macro_1.scala b/tests/run-macros/i5941/macro_1.scala index b8cabb28a450..5003c74667a1 100644 --- a/tests/run-macros/i5941/macro_1.scala +++ b/tests/run-macros/i5941/macro_1.scala @@ -45,11 +45,11 @@ object Lens { } } - // exception: getter.unseal.underlyingArgument - getter.unseal match { + // exception: getter.asReflectTree.underlyingArgument + getter.asReflectTree match { case Function(param :: Nil, Path(o, parts)) if o.symbol == param.symbol => '{ - val setter = (t: T) => (s: S) => ${ setterBody(('s).unseal, ('t).unseal, parts).asExprOf[S] } + val setter = (t: T) => (s: S) => ${ setterBody(('s).asReflectTree, ('t).asReflectTree, parts).asExprOf[S] } apply($getter)(setter) } case _ => @@ -116,9 +116,9 @@ object Iso { '{???} } else '{ // (p: S) => p._1 - val to = (p: S) => ${ Select.unique(('p).unseal, "_1").asExprOf[A] } + val to = (p: S) => ${ Select.unique(('p).asReflectTree, "_1").asExprOf[A] } // (p: A) => S(p) - val from = (p: A) => ${ Select.overloaded(Ident(companion), "apply", Nil, ('p).unseal :: Nil).asExprOf[S] } + val from = (p: A) => ${ Select.overloaded(Ident(companion), "apply", Nil, ('p).asReflectTree :: Nil).asExprOf[S] } apply(from)(to) } } diff --git a/tests/run-macros/i6171/Macro_1.scala b/tests/run-macros/i6171/Macro_1.scala index aca90da66d1b..eb6d8f9f28c3 100644 --- a/tests/run-macros/i6171/Macro_1.scala +++ b/tests/run-macros/i6171/Macro_1.scala @@ -12,7 +12,7 @@ object scalatest { case tp: MethodType => tp.isImplicit case _ => false - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case t @ Apply(Select(lhs, op), rhs :: Nil) => ValDef.let(lhs) { left => ValDef.let(rhs) { right => @@ -22,7 +22,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] @@ -36,7 +36,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] diff --git a/tests/run-macros/i6679/Macro_1.scala b/tests/run-macros/i6679/Macro_1.scala index 516f5e32395c..1cf03a43056b 100644 --- a/tests/run-macros/i6679/Macro_1.scala +++ b/tests/run-macros/i6679/Macro_1.scala @@ -4,7 +4,7 @@ def makeMatch[A: Type](head : Expr[A])(using qctx : QuoteContext) : Expr[Unit] = import qctx.reflect._ val sacrifice = '{ $head match { case _ => ??? } } - sacrifice.unseal + sacrifice.asReflectTree '{ println("Ok") } } diff --git a/tests/run-macros/i7887/Macro_1.scala b/tests/run-macros/i7887/Macro_1.scala index 8ea3cdf9f250..b9349621ceac 100644 --- a/tests/run-macros/i7887/Macro_1.scala +++ b/tests/run-macros/i7887/Macro_1.scala @@ -1,10 +1,10 @@ def myMacroImpl(a: quoted.Expr[_])(using qctx: quoted.QuoteContext) = { import qctx.reflect._ def typed[A] = { - implicit val t: quoted.Type[A] = a.unseal.tpe.widen.asType.asInstanceOf[quoted.Type[A]] + implicit val t: quoted.Type[A] = a.asReflectTree.tpe.widen.asType.asInstanceOf[quoted.Type[A]] '{ type T = A - ${a.unseal.asExprOf[T]} + ${a.asReflectTree.asExprOf[T]} } } diff --git a/tests/run-macros/i7898/Macro_1.scala b/tests/run-macros/i7898/Macro_1.scala index 2201491d8b52..0d7397e4dea0 100644 --- a/tests/run-macros/i7898/Macro_1.scala +++ b/tests/run-macros/i7898/Macro_1.scala @@ -4,7 +4,7 @@ object Main { def myMacroImpl(body: Expr[_])(using qctx: QuoteContext) : Expr[_] = { import qctx.reflect._ - val bodyTerm = underlyingArgument(body).unseal + val bodyTerm = underlyingArgument(body).asReflectTree val showed = bodyTerm.show '{ println(${Expr(showed)}) @@ -17,5 +17,5 @@ object Main { } def underlyingArgument[T](expr: Expr[T])(using qctx: QuoteContext): Expr[T] = - expr.unseal.underlyingArgument.asExpr.asInstanceOf[Expr[T]] + expr.asReflectTree.underlyingArgument.asExpr.asInstanceOf[Expr[T]] } diff --git a/tests/run-macros/i8007/Macro_2.scala b/tests/run-macros/i8007/Macro_2.scala index a32f938d77f9..e606e91944f0 100644 --- a/tests/run-macros/i8007/Macro_2.scala +++ b/tests/run-macros/i8007/Macro_2.scala @@ -30,7 +30,7 @@ object Macro2 { val body: Expr[T] => Expr[String] = elem => fields.reverse.foldLeft(Expr("")){ (acc, field) => - val res = Select.unique(elem.unseal, field).asExpr + val res = Select.unique(elem.asReflectTree, field).asExpr '{ $res.toString + " " + $acc } } diff --git a/tests/run-macros/inferred-repeated-result/test_1.scala b/tests/run-macros/inferred-repeated-result/test_1.scala index 458af2d57ba7..b42cbf8df895 100644 --- a/tests/run-macros/inferred-repeated-result/test_1.scala +++ b/tests/run-macros/inferred-repeated-result/test_1.scala @@ -5,7 +5,7 @@ object Macros { def impl[T](expr: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = expr.unseal + val tree = expr.asReflectTree val methods = tree.tpe.classSymbol.get.classMethods.map { m => diff --git a/tests/run-macros/paramSymss/Macro_1.scala b/tests/run-macros/paramSymss/Macro_1.scala index 4849de836117..e0cfb98a4860 100644 --- a/tests/run-macros/paramSymss/Macro_1.scala +++ b/tests/run-macros/paramSymss/Macro_1.scala @@ -5,7 +5,7 @@ inline def showParamSyms(inline x: Any): String = def showParamSymsExpr(using QuoteContext)(x: Expr[Any]): Expr[String] = val '{ $y: Any } = x // Drop Inlined not to access the symbol - val sym = y.unseal.symbol + val sym = y.asReflectTree.symbol Expr( s"""sym: ${sym.show} |paramSymss: ${sym.paramSymss.map(_.map(_.show))} diff --git a/tests/run-macros/quote-matcher-runtime/quoted_1.scala b/tests/run-macros/quote-matcher-runtime/quoted_1.scala index 070f23bbeaac..c1e91934d98e 100644 --- a/tests/run-macros/quote-matcher-runtime/quoted_1.scala +++ b/tests/run-macros/quote-matcher-runtime/quoted_1.scala @@ -17,8 +17,8 @@ object Macros { } '{ - println("Scrutinee: " + ${Expr(a.unseal.show)}) - println("Pattern: " + ${Expr(b.unseal.show)}) + println("Scrutinee: " + ${Expr(a.asReflectTree.show)}) + println("Pattern: " + ${Expr(b.asReflectTree.show)}) println("Result: " + ${Expr(res.toString)}) println() } 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 3914b9a9db18..a88c42a42fc5 100644 --- a/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala @@ -21,7 +21,7 @@ object Macros { case _ => import qctx.reflect._ - Reporting.error("Expected explicit DSL", e.unseal.pos) + Reporting.error("Expected explicit DSL", e.asReflectTree.pos) '{ ??? } } 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 4824ab35fef0..bbafd02e33ea 100644 --- a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala @@ -39,7 +39,7 @@ object Macros { case _ => import qctx.reflect._ - Reporting.error("Expected explicit DSL " + e.show, e.unseal.pos) + Reporting.error("Expected explicit DSL " + e.show, e.asReflectTree.pos) ??? } @@ -53,7 +53,7 @@ object Macros { ) case _ => import qctx.reflect._ - Reporting.error("Expected explicit DSL => DSL " + e.show, e.unseal.pos) + Reporting.error("Expected explicit DSL => DSL " + e.show, e.asReflectTree.pos) ??? } @@ -65,11 +65,11 @@ 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 = { val (params, bodyExpr) = paramsAndBody[R](f) - content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](e.unseal, params, List(v.unseal)).asExpr.asInstanceOf[Expr[t]]) + content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](e.asReflectTree, params, List(v.asReflectTree)).asExpr.asInstanceOf[Expr[t]]) } private def paramsAndBody[R](using qctx: QuoteContext)(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)) = f.unseal.etaExpand + val Block(List(DefDef("$anonfun", Nil, List(params), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asReflectTree.etaExpand (params, body.asExpr.asInstanceOf[Expr[R]]) } 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 52fece7310c7..9fe5ac3e027e 100644 --- a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala @@ -77,11 +77,11 @@ 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 = { val (params, bodyExpr) = paramsAndBody[R](f) - content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](e.unseal, params, List(v.unseal)).asExpr.asInstanceOf[Expr[t]]) + content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](e.asReflectTree, params, List(v.asReflectTree)).asExpr.asInstanceOf[Expr[t]]) } private def paramsAndBody[R](using qctx: QuoteContext)(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)) = f.unseal.etaExpand + val Block(List(DefDef("$anonfun", Nil, List(params), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asReflectTree.etaExpand (params, body.asExpr.asInstanceOf[Expr[R]]) } diff --git a/tests/run-macros/quote-matching-open/Macro_1.scala b/tests/run-macros/quote-matching-open/Macro_1.scala index c1c1ca1a957f..3807a4c56dce 100644 --- a/tests/run-macros/quote-matching-open/Macro_1.scala +++ b/tests/run-macros/quote-matching-open/Macro_1.scala @@ -18,20 +18,20 @@ 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 = { val (params, bodyExpr) = paramsAndBody[R](f) - content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](e.unseal, params, List(v.unseal)).asExpr.asInstanceOf[Expr[t]]) + content(bodyExpr, [t] => (e: Expr[t]) => (v: Expr[T1]) => bodyFn[t](e.asReflectTree, params, List(v.asReflectTree)).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 = { val (params, bodyExpr) = paramsAndBody[R](f) - content(bodyExpr, [t] => (e: Expr[t]) => (v1: Expr[T1], v2: Expr[T2]) => bodyFn[t](e.unseal, params, List(v1.unseal, v2.unseal)).asExpr.asInstanceOf[Expr[t]]) + content(bodyExpr, [t] => (e: Expr[t]) => (v1: Expr[T1], v2: Expr[T2]) => bodyFn[t](e.asReflectTree, params, List(v1.asReflectTree, v2.asReflectTree)).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 = { val (params, bodyExpr) = paramsAndBody[R](f) - content(bodyExpr, [t] => (e: Expr[t]) => (v1: Expr[T1], v2: Expr[T2], v3: Expr[T3]) => bodyFn[t](e.unseal, params, List(v1.unseal, v2.unseal, v3.unseal)).asExpr.asInstanceOf[Expr[t]]) + content(bodyExpr, [t] => (e: Expr[t]) => (v1: Expr[T1], v2: Expr[T2], v3: Expr[T3]) => bodyFn[t](e.asReflectTree, params, List(v1.asReflectTree, v2.asReflectTree, v3.asReflectTree)).asExpr.asInstanceOf[Expr[t]]) } private def paramsAndBody[R](using qctx: QuoteContext)(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)) = f.unseal.etaExpand + val Block(List(DefDef("$anonfun", Nil, List(params), _, Some(body))), Closure(Ident("$anonfun"), None)) = f.asReflectTree.etaExpand (params, body.asExpr.asInstanceOf[Expr[R]]) } diff --git a/tests/run-macros/quoted-matching-docs/Macro_1.scala b/tests/run-macros/quoted-matching-docs/Macro_1.scala index 8b7f0fa69ed1..ef40c65b01df 100644 --- a/tests/run-macros/quoted-matching-docs/Macro_1.scala +++ b/tests/run-macros/quoted-matching-docs/Macro_1.scala @@ -29,5 +29,5 @@ 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] = - expr.unseal.underlyingArgument.asExpr.asInstanceOf[Expr[T]] + expr.asReflectTree.underlyingArgument.asExpr.asInstanceOf[Expr[T]] } \ No newline at end of file diff --git a/tests/run-macros/refined-selectable-macro/Macro_1.scala b/tests/run-macros/refined-selectable-macro/Macro_1.scala index bad41567205f..0c8258b8b3cd 100644 --- a/tests/run-macros/refined-selectable-macro/Macro_1.scala +++ b/tests/run-macros/refined-selectable-macro/Macro_1.scala @@ -17,7 +17,7 @@ object Macro { private def toTupleImpl(s: Expr[Selectable])(using qctx:QuoteContext) : Expr[Tuple] = { import qctx.reflect._ - val repr = s.unseal.tpe.widenTermRefExpr.dealias + val repr = s.asReflectTree.tpe.widenTermRefExpr.dealias def rec(tpe: TypeRepr): List[(String, TypeRepr)] = { tpe match { @@ -51,7 +51,7 @@ object Macro { private def fromTupleImpl[T: Type](s: Expr[Tuple], newRecord: Expr[Array[(String, Any)] => T])(using qctx:QuoteContext) : Expr[Any] = { import qctx.reflect._ - val repr = s.unseal.tpe.widenTermRefExpr.dealias + val repr = s.asReflectTree.tpe.widenTermRefExpr.dealias def isTupleCons(sym: Symbol): Boolean = sym.owner == defn.ScalaPackageClass && sym.name == "*:" diff --git a/tests/run-macros/reflect-dsl/assert_1.scala b/tests/run-macros/reflect-dsl/assert_1.scala index 7fa936d70c74..5af89cefb7cd 100644 --- a/tests/run-macros/reflect-dsl/assert_1.scala +++ b/tests/run-macros/reflect-dsl/assert_1.scala @@ -12,7 +12,7 @@ object scalatest { case tp: MethodType => tp.isImplicit case _ => false - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case t @ Apply(sel @ Select(lhs, op), rhs :: Nil) => ValDef.let(lhs) { left => ValDef.let(rhs) { right => @@ -22,7 +22,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] @@ -36,7 +36,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] diff --git a/tests/run-macros/reflect-lambda/assert_1.scala b/tests/run-macros/reflect-lambda/assert_1.scala index aa70963bb800..673ac0a08800 100644 --- a/tests/run-macros/reflect-lambda/assert_1.scala +++ b/tests/run-macros/reflect-lambda/assert_1.scala @@ -8,7 +8,7 @@ object lib { import qctx.reflect._ import util._ - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case t @ Apply(Select(lhs, op), Lambda(param :: Nil, Apply(Select(a, "=="), b :: Nil)) :: Nil) if a.symbol == param.symbol || b.symbol == param.symbol => '{ scala.Predef.assert($cond) } diff --git a/tests/run-macros/reflect-pos-fun/assert_1.scala b/tests/run-macros/reflect-pos-fun/assert_1.scala index b07b80e90af0..9384dc7d3ab6 100644 --- a/tests/run-macros/reflect-pos-fun/assert_1.scala +++ b/tests/run-macros/reflect-pos-fun/assert_1.scala @@ -8,13 +8,13 @@ object scalatest { import qctx.reflect._ import util._ - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case t @ Apply(TypeApply(Select(lhs, op), targs), rhs) => ValDef.let(lhs) { left => ValDef.let(rhs) { rs => val app = Select.overloaded(left, op, targs.map(_.tpe), rs) val b = app.asExprOf[Boolean] - '{ scala.Predef.assert($b) }.unseal + '{ scala.Predef.assert($b) }.asReflectTree } }.asExprOf[Unit] } diff --git a/tests/run-macros/reflect-select-constructor/assert_1.scala b/tests/run-macros/reflect-select-constructor/assert_1.scala index 09c3e738be88..40216805880d 100644 --- a/tests/run-macros/reflect-select-constructor/assert_1.scala +++ b/tests/run-macros/reflect-select-constructor/assert_1.scala @@ -12,7 +12,7 @@ object scalatest { case tp: MethodType => tp.isImplicit case _ => false - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case t @ Apply(Select(lhs, op), rhs :: Nil) => ValDef.let(lhs) { left => ValDef.let(rhs) { right => @@ -22,7 +22,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] @@ -36,7 +36,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] 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 3a95072d4b84..578795d55bae 100644 --- a/tests/run-macros/reflect-select-copy-2/assert_1.scala +++ b/tests/run-macros/reflect-select-copy-2/assert_1.scala @@ -12,7 +12,7 @@ object scalatest { case tp: MethodType => tp.isImplicit case _ => false - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case Apply(sel @ Select(lhs, op), rhs :: Nil) => ValDef.let(lhs) { left => ValDef.let(rhs) { right => @@ -21,7 +21,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert(${b}) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] @@ -34,7 +34,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert(${b}) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] diff --git a/tests/run-macros/reflect-select-copy/assert_1.scala b/tests/run-macros/reflect-select-copy/assert_1.scala index 7ef6257774af..9526ff182c0b 100644 --- a/tests/run-macros/reflect-select-copy/assert_1.scala +++ b/tests/run-macros/reflect-select-copy/assert_1.scala @@ -7,7 +7,7 @@ object scalatest { def assertImpl(cond: Expr[Boolean], clue: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case Apply(select @ Select(lhs, op), rhs :: Nil) => val cond = Apply(Select.copy(select)(lhs, ">"), rhs :: Nil).asExprOf[Boolean] '{ scala.Predef.assert($cond) } 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 6eb43e90a35b..64a7d349a0d3 100644 --- a/tests/run-macros/reflect-select-symbol-constructor/assert_1.scala +++ b/tests/run-macros/reflect-select-symbol-constructor/assert_1.scala @@ -12,7 +12,7 @@ object scalatest { case tp: MethodType => tp.isImplicit case _ => false - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case t @ Apply(sel @ Select(lhs, op), rhs :: Nil) => ValDef.let(lhs) { left => ValDef.let(rhs) { right => @@ -22,7 +22,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] @@ -36,7 +36,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] 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 7db21b353526..4017946b69ed 100644 --- a/tests/run-macros/reflect-select-value-class/assert_1.scala +++ b/tests/run-macros/reflect-select-value-class/assert_1.scala @@ -12,7 +12,7 @@ object scalatest { case tp: MethodType => tp.isImplicit case _ => false - cond.unseal.underlyingArgument match { + cond.asReflectTree.underlyingArgument match { case t @ Apply(Select(lhs, op), rhs :: Nil) => ValDef.let(lhs) { left => ValDef.let(rhs) { right => @@ -22,7 +22,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] @@ -36,7 +36,7 @@ object scalatest { val r = right.asExpr val b = result.asExprOf[Boolean] val code = '{ scala.Predef.assert($b) } - code.unseal + code.asReflectTree } } }.asExprOf[Unit] diff --git a/tests/run-macros/reflect-sourceCode/Macro_1.scala b/tests/run-macros/reflect-sourceCode/Macro_1.scala index df854546b9ec..cc32fc3faffe 100644 --- a/tests/run-macros/reflect-sourceCode/Macro_1.scala +++ b/tests/run-macros/reflect-sourceCode/Macro_1.scala @@ -6,6 +6,6 @@ object api { private def reflImpl[T](x: Expr[T])(implicit qctx: QuoteContext): Expr[String] = { import qctx.reflect._ - Expr(x.unseal.pos.sourceCode) + Expr(x.asReflectTree.pos.sourceCode) } } 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 ac995c77cda8..7d790f72642e 100644 --- a/tests/run-macros/tasty-argument-tree-1/quoted_1.scala +++ b/tests/run-macros/tasty-argument-tree-1/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = x.unseal + val tree = x.asReflectTree '{ println() println("tree: " + ${Expr(tree.showExtractors)}) diff --git a/tests/run-macros/tasty-construct-types/Macro_1.scala b/tests/run-macros/tasty-construct-types/Macro_1.scala index 89720865c717..2b2e54fa9db0 100644 --- a/tests/run-macros/tasty-construct-types/Macro_1.scala +++ b/tests/run-macros/tasty-construct-types/Macro_1.scala @@ -28,7 +28,7 @@ object Macros { "T", TypeBounds(TypeRepr.of[Int], TypeRepr.of[Int])) val x6T = TypeRepr.of[List].appliedTo(List(TypeRepr.of[Int])) - val x7T = AnnotatedType(ConstantType(Constant.Int(7)), '{ new TestAnnotation }.unseal) + val x7T = AnnotatedType(ConstantType(Constant.Int(7)), '{ new TestAnnotation }.asReflectTree) val x8T = MatchType( TypeRepr.of[Int], 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 bd37411fe8fb..225664a026f5 100644 --- a/tests/run-macros/tasty-create-method-symbol/Macro_1.scala +++ b/tests/run-macros/tasty-create-method-symbol/Macro_1.scala @@ -20,10 +20,10 @@ object Macros { DefDef(sym1, { case List() => { case List(List(a, b)) => - Some('{ ${ a.asExpr.asInstanceOf[Expr[Int]] } - ${ b.asExpr.asInstanceOf[Expr[Int]] } }.unseal) + Some('{ ${ a.asExpr.asInstanceOf[Expr[Int]] } - ${ b.asExpr.asInstanceOf[Expr[Int]] } }.asReflectTree) } }), - '{ assert(${ Apply(Ref(sym1), List(Literal(Constant.Int(2)), Literal(Constant.Int(3)))).asExpr.asInstanceOf[Expr[Int]] } == -1) }.unseal) + '{ assert(${ Apply(Ref(sym1), List(Literal(Constant.Int(2)), Literal(Constant.Int(3)))).asExpr.asInstanceOf[Expr[Int]] } == -1) }.asReflectTree) // test for no argument list (no Apply node) val sym2 : Symbol = Symbol.newMethod( @@ -39,7 +39,7 @@ object Macros { Some(Literal(Constant.Int(2))) } }), - '{ assert(${ Ref(sym2).asExpr.asInstanceOf[Expr[Int]] } == 2) }.unseal) + '{ assert(${ Ref(sym2).asExpr.asInstanceOf[Expr[Int]] } == 2) }.asReflectTree) // test for multiple argument lists val sym3 : Symbol = Symbol.newMethod( @@ -59,7 +59,7 @@ object Macros { Some(a) } }), - '{ assert(${ Apply(Apply(Ref(sym3), List(Literal(Constant.Int(3)))), List(Literal(Constant.Int(3)))).asExpr.asInstanceOf[Expr[Int]] } == 3) }.unseal) + '{ assert(${ Apply(Apply(Ref(sym3), List(Literal(Constant.Int(3)))), List(Literal(Constant.Int(3)))).asExpr.asInstanceOf[Expr[Int]] } == 3) }.asReflectTree) // test for recursive references val sym4 : Symbol = Symbol.newMethod( @@ -77,11 +77,11 @@ object Macros { Some('{ if ${ x.asExpr.asInstanceOf[Expr[Int]] } == 0 then 0 - else ${ Apply(Ref(sym4), List('{ ${ x.asExpr.asInstanceOf[Expr[Int]] } - 1 }.unseal)).asExpr.asInstanceOf[Expr[Int]] } - }.unseal) + else ${ Apply(Ref(sym4), List('{ ${ x.asExpr.asInstanceOf[Expr[Int]] } - 1 }.asReflectTree)).asExpr.asInstanceOf[Expr[Int]] } + }.asReflectTree) } }), - '{ assert(${ Apply(Ref(sym4), List(Literal(Constant.Int(4)))).asExpr.asInstanceOf[Expr[Int]] } == 0) }.unseal) + '{ assert(${ Apply(Ref(sym4), List(Literal(Constant.Int(4)))).asExpr.asInstanceOf[Expr[Int]] } == 0) }.asReflectTree) // test for nested functions (one symbol is the other's parent, and we use a Closure) val sym5 : Symbol = Symbol.newMethod( @@ -108,14 +108,14 @@ object Macros { DefDef(sym51, { case List() => { case List(List(xx)) => - Some('{ ${ x.asExpr.asInstanceOf[Expr[Int]] } - ${ xx.asExpr.asInstanceOf[Expr[Int]] } }.unseal) + Some('{ ${ x.asExpr.asInstanceOf[Expr[Int]] } - ${ xx.asExpr.asInstanceOf[Expr[Int]] } }.asReflectTree) } })), Closure(Ref(sym51), None)) } } }), - '{ assert(${ Apply(Ref(sym5), List(Literal(Constant.Int(5)))).asExpr.asInstanceOf[Expr[Int=>Int]] }(4) == 1) }.unseal) + '{ assert(${ Apply(Ref(sym5), List(Literal(Constant.Int(5)))).asExpr.asInstanceOf[Expr[Int=>Int]] }(4) == 1) }.asReflectTree) // test mutually recursive definitions val sym6_1 : Symbol = Symbol.newMethod( @@ -143,8 +143,8 @@ object Macros { println(s"sym6_1: ${ ${ x.asExpr.asInstanceOf[Expr[Int]] } }") if ${ x.asExpr.asInstanceOf[Expr[Int]] } == 0 then 0 - else ${ Apply(Ref(sym6_2), List('{ ${ x.asExpr.asInstanceOf[Expr[Int]] } - 1 }.unseal)).asExpr.asInstanceOf[Expr[Int]] } - }.unseal + else ${ Apply(Ref(sym6_2), List('{ ${ x.asExpr.asInstanceOf[Expr[Int]] } - 1 }.asReflectTree)).asExpr.asInstanceOf[Expr[Int]] } + }.asReflectTree } } }), @@ -156,13 +156,13 @@ object Macros { println(s"sym6_2: ${ ${ x.asExpr.asInstanceOf[Expr[Int]] } }") if ${ x.asExpr.asInstanceOf[Expr[Int]] } == 0 then 0 - else ${ Apply(Ref(sym6_1), List('{ ${ x.asExpr.asInstanceOf[Expr[Int]] } - 1 }.unseal)).asExpr.asInstanceOf[Expr[Int]] } - }.unseal + else ${ Apply(Ref(sym6_1), List('{ ${ x.asExpr.asInstanceOf[Expr[Int]] } - 1 }.asReflectTree)).asExpr.asInstanceOf[Expr[Int]] } + }.asReflectTree } } }), - '{ assert(${ Apply(Ref(sym6_2), List(Literal(Constant.Int(6)))).asExpr.asInstanceOf[Expr[Int]] } == 0) }.unseal) + '{ assert(${ Apply(Ref(sym6_2), List(Literal(Constant.Int(6)))).asExpr.asInstanceOf[Expr[Int]] } == 0) }.asReflectTree) // test polymorphic methods by synthesizing an identity method val sym7 : Symbol = Symbol.newMethod( @@ -182,7 +182,7 @@ object Macros { Some(Typed(x, Inferred(t))) } }), - '{ assert(${ Apply(TypeApply(Ref(sym7), List(Inferred(TypeRepr.of[Int]))), List(Literal(Constant.Int(7)))).asExpr.asInstanceOf[Expr[Int]] } == 7) }.unseal) + '{ assert(${ Apply(TypeApply(Ref(sym7), List(Inferred(TypeRepr.of[Int]))), List(Literal(Constant.Int(7)))).asExpr.asInstanceOf[Expr[Int]] } == 7) }.asReflectTree) Block( sym1Statements ++ @@ -192,7 +192,7 @@ object Macros { sym5Statements ++ sym6Statements ++ sym7Statements ++ - List('{ println("Ok") }.unseal), + List('{ println("Ok") }.asReflectTree), Literal(Constant.Unit())).asExpr.asInstanceOf[Expr[Unit]] } } diff --git a/tests/run-macros/tasty-eval/quoted_1.scala b/tests/run-macros/tasty-eval/quoted_1.scala index 6ba364756da0..467bb2dc6c3a 100644 --- a/tests/run-macros/tasty-eval/quoted_1.scala +++ b/tests/run-macros/tasty-eval/quoted_1.scala @@ -19,7 +19,7 @@ object Macros { override def value(e: Expr[Int])(using qctx: QuoteContext) : Option[Int] = { import qctx.reflect._ - e.unseal.tpe match { + e.asReflectTree.tpe match { case pre: TermRef if pre.termSymbol.isValDef => pre.termSymbol.tree match case t: ValDef => diff --git a/tests/run-macros/tasty-extractors-1/quoted_1.scala b/tests/run-macros/tasty-extractors-1/quoted_1.scala index 36866c580d3f..b5e9133413e4 100644 --- a/tests/run-macros/tasty-extractors-1/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-1/quoted_1.scala @@ -8,7 +8,7 @@ object Macros { def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = x.unseal + val tree = x.asReflectTree val treeStr = Expr(tree.showExtractors) val treeTpeStr = Expr(tree.tpe.showExtractors) diff --git a/tests/run-macros/tasty-extractors-2/quoted_1.scala b/tests/run-macros/tasty-extractors-2/quoted_1.scala index 97e6af3ed654..94836a177294 100644 --- a/tests/run-macros/tasty-extractors-2/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-2/quoted_1.scala @@ -8,7 +8,7 @@ object Macros { def impl[T](x: Expr[T])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = x.unseal + val tree = x.asReflectTree val treeStr = Expr(tree.showExtractors) val treeTpeStr = Expr(tree.tpe.showExtractors) diff --git a/tests/run-macros/tasty-extractors-3/quoted_1.scala b/tests/run-macros/tasty-extractors-3/quoted_1.scala index c2d85ae352ff..a06978dc4b25 100644 --- a/tests/run-macros/tasty-extractors-3/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-3/quoted_1.scala @@ -25,7 +25,7 @@ object Macros { } } - val tree = x.unseal + val tree = x.asReflectTree traverser.traverseTree(tree) '{print(${Expr(buff.result())})} } diff --git a/tests/run-macros/tasty-interpolation-1/Macro.scala b/tests/run-macros/tasty-interpolation-1/Macro.scala index c2ed8f270ce9..3c136319773d 100644 --- a/tests/run-macros/tasty-interpolation-1/Macro.scala +++ b/tests/run-macros/tasty-interpolation-1/Macro.scala @@ -56,7 +56,7 @@ abstract class MacroStringInterpolator[T] { protected def getStaticStringContext(strCtxExpr: Expr[StringContext])(using qctx: QuoteContext) : StringContext = { import qctx.reflect._ - strCtxExpr.unseal.underlyingArgument match { + strCtxExpr.asReflectTree.underlyingArgument match { case Select(Typed(Apply(_, List(Apply(_, List(Typed(Repeated(strCtxArgTrees, _), Inferred()))))), _), _) => val strCtxArgs = strCtxArgTrees.map { case Literal(Constant.String(str)) => str @@ -70,7 +70,7 @@ abstract class MacroStringInterpolator[T] { protected def getArgsList(argsExpr: Expr[Seq[Any]])(using qctx: QuoteContext) : List[Expr[Any]] = { import qctx.reflect._ - argsExpr.unseal.underlyingArgument match { + argsExpr.asReflectTree.underlyingArgument match { case Typed(Repeated(args, _), _) => args.map(_.asExpr) case tree => throw new NotStaticlyKnownError("Expected statically known argument list", tree.asExpr) } diff --git a/tests/run-macros/tasty-macro-assert/quoted_1.scala b/tests/run-macros/tasty-macro-assert/quoted_1.scala index 1342c8dccec4..66845a7032ab 100644 --- a/tests/run-macros/tasty-macro-assert/quoted_1.scala +++ b/tests/run-macros/tasty-macro-assert/quoted_1.scala @@ -15,7 +15,7 @@ object Asserts { def impl(cond: Expr[Boolean])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val tree = cond.unseal + val tree = cond.asReflectTree def isOps(tpe: TypeRepr): Boolean = tpe match { case tpe: TermRef => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts diff --git a/tests/run-macros/tasty-macro-const/quoted_1.scala b/tests/run-macros/tasty-macro-const/quoted_1.scala index 70f934ecadce..99175274b393 100644 --- a/tests/run-macros/tasty-macro-const/quoted_1.scala +++ b/tests/run-macros/tasty-macro-const/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { def natConstImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[Int] = { import qctx.reflect._ - val xTree: Term = x.unseal + val xTree: Term = x.asReflectTree xTree match { case Inlined(_, _, Literal(Constant.Int(n))) => if (n <= 0) { diff --git a/tests/run-macros/tasty-macro-positions/quoted_1.scala b/tests/run-macros/tasty-macro-positions/quoted_1.scala index 2beb59f91c30..63108df79dd1 100644 --- a/tests/run-macros/tasty-macro-positions/quoted_1.scala +++ b/tests/run-macros/tasty-macro-positions/quoted_1.scala @@ -10,8 +10,8 @@ object Macros { def impl(x: Expr[Any])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val pos = x.unseal.underlyingArgument.pos - val code = x.unseal.underlyingArgument.show + val pos = x.asReflectTree.underlyingArgument.pos + val code = x.asReflectTree.underlyingArgument.show '{ println(${posStr(qctx)(pos)}) println(${Expr(code)}) diff --git a/tests/run-macros/tasty-original-source/Macros_1.scala b/tests/run-macros/tasty-original-source/Macros_1.scala index dcb27e49bc09..a8151988e5a2 100644 --- a/tests/run-macros/tasty-original-source/Macros_1.scala +++ b/tests/run-macros/tasty-original-source/Macros_1.scala @@ -6,7 +6,7 @@ object Macros { private def impl(arg: Expr[Any])(using qctx: QuoteContext) : Expr[(String, Any)] = { import qctx.reflect._ - val source = Expr(arg.unseal.underlyingArgument.pos.sourceCode.toString) + val source = Expr(arg.asReflectTree.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 2d5e7aef8526..06e9113a2ae4 100644 --- a/tests/run-macros/tasty-overload-secondargs/Macro_1.scala +++ b/tests/run-macros/tasty-overload-secondargs/Macro_1.scala @@ -23,12 +23,12 @@ object Macro: def mThenImpl[A:Type, B:Type, S<:(A=>B) :Type, R:Type](x:Expr[S])(using qctx: QuoteContext):Expr[R]= import qctx.reflect._ - val fun = '{X}.unseal + val fun = '{X}.asReflectTree val returnType = TypeRepr.of[(S) => ?] val firstPart = Select.overloaded(fun,"andThen", List(TypeIdent(defn.IntClass).tpe, TypeIdent(defn.IntClass).tpe), List(Literal(Constant.Int(1))), TypeRepr.of[(S) => R] ) - val r = Apply(firstPart,List(x.unseal)) + val r = Apply(firstPart,List(x.asReflectTree)) r.asExprOf[R] diff --git a/tests/run-macros/tasty-seal-method/quoted_1.scala b/tests/run-macros/tasty-seal-method/quoted_1.scala index f202557ea720..9b7bdb02121a 100644 --- a/tests/run-macros/tasty-seal-method/quoted_1.scala +++ b/tests/run-macros/tasty-seal-method/quoted_1.scala @@ -9,7 +9,7 @@ object Asserts { def zeroLastArgsImpl(x: Expr[Int])(using qctx: QuoteContext) : Expr[Int] = { import qctx.reflect._ // For simplicity assumes that all parameters are Int and parameter lists have no more than 3 elements - x.unseal.underlyingArgument match { + x.asReflectTree.underlyingArgument match { case Apply(fn, args) => fn.tpe.widen match { case _: MethodType => @@ -35,15 +35,15 @@ object Asserts { case Apply(fn, args) => val pre = rec(fn) args.size match { - case 0 => Expr.betaReduce('{ ${pre.etaExpand.asExprOf[() => Any]}() }).unseal - case 1 => Expr.betaReduce('{ ${pre.etaExpand.asExprOf[Int => Any]}(0) }).unseal - case 2 => Expr.betaReduce('{ ${pre.etaExpand.asExprOf[(Int, Int) => Any]}(0, 0) }).unseal - case 3 => Expr.betaReduce('{ ${pre.etaExpand.asExprOf[(Int, Int, Int) => Any]}(0, 0, 0) }).unseal + case 0 => Expr.betaReduce('{ ${pre.etaExpand.asExprOf[() => Any]}() }).asReflectTree + case 1 => Expr.betaReduce('{ ${pre.etaExpand.asExprOf[Int => Any]}(0) }).asReflectTree + case 2 => Expr.betaReduce('{ ${pre.etaExpand.asExprOf[(Int, Int) => Any]}(0, 0) }).asReflectTree + case 3 => Expr.betaReduce('{ ${pre.etaExpand.asExprOf[(Int, Int, Int) => Any]}(0, 0, 0) }).asReflectTree } case _ => term } - rec(x.unseal.underlyingArgument).asExprOf[Int] + rec(x.asReflectTree.underlyingArgument).asExprOf[Int] } } 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 f36c3a36e759..098acc0a4931 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 @@ -24,7 +24,7 @@ object Macro { val reporter = new Reporter { def errorOnPart(msg: String, partIdx: Int): Unit = { import qctx.reflect._ - Reporting.error(msg, parts(partIdx).unseal.pos) + Reporting.error(msg, parts(partIdx).asReflectTree.pos) } } fooCore(parts, args, reporter) @@ -38,7 +38,7 @@ object Macro { val reporter = new Reporter { def errorOnPart(msg: String, partIdx: Int): Unit = { import qctx.reflect._ - val pos = parts(partIdx).unseal.pos + val pos = parts(partIdx).asReflectTree.pos errors += '{ Tuple4(${Expr(partIdx)}, ${Expr(pos.start)}, ${Expr(pos.end)}, ${Expr(msg)}) } } } diff --git a/tests/run-macros/tasty-tree-map/quoted_1.scala b/tests/run-macros/tasty-tree-map/quoted_1.scala index 9ae1fc130809..67605b588e12 100644 --- a/tests/run-macros/tasty-tree-map/quoted_1.scala +++ b/tests/run-macros/tasty-tree-map/quoted_1.scala @@ -7,6 +7,6 @@ object MacrosImpl: def impl[T: Type](x: Expr[T])(using qctx: QuoteContext) : Expr[T] = { import qctx.reflect._ val identityMap = new TreeMap { } - val transformed = identityMap.transformTerm(x.unseal).asExprOf[T] + val transformed = identityMap.transformTerm(x.asReflectTree).asExprOf[T] transformed } diff --git a/tests/run-macros/tasty-unsafe-let/quoted_1.scala b/tests/run-macros/tasty-unsafe-let/quoted_1.scala index c6aab62eb007..d620a2b24614 100644 --- a/tests/run-macros/tasty-unsafe-let/quoted_1.scala +++ b/tests/run-macros/tasty-unsafe-let/quoted_1.scala @@ -8,11 +8,11 @@ object Macros { private def impl[T: Type](rhs: Expr[T], body: Expr[T => Unit])(using qctx: QuoteContext) : Expr[Unit] = { import qctx.reflect._ - val rhsTerm = rhs.unseal + val rhsTerm = rhs.asReflectTree import qctx.reflect._ ValDef.let(rhsTerm) { rhsId => - Expr.betaReduce('{$body(${rhsId.asExpr.asInstanceOf[Expr[T]]})}).unseal // Dangerous uncheked cast! + Expr.betaReduce('{$body(${rhsId.asExpr.asInstanceOf[Expr[T]]})}).asReflectTree // Dangerous uncheked cast! }.asExprOf[Unit] } diff --git a/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala index 8f4d63f04ae7..4e51778a88c4 100644 --- a/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-1/XmlQuote_1.scala @@ -41,7 +41,7 @@ object XmlQuote { tree.symbol.fullName == "scala.StringContext$.apply" // XmlQuote.SCOps(StringContext.apply([p0, ...]: String*) - val parts = receiver.unseal.underlyingArgument match { + val parts = receiver.asReflectTree.underlyingArgument match { case Apply(conv, List(Apply(fun, List(Typed(Repeated(values, _), _))))) if isSCOpsConversion(conv) && isStringContextApply(fun) && @@ -53,7 +53,7 @@ object XmlQuote { } // [a0, ...]: Any* - val Typed(Repeated(args0, _), _) = args.unseal.underlyingArgument + val Typed(Repeated(args0, _), _) = args.asReflectTree.underlyingArgument val string = parts.mkString("??") '{new Xml(${Expr(string)}, ${liftListOfAny(args0)})} diff --git a/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala b/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala index 7ca06828f913..9d5cc9a113bd 100644 --- a/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala +++ b/tests/run-macros/xml-interpolation-2/XmlQuote_1.scala @@ -36,7 +36,7 @@ object XmlQuote { } // XmlQuote.SCOps(StringContext.apply([p0, ...]: String*) - val parts: List[String] = stripTyped(receiver.unseal.underlying) match { + val parts: List[String] = stripTyped(receiver.asReflectTree.underlying) match { case Apply(conv, List(ctx1)) if isSCOpsConversion(conv) => ctx1 match { case Apply(fun, List(Typed(Repeated(values, _), _))) if isStringContextApply(fun) => @@ -56,7 +56,7 @@ object XmlQuote { } // [a0, ...]: Any* - val args2: Expr[List[Any]] = args.unseal.underlyingArgument match { + val args2: Expr[List[Any]] = args.asReflectTree.underlyingArgument match { case Typed(Repeated(args0, _), _) => // statically known args, make list directly Expr.ofList(args0.map(_.asExpr)) case _ =>