diff --git a/library/src/scala/tasty/Reflection.scala b/library/src/scala/tasty/Reflection.scala index e9cdfc0599de..b7fecff9a9d7 100644 --- a/library/src/scala/tasty/Reflection.scala +++ b/library/src/scala/tasty/Reflection.scala @@ -4,7 +4,6 @@ import scala.tasty.reflect._ abstract class Reflection extends Core - with CaseDefOps with ConstantOps with ContextOps with CommentOps diff --git a/library/src/scala/tasty/reflect/CaseDefOps.scala b/library/src/scala/tasty/reflect/CaseDefOps.scala deleted file mode 100644 index 3760628d749b..000000000000 --- a/library/src/scala/tasty/reflect/CaseDefOps.scala +++ /dev/null @@ -1,50 +0,0 @@ -package scala.tasty -package reflect - -/** Tasty reflect case definition */ -trait CaseDefOps extends Core { - - implicit class CaseDefAPI(caseDef: CaseDef) { - def pattern(implicit ctx: Context): Pattern = kernel.CaseDef_pattern(caseDef) - def guard(implicit ctx: Context): Option[Term] = kernel.CaseDef_guard(caseDef) - def rhs(implicit ctx: Context): Term = kernel.CaseDef_rhs(caseDef) - } - - object IsCaseDef { - def unapply(self: Tree)(implicit ctx: Context): Option[CaseDef] = - kernel.matchCaseDef(self) - } - - object CaseDef { - def apply(pattern: Pattern, guard: Option[Term], rhs: Term)(implicit ctx: Context): CaseDef = - kernel.CaseDef_module_apply(pattern, guard, rhs) - - def copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], rhs: Term)(implicit ctx: Context): CaseDef = - kernel.CaseDef_module_copy(original)(pattern, guard, rhs) - - def unapply(tree: Tree)(implicit ctx: Context): Option[(Pattern, Option[Term], Term)] = - kernel.matchCaseDef(tree).map( x => (x.pattern, x.guard, x.rhs)) - } - - implicit class TypeCaseDefAPI(caseDef: TypeCaseDef) { - def pattern(implicit ctx: Context): TypeTree = kernel.TypeCaseDef_pattern(caseDef) - def rhs(implicit ctx: Context): TypeTree = kernel.TypeCaseDef_rhs(caseDef) - } - - object IsTypeCaseDef { - def unapply(self: Tree)(implicit ctx: Context): Option[TypeCaseDef] = - kernel.matchTypeCaseDef(self) - } - - object TypeCaseDef { - def apply(pattern: TypeTree, rhs: TypeTree)(implicit ctx: Context): TypeCaseDef = - kernel.TypeCaseDef_module_apply(pattern, rhs) - - def copy(original: TypeCaseDef)(pattern: TypeTree, rhs: TypeTree)(implicit ctx: Context): TypeCaseDef = - kernel.TypeCaseDef_module_copy(original)(pattern, rhs) - - def unapply(tree: Tree)(implicit ctx: Context): Option[(TypeTree, TypeTree)] = - kernel.matchTypeCaseDef(tree).map( x => (x.pattern, x.rhs)) - } - -} diff --git a/library/src/scala/tasty/reflect/Printers.scala b/library/src/scala/tasty/reflect/Printers.scala index 7ad4227d18c6..4f0a749d94c2 100644 --- a/library/src/scala/tasty/reflect/Printers.scala +++ b/library/src/scala/tasty/reflect/Printers.scala @@ -8,7 +8,6 @@ import scala.tasty.util.Chars trait Printers extends Core - with CaseDefOps with ConstantOps with FlagsOps with IdOps diff --git a/library/src/scala/tasty/reflect/TreeOps.scala b/library/src/scala/tasty/reflect/TreeOps.scala index d60ad0ff9372..2c456949d777 100644 --- a/library/src/scala/tasty/reflect/TreeOps.scala +++ b/library/src/scala/tasty/reflect/TreeOps.scala @@ -1037,4 +1037,48 @@ trait TreeOps extends Core { kernel.matchWildcardTypeTree(tree).isDefined } + // ----- CaseDefs ------------------------------------------------ + + implicit class CaseDefAPI(caseDef: CaseDef) { + def pattern(implicit ctx: Context): Pattern = kernel.CaseDef_pattern(caseDef) + def guard(implicit ctx: Context): Option[Term] = kernel.CaseDef_guard(caseDef) + def rhs(implicit ctx: Context): Term = kernel.CaseDef_rhs(caseDef) + } + + object IsCaseDef { + def unapply(self: Tree)(implicit ctx: Context): Option[CaseDef] = + kernel.matchCaseDef(self) + } + + object CaseDef { + def apply(pattern: Pattern, guard: Option[Term], rhs: Term)(implicit ctx: Context): CaseDef = + kernel.CaseDef_module_apply(pattern, guard, rhs) + + def copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], rhs: Term)(implicit ctx: Context): CaseDef = + kernel.CaseDef_module_copy(original)(pattern, guard, rhs) + + def unapply(tree: Tree)(implicit ctx: Context): Option[(Pattern, Option[Term], Term)] = + kernel.matchCaseDef(tree).map( x => (x.pattern, x.guard, x.rhs)) + } + + implicit class TypeCaseDefAPI(caseDef: TypeCaseDef) { + def pattern(implicit ctx: Context): TypeTree = kernel.TypeCaseDef_pattern(caseDef) + def rhs(implicit ctx: Context): TypeTree = kernel.TypeCaseDef_rhs(caseDef) + } + + object IsTypeCaseDef { + def unapply(self: Tree)(implicit ctx: Context): Option[TypeCaseDef] = + kernel.matchTypeCaseDef(self) + } + + object TypeCaseDef { + def apply(pattern: TypeTree, rhs: TypeTree)(implicit ctx: Context): TypeCaseDef = + kernel.TypeCaseDef_module_apply(pattern, rhs) + + def copy(original: TypeCaseDef)(pattern: TypeTree, rhs: TypeTree)(implicit ctx: Context): TypeCaseDef = + kernel.TypeCaseDef_module_copy(original)(pattern, rhs) + + def unapply(tree: Tree)(implicit ctx: Context): Option[(TypeTree, TypeTree)] = + kernel.matchTypeCaseDef(tree).map( x => (x.pattern, x.rhs)) + } } diff --git a/library/src/scala/tasty/reflect/TreeUtils.scala b/library/src/scala/tasty/reflect/TreeUtils.scala index ddbeeabd290b..4fec048ac8f0 100644 --- a/library/src/scala/tasty/reflect/TreeUtils.scala +++ b/library/src/scala/tasty/reflect/TreeUtils.scala @@ -4,7 +4,6 @@ package reflect /** Tasty reflect case definition */ trait TreeUtils extends Core - with CaseDefOps with PatternOps with SymbolOps with TreeOps { diff --git a/semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala b/semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala index a4a865722f7e..8bf7e2f39365 100644 --- a/semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala +++ b/semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala @@ -53,11 +53,6 @@ class SemanticdbConsumer(sourceFilePath: java.nio.file.Path) extends TastyConsum def traverseTypeTree(tree: Tree /*TypeTree | TypeBoundsTree*/)( implicit ctx: Context): Unit = childrenType = tree :: childrenType - override def traverseCaseDef(tree: CaseDef)(implicit ctx: Context): Unit = - () - override def traverseTypeCaseDef(tree: TypeCaseDef)( - implicit ctx: Context): Unit = - () def getChildren(tree: Tree)(implicit ctx: Context): List[Tree] = { children = Nil