diff --git a/tests/neg-macros/delegate-match-1/Macro_1.scala b/tests/neg-macros/delegate-match-1/Macro_1.scala index 2a4dc426d9d1..a697bcf715d9 100644 --- a/tests/neg-macros/delegate-match-1/Macro_1.scala +++ b/tests/neg-macros/delegate-match-1/Macro_1.scala @@ -6,15 +6,15 @@ inline def f: Any = ${ fImpl } private def fImpl(given qctx: QuoteContext): Expr[Unit] = { import qctx.tasty.{_, given} searchImplicit(('[A]).unseal.tpe) match { - case IsImplicitSearchSuccess(x) => + case x: ImplicitSearchSuccess => '{} - case IsDivergingImplicit(x) => '{} + case x: DivergingImplicit => '{} error("DivergingImplicit\n" + x.explanation, rootPosition) '{} - case IsNoMatchingImplicits(x) => + case x: NoMatchingImplicits => error("NoMatchingImplicits\n" + x.explanation, rootPosition) '{} - case IsAmbiguousImplicits(x) => + case x: AmbiguousImplicits => error("AmbiguousImplicits\n" + x.explanation, rootPosition) '{} } diff --git a/tests/neg-macros/delegate-match-2/Macro_1.scala b/tests/neg-macros/delegate-match-2/Macro_1.scala index 2a4dc426d9d1..a697bcf715d9 100644 --- a/tests/neg-macros/delegate-match-2/Macro_1.scala +++ b/tests/neg-macros/delegate-match-2/Macro_1.scala @@ -6,15 +6,15 @@ inline def f: Any = ${ fImpl } private def fImpl(given qctx: QuoteContext): Expr[Unit] = { import qctx.tasty.{_, given} searchImplicit(('[A]).unseal.tpe) match { - case IsImplicitSearchSuccess(x) => + case x: ImplicitSearchSuccess => '{} - case IsDivergingImplicit(x) => '{} + case x: DivergingImplicit => '{} error("DivergingImplicit\n" + x.explanation, rootPosition) '{} - case IsNoMatchingImplicits(x) => + case x: NoMatchingImplicits => error("NoMatchingImplicits\n" + x.explanation, rootPosition) '{} - case IsAmbiguousImplicits(x) => + case x: AmbiguousImplicits => error("AmbiguousImplicits\n" + x.explanation, rootPosition) '{} } diff --git a/tests/neg-macros/delegate-match-3/Macro_1.scala b/tests/neg-macros/delegate-match-3/Macro_1.scala index 2a4dc426d9d1..a697bcf715d9 100644 --- a/tests/neg-macros/delegate-match-3/Macro_1.scala +++ b/tests/neg-macros/delegate-match-3/Macro_1.scala @@ -6,15 +6,15 @@ inline def f: Any = ${ fImpl } private def fImpl(given qctx: QuoteContext): Expr[Unit] = { import qctx.tasty.{_, given} searchImplicit(('[A]).unseal.tpe) match { - case IsImplicitSearchSuccess(x) => + case x: ImplicitSearchSuccess => '{} - case IsDivergingImplicit(x) => '{} + case x: DivergingImplicit => '{} error("DivergingImplicit\n" + x.explanation, rootPosition) '{} - case IsNoMatchingImplicits(x) => + case x: NoMatchingImplicits => error("NoMatchingImplicits\n" + x.explanation, rootPosition) '{} - case IsAmbiguousImplicits(x) => + case x: AmbiguousImplicits => error("AmbiguousImplicits\n" + x.explanation, rootPosition) '{} } 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 5f5e5c31f6ee..c0d830772f19 100644 --- a/tests/neg-macros/tasty-macro-assert-1/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-assert-1/quoted_1.scala @@ -18,7 +18,7 @@ object Asserts { val tree = cond.unseal def isOps(tpe: TypeOrBounds): Boolean = tpe match { - case IsTermRef(tpe) => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts + case tpe: TermRef => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts case _ => false } 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 6e16d67cf112..7e3a7159dab5 100644 --- a/tests/neg-macros/tasty-macro-assert-2/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-assert-2/quoted_1.scala @@ -18,7 +18,7 @@ object Asserts { val tree = cond.unseal def isOps(tpe: TypeOrBounds): Boolean = tpe match { - case IsTermRef(tpe) => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts + case tpe: TermRef => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts case _ => false } 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 ab6f853cb7ab..e7ded9fa7cf1 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 @@ -14,12 +14,12 @@ object Macros { val output = new TreeTraverser { override def traverseTree(tree: Tree)(implicit ctx: Context): Unit = { tree match { - case IsDefinition(tree @ DefDef(name, _, _, _, _)) => + case tree @ DefDef(name, _, _, _, _) => buff.append(name) buff.append("\n") buff.append(tree.symbol.owner.tree.showExtractors) buff.append("\n\n") - case IsDefinition(tree @ ValDef(name, _, _)) => + case tree @ ValDef(name, _, _) => buff.append(name) buff.append("\n") buff.append(tree.symbol.owner.tree.showExtractors) diff --git a/tests/run-macros/flops-rewrite-2/Macro_1.scala b/tests/run-macros/flops-rewrite-2/Macro_1.scala index 9e7424ed2bd2..97ee354c8611 100644 --- a/tests/run-macros/flops-rewrite-2/Macro_1.scala +++ b/tests/run-macros/flops-rewrite-2/Macro_1.scala @@ -76,13 +76,13 @@ private class Rewriter(preTransform: List[Transformation[_]] = Nil, postTransfor import qctx.tasty.{_, given} class MapChildren extends TreeMap { override def transformTerm(tree: Term)(given ctx: Context): Term = tree match { - case IsClosure(_) => + case _: Closure => tree - case IsInlined(_) | IsSelect(_) => + case _: Inlined | _: Select => transformChildrenTerm(tree) case _ => tree.tpe.widen match { - case IsMethodType(_) | IsPolyType(_) => + case _: MethodType | _: PolyType => transformChildrenTerm(tree) case _ => tree.seal match { diff --git a/tests/run-macros/flops-rewrite-3/Macro_1.scala b/tests/run-macros/flops-rewrite-3/Macro_1.scala index 05df12a82f97..55543e0a7c8a 100644 --- a/tests/run-macros/flops-rewrite-3/Macro_1.scala +++ b/tests/run-macros/flops-rewrite-3/Macro_1.scala @@ -112,13 +112,13 @@ private class Rewriter private (preTransform: List[Transformation] = Nil, postTr import qctx.tasty.{_, given} class MapChildren extends TreeMap { override def transformTerm(tree: Term)(given ctx: Context): Term = tree match { - case IsClosure(_) => + case _: Closure => tree - case IsInlined(_) | IsSelect(_) => + case _: Inlined | _: Select => transformChildrenTerm(tree) case _ => tree.tpe.widen match { - case IsMethodType(_) | IsPolyType(_) => + case _: MethodType | _: PolyType => transformChildrenTerm(tree) case _ => tree.seal match { diff --git a/tests/run-macros/flops-rewrite/Macro_1.scala b/tests/run-macros/flops-rewrite/Macro_1.scala index 4c432283b74c..d78df3dc4cbf 100644 --- a/tests/run-macros/flops-rewrite/Macro_1.scala +++ b/tests/run-macros/flops-rewrite/Macro_1.scala @@ -58,13 +58,13 @@ private class Rewriter(preTransform: Expr[Any] => Expr[Any], postTransform: Expr import qctx.tasty.{_, given} class MapChildren extends TreeMap { override def transformTerm(tree: Term)(given ctx: Context): Term = tree match { - case IsClosure(_) => + case _: Closure => tree - case IsInlined(_) | IsSelect(_) => + case _: Inlined | _: Select => transformChildrenTerm(tree) case _ => tree.tpe.widen match { - case IsMethodType(_) | IsPolyType(_) => + case _: MethodType | _: PolyType => transformChildrenTerm(tree) case _ => tree.seal match { diff --git a/tests/run-macros/inferred-repeated-result/test_1.scala b/tests/run-macros/inferred-repeated-result/test_1.scala index b9c4f7a36b6e..e84035e40901 100644 --- a/tests/run-macros/inferred-repeated-result/test_1.scala +++ b/tests/run-macros/inferred-repeated-result/test_1.scala @@ -11,9 +11,10 @@ object Macros { val methods = tree.tpe.classSymbol.get.classMethods.map { m => val name = m.show - val IsDefDef(ddef) = m.tree - val returnType = ddef.returnTpt.tpe.show - s"$name : $returnType" + m.tree match + case ddef: DefDef => + val returnType = ddef.returnTpt.tpe.show + s"$name : $returnType" }.sorted methods.foldLeft('{}) { (res, m) => '{ $res; println(${m}) } } diff --git a/tests/run-macros/tasty-custom-show/quoted_1.scala b/tests/run-macros/tasty-custom-show/quoted_1.scala index 699e4b11da68..361e7ffa1f82 100644 --- a/tests/run-macros/tasty-custom-show/quoted_1.scala +++ b/tests/run-macros/tasty-custom-show/quoted_1.scala @@ -17,12 +17,12 @@ object Macros { // Use custom Show[_] here val printer = dummyShow tree match { - case IsDefinition(tree @ DefDef(name, _, _, _, _)) => + case tree @ DefDef(name, _, _, _, _) => buff.append(name) buff.append("\n") buff.append(printer.showTree(tree)) buff.append("\n\n") - case IsDefinition(tree @ ValDef(name, _, _)) => + case tree @ ValDef(name, _, _) => buff.append(name) buff.append("\n") buff.append(printer.showTree(tree)) diff --git a/tests/run-macros/tasty-eval/quoted_1.scala b/tests/run-macros/tasty-eval/quoted_1.scala index 25c26026b850..6ab7b509ae9c 100644 --- a/tests/run-macros/tasty-eval/quoted_1.scala +++ b/tests/run-macros/tasty-eval/quoted_1.scala @@ -21,12 +21,13 @@ object Macros { import qctx.tasty.{_, given} e.unseal.tpe match { - case IsTermRef(pre) if pre.termSymbol.isValDef => - val IsValDef(t) = pre.termSymbol.tree - t.tpt.tpe match { - case ConstantType(Constant(i: Int)) => Some(i) - case _ => None - } + case pre: TermRef if pre.termSymbol.isValDef => + pre.termSymbol.tree match + case t: ValDef => + t.tpt.tpe match { + case ConstantType(Constant(i: Int)) => Some(i) + case _ => None + } case ConstantType(Constant(i: Int)) => Some(i) case _ => None } diff --git a/tests/run-macros/tasty-extractors-3/quoted_1.scala b/tests/run-macros/tasty-extractors-3/quoted_1.scala index 8f3f4f414371..47f046ef8763 100644 --- a/tests/run-macros/tasty-extractors-3/quoted_1.scala +++ b/tests/run-macros/tasty-extractors-3/quoted_1.scala @@ -13,11 +13,11 @@ object Macros { val buff = new StringBuilder val traverser = new TreeTraverser { override def traverseTree(tree: Tree)(implicit ctx: Context): Unit = tree match { - case IsTypeBoundsTree(tree) => + case tree: TypeBoundsTree => buff.append(tree.tpe.showExtractors) buff.append("\n\n") traverseTreeChildren(tree) - case IsTypeTree(tree) => + case tree: TypeTree => buff.append(tree.tpe.showExtractors) buff.append("\n\n") traverseTreeChildren(tree) diff --git a/tests/run-macros/tasty-macro-assert/quoted_1.scala b/tests/run-macros/tasty-macro-assert/quoted_1.scala index 6c110c6c3eb4..48e02875deb9 100644 --- a/tests/run-macros/tasty-macro-assert/quoted_1.scala +++ b/tests/run-macros/tasty-macro-assert/quoted_1.scala @@ -18,7 +18,7 @@ object Asserts { val tree = cond.unseal def isOps(tpe: TypeOrBounds): Boolean = tpe match { - case IsTermRef(tpe) => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts + case tpe: TermRef => tpe.termSymbol.isDefDef && tpe.name == "Ops"// TODO check that the parent is Asserts case _ => false } diff --git a/tests/run-macros/tasty-seal-method/quoted_1.scala b/tests/run-macros/tasty-seal-method/quoted_1.scala index f20333392d3f..b3f9c662681d 100644 --- a/tests/run-macros/tasty-seal-method/quoted_1.scala +++ b/tests/run-macros/tasty-seal-method/quoted_1.scala @@ -12,7 +12,7 @@ object Asserts { x.unseal.underlyingArgument match { case Apply(fn, args) => fn.tpe.widen match { - case IsMethodType(_) => + case _: MethodType => args.size match { case 0 => Expr.betaReduce(fn.etaExpand.seal.cast[() => Int])() case 1 => Expr.betaReduce(fn.etaExpand.seal.cast[Int => Int])('{0}) diff --git a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala index 42c6fbba2ccc..499ce7aa014d 100644 --- a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala +++ b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/TreeInterpreter.scala @@ -26,11 +26,12 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) { def interpretCall(inst: AbstractAny, sym: Symbol, args: List[AbstractAny]): Result = { // TODO // withLocalValue(`this`, inst) { - val IsDefDef(ddef) = sym.tree - val syms = ddef.paramss.headOption.getOrElse(Nil).map(_.symbol) - withLocalValues(syms, args.map(LocalValue.valFrom(_))) { - eval(ddef.rhs.get) - } + sym.tree match + case ddef: DefDef => + val syms = ddef.paramss.headOption.getOrElse(Nil).map(_.symbol) + withLocalValues(syms, args.map(LocalValue.valFrom(_))) { + eval(ddef.rhs.get) + } // } } @@ -42,11 +43,12 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) { case _ => } val evaluatedArgs = argss.flatten.map(arg => LocalValue.valFrom(eval(arg))) - val IsDefDef(ddef) = fn.symbol.tree - val syms = ddef.paramss.headOption.getOrElse(Nil).map(_.symbol) - withLocalValues(syms, evaluatedArgs) { - eval(ddef.rhs.get) - } + fn.symbol.tree match + case ddef: DefDef => + val syms = ddef.paramss.headOption.getOrElse(Nil).map(_.symbol) + withLocalValues(syms, evaluatedArgs) { + eval(ddef.rhs.get) + } } def interpretValGet(fn: Term): Result = @@ -207,8 +209,8 @@ abstract class TreeInterpreter[R <: Reflection & Singleton](val reflect: R) { private object Call { def unapply(arg: Tree): Option[(Term, List[TypeTree], List[List[Term]])] = arg match { - case IsSelect(fn) => Some((fn, Nil, Nil)) - case IsIdent(fn) => Some((fn, Nil, Nil)) + case fn: Select => Some((fn, Nil, Nil)) + case fn: Ident => Some((fn, Nil, Nil)) case Apply(Call(fn, targs, args1), args2) => Some((fn, targs, args1 :+ args2)) case TypeApply(Call(fn, _, _), targs) => Some((fn, targs, Nil)) case _ => None diff --git a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala index 4387b6099684..1a6aabd1b09a 100644 --- a/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala +++ b/tests/run-with-compiler-custom-args/tasty-interpreter/interpreter/jvm/Interpreter.scala @@ -17,7 +17,7 @@ class Interpreter[R <: Reflection & Singleton](reflect0: R) extends TreeInterpre // Best effort to try to create a proxy val sym = fn.symbol.owner if (sym.isClassDef) { - val IsClassDef(tree) = sym.tree + sym.tree match case tree: ClassDef => val parentSymbols = tree.parents.tail.map(_.asInstanceOf[TypeTree].symbol).head import java.lang.reflect._ val handler: InvocationHandler = new InvocationHandler() { diff --git a/tests/run-with-compiler/tasty-comment-consumer/Test.scala b/tests/run-with-compiler/tasty-comment-consumer/Test.scala index 0bd98f3e789f..afe07c067528 100644 --- a/tests/run-with-compiler/tasty-comment-consumer/Test.scala +++ b/tests/run-with-compiler/tasty-comment-consumer/Test.scala @@ -14,7 +14,7 @@ class CommentConsumer extends TastyConsumer { object Traverser extends TreeTraverser { override def traverseTree(tree: Tree)(implicit ctx: Context): Unit = tree match { - case IsDefinition(tree) => + case tree: Definition => tree.symbol.comment match { case Some(com) => println(com.raw) case None => println()