diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala index 874906f7422f..296974ffe27c 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala @@ -9,10 +9,10 @@ import scala.quoted.show.SyntaxHighlight object ReflectionImpl { def apply(rootContext: Contexts.Context): scala.tasty.Reflection = - new scala.tasty.Reflection(new KernelImpl(rootContext)) + new scala.tasty.Reflection(new ReflectionCompilerInterface(rootContext)) def showTree(tree: tpd.Tree)(implicit ctx: Contexts.Context): String = { - val refl = new scala.tasty.Reflection(new KernelImpl(MacroExpansion.context(tree))) + val refl = new scala.tasty.Reflection(new ReflectionCompilerInterface(MacroExpansion.context(tree))) val reflCtx = ctx.asInstanceOf[refl.Context] val reflTree = tree.asInstanceOf[refl.Tree] val syntaxHighlight = diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionInternal.scala similarity index 99% rename from compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala rename to compiler/src/dotty/tools/dotc/tastyreflect/ReflectionInternal.scala index 75bc5738c1bf..2a991b0d4fab 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionInternal.scala @@ -16,9 +16,9 @@ import dotty.tools.dotc.parsing.Parsers.Parser import dotty.tools.dotc.typer.Implicits.{AmbiguousImplicits, DivergingImplicit, NoMatchingImplicits, SearchFailure, SearchFailureType} import dotty.tools.dotc.util.{SourceFile, SourcePosition, Spans} -import scala.tasty.reflect.Kernel +import scala.tasty.reflect.CompilerInterface -class KernelImpl(val rootContext: core.Contexts.Context) extends Kernel { +class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extends CompilerInterface { import tpd._ private implicit def ctx: core.Contexts.Context = rootContext diff --git a/library/src-bootstrapped/scala/internal/quoted/Matcher.scala b/library/src-bootstrapped/scala/internal/quoted/Matcher.scala index 4d24938106e7..379db19c63eb 100644 --- a/library/src-bootstrapped/scala/internal/quoted/Matcher.scala +++ b/library/src-bootstrapped/scala/internal/quoted/Matcher.scala @@ -51,8 +51,8 @@ object Matcher { def hasBindAnnotation(sym: Symbol) = sym.annots.exists(isBindAnnotation) def isBindAnnotation(tree: Tree): Boolean = tree match { - case New(tpt) => tpt.symbol == kernel.Definitions_InternalQuoted_patternBindHoleAnnot - case annot => annot.symbol.owner == kernel.Definitions_InternalQuoted_patternBindHoleAnnot + case New(tpt) => tpt.symbol == internal.Definitions_InternalQuoted_patternBindHoleAnnot + case annot => annot.symbol.owner == internal.Definitions_InternalQuoted_patternBindHoleAnnot } /** Check that all trees match with `mtch` and concatenate the results with && */ @@ -102,14 +102,14 @@ object Matcher { // Match a scala.internal.Quoted.patternHole typed as a repeated argument and return the scrutinee tree case (IsTerm(scrutinee @ Typed(s, tpt1)), Typed(TypeApply(patternHole, tpt :: Nil), tpt2)) - if patternHole.symbol == kernel.Definitions_InternalQuoted_patternHole && + if patternHole.symbol == internal.Definitions_InternalQuoted_patternHole && s.tpe <:< tpt.tpe && tpt2.tpe.derivesFrom(definitions.RepeatedParamClass) => matched(scrutinee.seal) // Match a scala.internal.Quoted.patternHole and return the scrutinee tree case (IsTerm(scrutinee), TypeApply(patternHole, tpt :: Nil)) - if patternHole.symbol == kernel.Definitions_InternalQuoted_patternHole && + if patternHole.symbol == internal.Definitions_InternalQuoted_patternHole && scrutinee.tpe <:< tpt.tpe => matched(scrutinee.seal) @@ -142,7 +142,7 @@ object Matcher { fn1 =#= fn2 && args1 =##= args2 case (Block(stats1, expr1), Block(binding :: stats2, expr2)) if isTypeBinding(binding) => - qctx.tasty.kernel.Context_GADT_addToConstraint(the[Context])(binding.symbol :: Nil) + qctx.tasty.internal.Context_GADT_addToConstraint(the[Context])(binding.symbol :: Nil) matched(new SymBinding(binding.symbol)) && Block(stats1, expr1) =#= Block(stats2, expr2) case (Block(stat1 :: stats1, expr1), Block(stat2 :: stats2, expr2)) => @@ -152,7 +152,7 @@ object Matcher { case (scrutinee, Block(typeBindings, expr2)) if typeBindings.forall(isTypeBinding) => val bindingSymbols = typeBindings.map(_.symbol) - qctx.tasty.kernel.Context_GADT_addToConstraint(the[Context])(bindingSymbols) + qctx.tasty.internal.Context_GADT_addToConstraint(the[Context])(bindingSymbols) bindingSymbols.foldRight(scrutinee =#= expr2)((x, acc) => matched(new SymBinding(x)) && acc) case (If(cond1, thenp1, elsep1), If(cond2, thenp2, elsep2)) => @@ -336,13 +336,13 @@ object Matcher { val res = { if (hasTypeSplices) { - implicit val ctx: Context = qctx.tasty.kernel.Context_GADT_setFreshGADTBounds(rootContext) + implicit val ctx: Context = qctx.tasty.internal.Context_GADT_setFreshGADTBounds(rootContext) val matchings = scrutineeExpr.unseal.underlyingArgument =#= patternExpr.unseal.underlyingArgument // After matching and doing all subtype check, we have to aproximate all the type bindings // that we have found and seal them in a quoted.Type matchings.asOptionOfTuple.map { tup => Tuple.fromArray(tup.toArray.map { // TODO improve performace - case x: SymBinding => kernel.Context_GADT_approximation(the[Context])(x.sym, true).seal + case x: SymBinding => internal.Context_GADT_approximation(the[Context])(x.sym, true).seal case x => x }) } diff --git a/library/src/scala/quoted/Expr.scala b/library/src/scala/quoted/Expr.scala index bfb10d0bdee3..34bf4b61dab1 100644 --- a/library/src/scala/quoted/Expr.scala +++ b/library/src/scala/quoted/Expr.scala @@ -39,7 +39,7 @@ package quoted { /** Beta-reduces the function appication. Generates the an expression only containing the body of the function */ def apply[G] given (tg: TupledFunction[G, TupleOfExpr[Args] => Expr[R]]): G = { import qctx.tasty._ - tg.untupled(args => qctx.tasty.kernel.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf[QuoteContext => Expr[_]](qctx).unseal)).seal.asInstanceOf[Expr[R]]) + tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf[QuoteContext => Expr[_]](qctx).unseal)).seal.asInstanceOf[Expr[R]]) } } @@ -47,7 +47,7 @@ package quoted { /** Beta-reduces the function appication. Generates the an expression only containing the body of the function */ def apply[G] given (tg: TupledFunction[G, TupleOfExpr[Args] => Expr[R]]): G = { import qctx.tasty._ - tg.untupled(args => qctx.tasty.kernel.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf[QuoteContext => Expr[_]](qctx).unseal)).seal.asInstanceOf[Expr[R]]) + tg.untupled(args => qctx.tasty.internal.betaReduce(f.unseal, args.toArray.toList.map(_.asInstanceOf[QuoteContext => Expr[_]](qctx).unseal)).seal.asInstanceOf[Expr[R]]) } } diff --git a/library/src/scala/tasty/Reflection.scala b/library/src/scala/tasty/Reflection.scala index caa8ab180078..e61558907a58 100644 --- a/library/src/scala/tasty/Reflection.scala +++ b/library/src/scala/tasty/Reflection.scala @@ -2,7 +2,7 @@ package scala.tasty import scala.tasty.reflect._ -class Reflection(val kernel: Kernel) +class Reflection(private[scala] val internal: CompilerInterface) extends Core with ConstantOps with ContextOps @@ -37,7 +37,7 @@ class Reflection(val kernel: Kernel) * * The code should be a sequence of expressions or statements that may appear in a block. */ - def typeChecks(code: String)(implicit ctx: Context): Boolean = kernel.typeChecks(code) + def typeChecks(code: String)(implicit ctx: Context): Boolean = internal.typeChecks(code) } } diff --git a/library/src/scala/tasty/reflect/CommentOps.scala b/library/src/scala/tasty/reflect/CommentOps.scala index beec35df382c..3205a3f8a523 100644 --- a/library/src/scala/tasty/reflect/CommentOps.scala +++ b/library/src/scala/tasty/reflect/CommentOps.scala @@ -5,13 +5,13 @@ trait CommentOps extends Core { implicit class CommentAPI(self: Comment) { /** Raw comment string */ - def raw: String = kernel.Comment_raw(self) + def raw: String = internal.Comment_raw(self) /** Expanded comment string, if any */ - def expanded: Option[String] = kernel.Comment_expanded(self) + def expanded: Option[String] = internal.Comment_expanded(self) /** List of usecases and their corresponding trees, if any */ - def usecases: List[(String, Option[DefDef])] = kernel.Comment_usecases(self) + def usecases: List[(String, Option[DefDef])] = internal.Comment_usecases(self) } diff --git a/library/src/scala/tasty/reflect/ConstantOps.scala b/library/src/scala/tasty/reflect/ConstantOps.scala index 58cae3bb2129..eac00149d2de 100644 --- a/library/src/scala/tasty/reflect/ConstantOps.scala +++ b/library/src/scala/tasty/reflect/ConstantOps.scala @@ -4,27 +4,27 @@ package reflect trait ConstantOps extends Core { implicit class ConstantAPI(const: Constant) { - def value: Any = kernel.Constant_value(const) + def value: Any = internal.Constant_value(const) } /** Module of Constant literals */ object Constant { def apply(x: Unit | Null | Int | Boolean | Byte | Short | Int | Long | Float | Double | Char | String | Type): Constant = - kernel.Constant_apply(x) + internal.Constant_apply(x) def unapply(constant: Constant): Option[Unit | Null | Int | Boolean | Byte | Short | Int | Long | Float | Double | Char | String | Type] = - kernel.matchConstant(constant) + internal.matchConstant(constant) /** Module of ClassTag literals */ object ClassTag { /** scala.reflect.ClassTag literal */ def apply[T] given (x: Type): Constant = - kernel.Constant_ClassTag_apply(x) + internal.Constant_ClassTag_apply(x) /** Extractor for ClassTag literals */ def unapply(constant: Constant): Option[Type] = - kernel.matchConstant_ClassTag(constant) + internal.matchConstant_ClassTag(constant) } } } diff --git a/library/src/scala/tasty/reflect/ContextOps.scala b/library/src/scala/tasty/reflect/ContextOps.scala index 82a0230e14de..ccfb45e95fdb 100644 --- a/library/src/scala/tasty/reflect/ContextOps.scala +++ b/library/src/scala/tasty/reflect/ContextOps.scala @@ -5,14 +5,14 @@ trait ContextOps extends Core { implicit class ContextAPI(self: Context) { /** Returns the owner of the context */ - def owner: Symbol = kernel.Context_owner(self) + def owner: Symbol = internal.Context_owner(self) /** Returns the source file being compiled. The path is relative to the current working directory. */ - def source: java.nio.file.Path = kernel.Context_source(self) + def source: java.nio.file.Path = internal.Context_source(self) } /** Context of the macro expansion */ - implicit def rootContext: Context = kernel.rootContext + implicit def rootContext: Context = internal.rootContext } diff --git a/library/src/scala/tasty/reflect/Core.scala b/library/src/scala/tasty/reflect/Core.scala index b96dc7829aa2..91d77529fa79 100644 --- a/library/src/scala/tasty/reflect/Core.scala +++ b/library/src/scala/tasty/reflect/Core.scala @@ -120,85 +120,85 @@ package scala.tasty.reflect */ trait Core { - val kernel: Kernel + private[scala] val internal: CompilerInterface /** Compilation context */ - type Context = kernel.Context + type Context = internal.Context /** Settings */ - type Settings = kernel.Settings + type Settings = internal.Settings /** Tree representing code written in the source */ - type Tree = kernel.Tree + type Tree = internal.Tree /** Tree representing a pacakage clause in the source code */ - type PackageClause = kernel.PackageClause + type PackageClause = internal.PackageClause /** Tree representing a statement in the source code */ - type Statement = kernel.Statement + type Statement = internal.Statement /** Tree representing an import in the source code */ - type Import = kernel.Import + type Import = internal.Import /** Tree representing a definition in the source code. It can be `PackageDef`, `ClassDef`, `TypeDef`, `DefDef` or `ValDef` */ - type Definition = kernel.Definition + type Definition = internal.Definition /** Tree representing a package definition. This includes definitions in all source files */ - type PackageDef = kernel.PackageDef + type PackageDef = internal.PackageDef /** Tree representing a class definition. This includes annonymus class definitions and the class of a module object */ - type ClassDef = kernel.ClassDef + type ClassDef = internal.ClassDef /** Tree representing a type (paramter or member) definition in the source code */ - type TypeDef = kernel.TypeDef + type TypeDef = internal.TypeDef /** Tree representing a method definition in the source code */ - type DefDef = kernel.DefDef + type DefDef = internal.DefDef /** Tree representing a value definition in the source code This inclues `val`, `lazy val`, `var`, `object` and parameter defintions. */ - type ValDef = kernel.ValDef + type ValDef = internal.ValDef /** Tree representing an expression in the source code */ - type Term = kernel.Term + type Term = internal.Term /** Tree representing a reference to definition */ - type Ref = kernel.Ref + type Ref = internal.Ref /** Tree representing a reference to definition with a given name */ - type Ident = kernel.Ident + type Ident = internal.Ident /** Tree representing a selection of definition with a given name on a given prefix */ - type Select = kernel.Select + type Select = internal.Select /** Tree representing a literal value in the source code */ - type Literal = kernel.Literal + type Literal = internal.Literal /** Tree representing `this` in the source code */ - type This = kernel.This + type This = internal.This /** Tree representing `new` in the source code */ - type New = kernel.New + type New = internal.New /** Tree representing an argument passed with an explicit name. Such as `arg1 = x` in `foo(arg1 = x)` */ - type NamedArg = kernel.NamedArg + type NamedArg = internal.NamedArg /** Tree an application of arguments. It represents a single list of arguments, multiple argument lists will have nested `Apply`s */ - type Apply = kernel.Apply + type Apply = internal.Apply /** Tree an application of type arguments */ - type TypeApply = kernel.TypeApply + type TypeApply = internal.TypeApply /** Tree representing `super` in the source code */ - type Super = kernel.Super + type Super = internal.Super /** Tree representing a type ascription `x: T` in the source code */ - type Typed = kernel.Typed + type Typed = internal.Typed /** Tree representing an assignment `x = y` in the source code */ - type Assign = kernel.Assign + type Assign = internal.Assign /** Tree representing a block `{ ... }` in the source code */ - type Block = kernel.Block + type Block = internal.Block /** A lambda `(...) => ...` in the source code is represented as * a local method and a closure: @@ -209,186 +209,186 @@ trait Core { * } * */ - type Closure = kernel.Closure + type Closure = internal.Closure /** Tree representing an if/then/else `if (...) ... else ...` in the source code */ - type If = kernel.If + type If = internal.If /** Tree representing a pattern match `x match { ... }` in the source code */ - type Match = kernel.Match + type Match = internal.Match /** Tree representing a pattern match `delegate match { ... }` in the source code */ - type ImpliedMatch = kernel.ImpliedMatch + type ImpliedMatch = internal.ImpliedMatch /** Tree representing a try catch `try x catch { ... } finally { ... }` in the source code */ - type Try = kernel.Try + type Try = internal.Try /** Tree representing a `return` in the source code */ - type Return = kernel.Return + type Return = internal.Return /** Tree representing a variable argument list in the source code */ - type Repeated = kernel.Repeated + type Repeated = internal.Repeated /** Tree representing the scope of an inlined tree */ - type Inlined = kernel.Inlined + type Inlined = internal.Inlined /** Tree representing a selection of definition with a given name on a given prefix and number of nested scopes of inlined trees */ - type SelectOuter = kernel.SelectOuter + type SelectOuter = internal.SelectOuter /** Tree representing a while loop */ - type While = kernel.While + type While = internal.While /** Type tree representing a type written in the source */ - type TypeTree = kernel.TypeTree + type TypeTree = internal.TypeTree /** Type tree representing an inferred type */ - type Inferred = kernel.Inferred + type Inferred = internal.Inferred /** Type tree representing a reference to definition with a given name */ - type TypeIdent = kernel.TypeIdent + type TypeIdent = internal.TypeIdent /** Type tree representing a selection of definition with a given name on a given term prefix */ - type TypeSelect = kernel.TypeSelect + type TypeSelect = internal.TypeSelect /** Type tree representing a selection of definition with a given name on a given type prefix */ - type Projection = kernel.Projection + type Projection = internal.Projection /** Type tree representing a singleton type */ - type Singleton = kernel.Singleton + type Singleton = internal.Singleton /** Type tree representing a type refinement */ - type Refined = kernel.Refined + type Refined = internal.Refined /** Type tree representing a type application */ - type Applied = kernel.Applied + type Applied = internal.Applied /** Type tree representing an annotated type */ - type Annotated = kernel.Annotated + type Annotated = internal.Annotated /** Type tree representing a type match */ - type MatchTypeTree = kernel.MatchTypeTree + type MatchTypeTree = internal.MatchTypeTree /** Type tree representing a by name parameter */ - type ByName = kernel.ByName + type ByName = internal.ByName /** Type tree representing a lambda abstraction type */ - type LambdaTypeTree = kernel.LambdaTypeTree + type LambdaTypeTree = internal.LambdaTypeTree /** Type tree representing a type binding */ - type TypeBind = kernel.TypeBind + type TypeBind = internal.TypeBind /** Type tree within a block with aliases `{ type U1 = ... ; T[U1, U2] }` */ - type TypeBlock = kernel.TypeBlock + type TypeBlock = internal.TypeBlock /** Type tree representing a type bound written in the source */ - type TypeBoundsTree = kernel.TypeBoundsTree + type TypeBoundsTree = internal.TypeBoundsTree /** Type tree representing wildcard type bounds written in the source. * The wildcard type `_` (for example in in `List[_]`) will be a type tree that * represents a type but has `TypeBound`a inside. */ - type WildcardTypeTree = kernel.WildcardTypeTree + type WildcardTypeTree = internal.WildcardTypeTree /** Branch of a pattern match or catch clause */ - type CaseDef = kernel.CaseDef + type CaseDef = internal.CaseDef /** Branch of a type pattern match */ - type TypeCaseDef = kernel.TypeCaseDef + type TypeCaseDef = internal.TypeCaseDef /** Pattern tree of the pattern part of a CaseDef */ - type Pattern = kernel.Pattern + type Pattern = internal.Pattern /** Pattern representing a value. This includes `1`, ```x``` and `_` */ - type Value = kernel.Value + type Value = internal.Value /** Pattern representing a `_ @ _` binding. */ - type Bind = kernel.Bind + type Bind = internal.Bind /** Pattern representing a `Xyz(...)` unapply. */ - type Unapply = kernel.Unapply + type Unapply = internal.Unapply /** Pattern representing `X | Y | ...` alternatives. */ - type Alternatives = kernel.Alternatives + type Alternatives = internal.Alternatives /** Pattern representing a `x: Y` type test. */ - type TypeTest = kernel.TypeTest + type TypeTest = internal.TypeTest /** Pattern representing a `_` pattern */ - type WildcardPattern = kernel.WildcardPattern + type WildcardPattern = internal.WildcardPattern /** Type or bounds */ - type TypeOrBounds = kernel.TypeOrBounds + type TypeOrBounds = internal.TypeOrBounds /** NoPrefix for a type selection */ - type NoPrefix = kernel.NoPrefix + type NoPrefix = internal.NoPrefix /** Type bounds */ - type TypeBounds = kernel.TypeBounds + type TypeBounds = internal.TypeBounds /** A type */ - type Type = kernel.Type + type Type = internal.Type /** A singleton type representing a known constant value */ - type ConstantType = kernel.ConstantType + type ConstantType = internal.ConstantType /** Type of a reference to a symbol */ - type SymRef = kernel.SymRef + type SymRef = internal.SymRef /** Type of a reference to a term */ - type TermRef = kernel.TermRef + type TermRef = internal.TermRef /** Type of a reference to a type */ - type TypeRef = kernel.TypeRef + type TypeRef = internal.TypeRef /** Type of a `super` refernce */ - type SuperType = kernel.SuperType + type SuperType = internal.SuperType /** A type with a type refinement `T { type U }` */ - type Refinement = kernel.Refinement + type Refinement = internal.Refinement /** A higher kinded type applied to some types `T[U]` */ - type AppliedType = kernel.AppliedType + type AppliedType = internal.AppliedType /** A type with an anottation `T @foo` */ - type AnnotatedType = kernel.AnnotatedType + type AnnotatedType = internal.AnnotatedType /** Intersection type `T & U` */ - type AndType = kernel.AndType + type AndType = internal.AndType /** Union type `T | U` */ - type OrType = kernel.OrType + type OrType = internal.OrType /** Type match `T match { case U => ... }` */ - type MatchType = kernel.MatchType + type MatchType = internal.MatchType /** Type of a by by name parameter */ - type ByNameType = kernel.ByNameType + type ByNameType = internal.ByNameType /** Type of a parameter reference */ - type ParamRef = kernel.ParamRef + type ParamRef = internal.ParamRef /** Type of `this` */ - type ThisType = kernel.ThisType + type ThisType = internal.ThisType /** A type that is recursively defined `this` */ - type RecursiveThis = kernel.RecursiveThis + type RecursiveThis = internal.RecursiveThis /** A type that is recursively defined */ - type RecursiveType = kernel.RecursiveType + type RecursiveType = internal.RecursiveType // TODO can we add the bound back without an cake? // TODO is LambdaType really needed? ParamRefExtractor could be split into more precise extractors /** Common abstraction for lambda types (MethodType, PolyType and TypeLambda). */ - type LambdaType[ParamInfo /*<: TypeOrBounds*/] = kernel.LambdaType[ParamInfo] + type LambdaType[ParamInfo /*<: TypeOrBounds*/] = internal.LambdaType[ParamInfo] /** Type of the definition of a method taking a single list of parameters. It's return type may be a MethodType. */ - type MethodType = kernel.MethodType + type MethodType = internal.MethodType /** Type of the definition of a method taking a list of type parameters. It's return type may be a MethodType. */ - type PolyType = kernel.PolyType + type PolyType = internal.PolyType /** Type of the definition of a type lambda taking a list of type parameters. It's return type may be a TypeLambda. */ - type TypeLambda = kernel.TypeLambda + type TypeLambda = internal.TypeLambda /** Import selectors: @@ -396,77 +396,77 @@ trait Core { * * RenameSelector: `.{bar => baz}` in `import foo.{bar => baz}` * * OmitSelector: `.{bar => _}` in `import foo.{bar => _}` */ - type ImportSelector = kernel.ImportSelector - type SimpleSelector = kernel.SimpleSelector - type RenameSelector = kernel.RenameSelector - type OmitSelector = kernel.OmitSelector + type ImportSelector = internal.ImportSelector + type SimpleSelector = internal.SimpleSelector + type RenameSelector = internal.RenameSelector + type OmitSelector = internal.OmitSelector /** Untyped identifier */ - type Id = kernel.Id + type Id = internal.Id /** JVM signature of a method */ - type Signature = kernel.Signature + type Signature = internal.Signature /** Position in a source file */ - type Position = kernel.Position + type Position = internal.Position /** Scala source file */ - type SourceFile = kernel.SourceFile + type SourceFile = internal.SourceFile /** Comment */ - type Comment = kernel.Comment + type Comment = internal.Comment /** Constant value represented as the constant itself */ - type Constant = kernel.Constant + type Constant = internal.Constant /** Symbol of a definition. * Then can be compared with == to know if the definition is the same. */ - type Symbol = kernel.Symbol + type Symbol = internal.Symbol /** Symbol of a package definition */ - type PackageDefSymbol = kernel.PackageDefSymbol + type PackageDefSymbol = internal.PackageDefSymbol /** Symbol representing a type definition. */ - type TypeSymbol = kernel.TypeSymbol + type TypeSymbol = internal.TypeSymbol /** Symbol of a class definition. This includes anonymous class definitions and the class of a module object. */ - type ClassDefSymbol = kernel.ClassDefSymbol + type ClassDefSymbol = internal.ClassDefSymbol /** Symbol of a type (parameter or member) definition. */ - type TypeDefSymbol = kernel.TypeDefSymbol + type TypeDefSymbol = internal.TypeDefSymbol /** Symbol representing a type bind definition. */ - type TypeBindSymbol = kernel.TypeBindSymbol + type TypeBindSymbol = internal.TypeBindSymbol /** Symbol representing a term definition. */ - type TermSymbol = kernel.TermSymbol + type TermSymbol = internal.TermSymbol /** Symbol representing a method definition. */ - type DefDefSymbol = kernel.DefDefSymbol + type DefDefSymbol = internal.DefDefSymbol /** Symbol representing a value definition. This includes `val`, `lazy val`, `var`, `object` and parameter definitions. */ - type ValDefSymbol = kernel.ValDefSymbol + type ValDefSymbol = internal.ValDefSymbol /** Symbol representing a bind definition. */ - type BindSymbol = kernel.BindSymbol + type BindSymbol = internal.BindSymbol /** No symbol available. */ - type NoSymbol = kernel.NoSymbol + type NoSymbol = internal.NoSymbol /** FlagSet of a Symbol */ - type Flags = kernel.Flags + type Flags = internal.Flags - type ImplicitSearchResult = kernel.ImplicitSearchResult + type ImplicitSearchResult = internal.ImplicitSearchResult - type ImplicitSearchSuccess = kernel.ImplicitSearchSuccess + type ImplicitSearchSuccess = internal.ImplicitSearchSuccess - type ImplicitSearchFailure = kernel.ImplicitSearchFailure + type ImplicitSearchFailure = internal.ImplicitSearchFailure - type DivergingImplicit = kernel.DivergingImplicit + type DivergingImplicit = internal.DivergingImplicit - type NoMatchingImplicits = kernel.NoMatchingImplicits + type NoMatchingImplicits = internal.NoMatchingImplicits - type AmbiguousImplicits = kernel.AmbiguousImplicits + type AmbiguousImplicits = internal.AmbiguousImplicits } diff --git a/library/src/scala/tasty/reflect/FlagsOps.scala b/library/src/scala/tasty/reflect/FlagsOps.scala index c0c97fe688d0..36432de4e241 100644 --- a/library/src/scala/tasty/reflect/FlagsOps.scala +++ b/library/src/scala/tasty/reflect/FlagsOps.scala @@ -5,122 +5,122 @@ trait FlagsOps extends Core { implicit class FlagsAPI(self: Flags) { /** Is the given flag set a subset of this flag sets */ - def is(that: Flags): Boolean = kernel.Flags_is(self)(that) + def is(that: Flags): Boolean = internal.Flags_is(self)(that) /** Union of the two flag sets */ - def |(that: Flags): Flags = kernel.Flags_or(self)(that) + def |(that: Flags): Flags = internal.Flags_or(self)(that) /** Intersection of the two flag sets */ - def &(that: Flags): Flags = kernel.Flags_and(self)(that) + def &(that: Flags): Flags = internal.Flags_and(self)(that) } object Flags { /** The empty set of flags */ - def EmptyFlags = kernel.Flags_EmptyFlags + def EmptyFlags = internal.Flags_EmptyFlags /** Is this symbol `private` */ - def Private: Flags = kernel.Flags_Private + def Private: Flags = internal.Flags_Private /** Is this symbol `protected` */ - def Protected: Flags = kernel.Flags_Protected + def Protected: Flags = internal.Flags_Protected /** Is this symbol `abstract` */ - def Abstract: Flags = kernel.Flags_Abstract + def Abstract: Flags = internal.Flags_Abstract /** Is this symbol `final` */ - def Final: Flags = kernel.Flags_Final + def Final: Flags = internal.Flags_Final /** Is this symbol `sealed` */ - def Sealed: Flags = kernel.Flags_Sealed + def Sealed: Flags = internal.Flags_Sealed /** Is this symbol `case` */ - def Case: Flags = kernel.Flags_Case + def Case: Flags = internal.Flags_Case /** Is this symbol `implicit` */ - def Implicit: Flags = kernel.Flags_Implicit + def Implicit: Flags = internal.Flags_Implicit /** Is this symbol an inferable ("given") parameter */ - def Given: Flags = kernel.Flags_Given + def Given: Flags = internal.Flags_Given /** Is this symbol `erased` */ - def Erased: Flags = kernel.Flags_Erased + def Erased: Flags = internal.Flags_Erased /** Is this symbol `lazy` */ - def Lazy: Flags = kernel.Flags_Lazy + def Lazy: Flags = internal.Flags_Lazy /** Is this symbol `override` */ - def Override: Flags = kernel.Flags_Override + def Override: Flags = internal.Flags_Override /** Is this symbol `inline` */ - def Inline: Flags = kernel.Flags_Inline + def Inline: Flags = internal.Flags_Inline /** Is this symbol markes as a macro. An inline method containing toplevel splices */ - def Macro: Flags = kernel.Flags_Macro + def Macro: Flags = internal.Flags_Macro /** Is this symbol marked as static. Mapped to static Java member */ - def Static: Flags = kernel.Flags_Static + def Static: Flags = internal.Flags_Static /** Is this symbol defined in a Java class */ - def JavaDefined: Flags = kernel.Flags_JavaDefined + def JavaDefined: Flags = internal.Flags_JavaDefined /** Is this symbol an object or its class (used for a ValDef or a ClassDef extends Modifier respectively) */ - def Object: Flags = kernel.Flags_Object + def Object: Flags = internal.Flags_Object /** Is this symbol a trait */ - def Trait: Flags = kernel.Flags_Trait + def Trait: Flags = internal.Flags_Trait /** Is this symbol local? Used in conjunction with private/private[Type] to mean private[this] extends Modifier proctected[this] */ - def Local: Flags = kernel.Flags_Local + def Local: Flags = internal.Flags_Local /** Was this symbol generated by Scala compiler */ - def Synthetic: Flags = kernel.Flags_Synthetic + def Synthetic: Flags = internal.Flags_Synthetic /** Is this symbol to be tagged Java Synthetic */ - def Artifact: Flags = kernel.Flags_Artifact + def Artifact: Flags = internal.Flags_Artifact /** Is this symbol a `var` (when used on a ValDef) */ - def Mutable: Flags = kernel.Flags_Mutable + def Mutable: Flags = internal.Flags_Mutable /** Is this symbol a getter or a setter */ - def FieldAccessor: Flags = kernel.Flags_FieldAccessor + def FieldAccessor: Flags = internal.Flags_FieldAccessor /** Is this symbol a getter for case class parameter */ - def CaseAcessor: Flags = kernel.Flags_CaseAcessor + def CaseAcessor: Flags = internal.Flags_CaseAcessor /** Is this symbol a type parameter marked as covariant `+` */ - def Covariant: Flags = kernel.Flags_Covariant + def Covariant: Flags = internal.Flags_Covariant /** Is this symbol a type parameter marked as contravariant `-` */ - def Contravariant: Flags = kernel.Flags_Contravariant + def Contravariant: Flags = internal.Flags_Contravariant /** Was this symbol imported from Scala2.x */ - def Scala2X: Flags = kernel.Flags_Scala2X + def Scala2X: Flags = internal.Flags_Scala2X /** Is this symbol a method with default parameters */ - def DefaultParameterized: Flags = kernel.Flags_DefaultParameterized + def DefaultParameterized: Flags = internal.Flags_DefaultParameterized /** Is this symbol member that is assumed to be stable and realizable */ - def StableRealizable: Flags = kernel.Flags_StableRealizable + def StableRealizable: Flags = internal.Flags_StableRealizable /** Is this symbol a parameter */ - def Param: Flags = kernel.Flags_Param + def Param: Flags = internal.Flags_Param /** Is this symbol a parameter accessor */ - def ParamAccessor: Flags = kernel.Flags_ParamAccessor + def ParamAccessor: Flags = internal.Flags_ParamAccessor /** Is this symbol an enum */ - def Enum: Flags = kernel.Flags_Enum + def Enum: Flags = internal.Flags_Enum /** Is this symbol a module class */ - def ModuleClass: Flags = kernel.Flags_ModuleClass + def ModuleClass: Flags = internal.Flags_ModuleClass /** Is this symbol labeled private[this] */ - def PrivateLocal: Flags = kernel.Flags_PrivateLocal + def PrivateLocal: Flags = internal.Flags_PrivateLocal /** Is this symbol a package */ - def Package: Flags = kernel.Flags_Package + def Package: Flags = internal.Flags_Package } } diff --git a/library/src/scala/tasty/reflect/IdOps.scala b/library/src/scala/tasty/reflect/IdOps.scala index 8bd1ebc00a00..c445504ea659 100644 --- a/library/src/scala/tasty/reflect/IdOps.scala +++ b/library/src/scala/tasty/reflect/IdOps.scala @@ -6,10 +6,10 @@ trait IdOps extends Core { implicit class IdAPI(id: Id) { /** Position in the source code */ - def pos given (ctx: Context): Position = kernel.Id_pos(id) + def pos given (ctx: Context): Position = internal.Id_pos(id) /** Name of the identifier */ - def name given (ctx: Context): String = kernel.Id_name(id) + def name given (ctx: Context): String = internal.Id_name(id) } diff --git a/library/src/scala/tasty/reflect/ImplicitsOps.scala b/library/src/scala/tasty/reflect/ImplicitsOps.scala index 99958a142d75..d547b85c0baa 100644 --- a/library/src/scala/tasty/reflect/ImplicitsOps.scala +++ b/library/src/scala/tasty/reflect/ImplicitsOps.scala @@ -3,39 +3,39 @@ package scala.tasty.reflect trait ImplicitsOps extends Core { def searchImplicit(tpe: Type) given (ctx: Context): ImplicitSearchResult = - kernel.searchImplicit(tpe) + internal.searchImplicit(tpe) object IsImplicitSearchSuccess { def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchSuccess] = - kernel.matchImplicitSearchSuccess(isr) + internal.matchImplicitSearchSuccess(isr) } implicit class IsImplicitSearchSuccessAPI(self: ImplicitSearchSuccess) { - def tree given (ctx: Context): Term = kernel.ImplicitSearchSuccess_tree(self) + def tree given (ctx: Context): Term = internal.ImplicitSearchSuccess_tree(self) } object IsImplicitSearchFailure { def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchFailure] = - kernel.matchImplicitSearchFailure(isr) + internal.matchImplicitSearchFailure(isr) } implicit class ImplicitSearchFailureAPI(self: ImplicitSearchFailure) { - def explanation given (ctx: Context): String = kernel.ImplicitSearchFailure_explanation(self) + def explanation given (ctx: Context): String = internal.ImplicitSearchFailure_explanation(self) } object IsDivergingImplicit { def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[DivergingImplicit] = - kernel.matchDivergingImplicit(isr) + internal.matchDivergingImplicit(isr) } object IsNoMatchingImplicits { def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[NoMatchingImplicits] = - kernel.matchNoMatchingImplicits(isr) + internal.matchNoMatchingImplicits(isr) } object IsAmbiguousImplicits { def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[AmbiguousImplicits] = - kernel.matchAmbiguousImplicits(isr) + internal.matchAmbiguousImplicits(isr) } } diff --git a/library/src/scala/tasty/reflect/ImportSelectorOps.scala b/library/src/scala/tasty/reflect/ImportSelectorOps.scala index 5dc99bd7c0c0..f29b9fae7ceb 100644 --- a/library/src/scala/tasty/reflect/ImportSelectorOps.scala +++ b/library/src/scala/tasty/reflect/ImportSelectorOps.scala @@ -5,35 +5,35 @@ trait ImportSelectorOps extends Core { implicit class SimpleSelectorAPI(self: SimpleSelector) { def selection given (ctx: Context): Id = - kernel.SimpleSelector_selection(self) + internal.SimpleSelector_selection(self) } object SimpleSelector { def unapply(importSelector: ImportSelector) given (ctx: Context): Option[Id] = - kernel.matchSimpleSelector(importSelector).map(_.selection) + internal.matchSimpleSelector(importSelector).map(_.selection) } implicit class RenameSelectorAPI(self: RenameSelector) { def from given (ctx: Context): Id = - kernel.RenameSelector_from(self) + internal.RenameSelector_from(self) def to given (ctx: Context): Id = - kernel.RenameSelector_to(self) + internal.RenameSelector_to(self) } object RenameSelector { def unapply(importSelector: ImportSelector) given (ctx: Context): Option[(Id, Id)] = - kernel.matchRenameSelector(importSelector).map(x => (x.from, x.to)) + internal.matchRenameSelector(importSelector).map(x => (x.from, x.to)) } implicit class OmitSelectorAPI(self: OmitSelector) { def omitted given (ctx: Context): Id = - kernel.SimpleSelector_omited(self) + internal.SimpleSelector_omited(self) } object OmitSelector { def unapply(importSelector: ImportSelector) given (ctx: Context): Option[Id] = - kernel.matchOmitSelector(importSelector).map(_.omitted) + internal.matchOmitSelector(importSelector).map(_.omitted) } } diff --git a/library/src/scala/tasty/reflect/Kernel.scala b/library/src/scala/tasty/reflect/Internal.scala similarity index 99% rename from library/src/scala/tasty/reflect/Kernel.scala rename to library/src/scala/tasty/reflect/Internal.scala index 37b0b6c43d0b..2120c25923a1 100644 --- a/library/src/scala/tasty/reflect/Kernel.scala +++ b/library/src/scala/tasty/reflect/Internal.scala @@ -119,7 +119,7 @@ import scala.quoted.QuoteContext * * ``` */ -trait Kernel { +trait CompilerInterface { /** Context of the macro expansion */ def rootContext: Context diff --git a/library/src/scala/tasty/reflect/PatternOps.scala b/library/src/scala/tasty/reflect/PatternOps.scala index 6207fe514a8d..f934f6da70d3 100644 --- a/library/src/scala/tasty/reflect/PatternOps.scala +++ b/library/src/scala/tasty/reflect/PatternOps.scala @@ -4,117 +4,117 @@ package reflect trait PatternOps extends Core { implicit class ValueAPI(value: Value) { - def value given (ctx: Context): Term = kernel.Pattern_Value_value(value) + def value given (ctx: Context): Term = internal.Pattern_Value_value(value) } implicit class BindAPI(bind: Bind) { - def name given (ctx: Context): String = kernel.Pattern_Bind_name(bind) - def pattern given (ctx: Context): Pattern = kernel.Pattern_Bind_pattern(bind) + def name given (ctx: Context): String = internal.Pattern_Bind_name(bind) + def pattern given (ctx: Context): Pattern = internal.Pattern_Bind_pattern(bind) } implicit class UnapplyAPI(unapply: Unapply) { - def fun given (ctx: Context): Term = kernel.Pattern_Unapply_fun(unapply) - def implicits given (ctx: Context): List[Term] = kernel.Pattern_Unapply_implicits(unapply) - def patterns given (ctx: Context): List[Pattern] = kernel.Pattern_Unapply_patterns(unapply) + def fun given (ctx: Context): Term = internal.Pattern_Unapply_fun(unapply) + def implicits given (ctx: Context): List[Term] = internal.Pattern_Unapply_implicits(unapply) + def patterns given (ctx: Context): List[Pattern] = internal.Pattern_Unapply_patterns(unapply) } implicit class AlternativesAPI(alternatives: Alternatives) { - def patterns given (ctx: Context): List[Pattern] = kernel.Pattern_Alternatives_patterns(alternatives) + def patterns given (ctx: Context): List[Pattern] = internal.Pattern_Alternatives_patterns(alternatives) } implicit class TypeTestAPI(typeTest: TypeTest) { - def tpt given (ctx: Context): TypeTree = kernel.Pattern_TypeTest_tpt(typeTest) + def tpt given (ctx: Context): TypeTree = internal.Pattern_TypeTest_tpt(typeTest) } implicit class PatternAPI(self: Pattern) { /** Position in the source code */ - def pos given (ctx: Context): Position = kernel.Pattern_pos(self) + def pos given (ctx: Context): Position = internal.Pattern_pos(self) - def tpe given (ctx: Context): Type = kernel.Pattern_tpe(self) + def tpe given (ctx: Context): Type = internal.Pattern_tpe(self) - def symbol given (ctx: Context): Symbol = kernel.Pattern_symbol(self) + def symbol given (ctx: Context): Symbol = internal.Pattern_symbol(self) } object Pattern { object IsValue { def unapply(pattern: Pattern) given (ctx: Context): Option[Value] = - kernel.matchPattern_Value(pattern) + internal.matchPattern_Value(pattern) } object Value { def apply(tpt: Term) given (ctx: Context): Value = - kernel.Pattern_Value_module_apply(tpt) + internal.Pattern_Value_module_apply(tpt) def copy(original: Value)(tpt: Term) given (ctx: Context): Value = - kernel.Pattern_Value_module_copy(original)(tpt) + internal.Pattern_Value_module_copy(original)(tpt) def unapply(pattern: Pattern) given (ctx: Context): Option[Term] = - kernel.matchPattern_Value(pattern).map(_.value) + internal.matchPattern_Value(pattern).map(_.value) } object IsBind { def unapply(pattern: Pattern) given (ctx: Context): Option[Bind] = - kernel.matchPattern_Bind(pattern) + internal.matchPattern_Bind(pattern) } object Bind { // TODO def apply(name: String, pattern: Pattern) given (ctx: Context): Bind def copy(original: Bind)(name: String, pattern: Pattern) given (ctx: Context): Bind = - kernel.Pattern_Bind_module_copy(original)(name, pattern) + internal.Pattern_Bind_module_copy(original)(name, pattern) def unapply(pattern: Pattern) given (ctx: Context): Option[(String, Pattern)] = - kernel.matchPattern_Bind(pattern).map(x => (x.name, x.pattern)) + internal.matchPattern_Bind(pattern).map(x => (x.name, x.pattern)) } object IsUnapply { def unapply(pattern: Pattern) given (ctx: Context): Option[Unapply] = - kernel.matchPattern_Unapply(pattern) + internal.matchPattern_Unapply(pattern) } object Unapply { // TODO def apply(fun: Term, implicits: List[Term], patterns: List[Pattern]) given (ctx: Context): Unapply def copy(original: Unapply)(fun: Term, implicits: List[Term], patterns: List[Pattern]) given (ctx: Context): Unapply = - kernel.Pattern_Unapply_module_copy(original)(fun, implicits, patterns) + internal.Pattern_Unapply_module_copy(original)(fun, implicits, patterns) def unapply(pattern: Pattern) given (ctx: Context): Option[(Term, List[Term], List[Pattern])] = - kernel.matchPattern_Unapply(pattern).map(x => (x.fun, x.implicits, x.patterns)) + internal.matchPattern_Unapply(pattern).map(x => (x.fun, x.implicits, x.patterns)) } object IsAlternatives { def unapply(pattern: Pattern) given (ctx: Context): Option[Alternatives] = - kernel.matchPattern_Alternatives(pattern) + internal.matchPattern_Alternatives(pattern) } object Alternatives { def apply(patterns: List[Pattern]) given (ctx: Context): Alternatives = - kernel.Pattern_Alternatives_module_apply(patterns) + internal.Pattern_Alternatives_module_apply(patterns) def copy(original: Alternatives)(patterns: List[Pattern]) given (ctx: Context): Alternatives = - kernel.Pattern_Alternatives_module_copy(original)(patterns) + internal.Pattern_Alternatives_module_copy(original)(patterns) def unapply(pattern: Pattern) given (ctx: Context): Option[List[Pattern]] = - kernel.matchPattern_Alternatives(pattern).map(_.patterns) + internal.matchPattern_Alternatives(pattern).map(_.patterns) } object IsTypeTest { def unapply(pattern: Pattern) given (ctx: Context): Option[TypeTest] = - kernel.matchPattern_TypeTest(pattern) + internal.matchPattern_TypeTest(pattern) } object TypeTest { def apply(tpt: TypeTree) given (ctx: Context): TypeTest = - kernel.Pattern_TypeTest_module_apply(tpt) + internal.Pattern_TypeTest_module_apply(tpt) def copy(original: TypeTest)(tpt: TypeTree) given (ctx: Context): TypeTest = - kernel.Pattern_TypeTest_module_copy(original)(tpt) + internal.Pattern_TypeTest_module_copy(original)(tpt) def unapply(pattern: Pattern) given (ctx: Context): Option[TypeTree] = - kernel.matchPattern_TypeTest(pattern).map(_.tpt) + internal.matchPattern_TypeTest(pattern).map(_.tpt) } object IsWildcardPattern { def unapply(pattern: Pattern) given (ctx: Context): Option[WildcardPattern] = - kernel.matchPattern_WildcardPattern(pattern) + internal.matchPattern_WildcardPattern(pattern) } object WildcardPattern { def apply(tpe: TypeOrBounds) given (ctx: Context): WildcardPattern = - kernel.Pattern_WildcardPattern_module_apply(tpe) + internal.Pattern_WildcardPattern_module_apply(tpe) def unapply(pattern: Pattern) given (ctx: Context): Boolean = - kernel.matchPattern_WildcardPattern(pattern).isDefined + internal.matchPattern_WildcardPattern(pattern).isDefined } } diff --git a/library/src/scala/tasty/reflect/PositionOps.scala b/library/src/scala/tasty/reflect/PositionOps.scala index 5e714b3bc9b4..e54f5da5a4a5 100644 --- a/library/src/scala/tasty/reflect/PositionOps.scala +++ b/library/src/scala/tasty/reflect/PositionOps.scala @@ -5,41 +5,41 @@ trait PositionOps extends Core { implicit class PositionAPI(pos: Position) { /** The start offset in the source file */ - def start: Int = kernel.Position_start(pos) + def start: Int = internal.Position_start(pos) /** The end offset in the source file */ - def end: Int = kernel.Position_end(pos) + def end: Int = internal.Position_end(pos) /** Does this position exist */ - def exists: Boolean = kernel.Position_exists(pos) + def exists: Boolean = internal.Position_exists(pos) /** Source file in which this position is located */ - def sourceFile: SourceFile = kernel.Position_sourceFile(pos) + def sourceFile: SourceFile = internal.Position_sourceFile(pos) /** The start line in the source file */ - def startLine: Int = kernel.Position_startLine(pos) + def startLine: Int = internal.Position_startLine(pos) /** The end line in the source file */ - def endLine: Int = kernel.Position_endLine(pos) + def endLine: Int = internal.Position_endLine(pos) /** The start column in the source file */ - def startColumn: Int = kernel.Position_startColumn(pos) + def startColumn: Int = internal.Position_startColumn(pos) /** The end column in the source file */ - def endColumn: Int = kernel.Position_endColumn(pos) + def endColumn: Int = internal.Position_endColumn(pos) /** Source code within the position */ - def sourceCode: String = kernel.Position_sourceCode(pos) + def sourceCode: String = internal.Position_sourceCode(pos) } implicit class SourceFileAPI(sourceFile: SourceFile) { /** Path to this source file */ - def jpath: java.nio.file.Path = kernel.SourceFile_jpath(sourceFile) + def jpath: java.nio.file.Path = internal.SourceFile_jpath(sourceFile) /** Content of this source file */ - def content: String = kernel.SourceFile_content(sourceFile) + def content: String = internal.SourceFile_content(sourceFile) } diff --git a/library/src/scala/tasty/reflect/QuotedOps.scala b/library/src/scala/tasty/reflect/QuotedOps.scala index 72b372a5043e..ef0b40c2dfde 100644 --- a/library/src/scala/tasty/reflect/QuotedOps.scala +++ b/library/src/scala/tasty/reflect/QuotedOps.scala @@ -6,28 +6,28 @@ trait QuotedOps extends Core { self: Printers => implicit class QuotedExprAPI[T](expr: scala.quoted.Expr[T]) { /** View this expression `quoted.Expr[T]` as a `Term` */ def unseal given (ctx: Context): Term = - kernel.QuotedExpr_unseal(expr) + internal.QuotedExpr_unseal(expr) /** Checked cast to a `quoted.Expr[U]` */ def cast[U: scala.quoted.Type] given (ctx: Context): scala.quoted.Expr[U] = - kernel.QuotedExpr_cast[U](expr) + internal.QuotedExpr_cast[U](expr) } implicit class QuotedTypeAPI[T <: AnyKind](tpe: scala.quoted.Type[T]) { /** View this expression `quoted.Type[T]` as a `TypeTree` */ def unseal given (ctx: Context): TypeTree = - kernel.QuotedType_unseal(tpe) + internal.QuotedType_unseal(tpe) } implicit class TermToQuotedAPI(term: Term) { /** Convert `Term` to an `quoted.Expr[Any]` */ def seal given (ctx: Context): scala.quoted.Expr[Any] = - kernel.QuotedExpr_seal(term) + internal.QuotedExpr_seal(term) } implicit class TypeToQuotedAPI(tpe: Type) { /** Convert `Type` to an `quoted.Type[_]` */ def seal given (ctx: Context): scala.quoted.Type[_] = - kernel.QuotedType_seal(tpe) + internal.QuotedType_seal(tpe) } } diff --git a/library/src/scala/tasty/reflect/ReportingOps.scala b/library/src/scala/tasty/reflect/ReportingOps.scala index 780c135f8aba..11186dc2c3b0 100644 --- a/library/src/scala/tasty/reflect/ReportingOps.scala +++ b/library/src/scala/tasty/reflect/ReportingOps.scala @@ -3,14 +3,14 @@ package scala.tasty.reflect trait ReportingOps extends Core { def error(msg: => String, pos: Position) given (ctx: Context): Unit = - kernel.error(msg, pos) + internal.error(msg, pos) def error(msg: => String, source: SourceFile, start: Int, end: Int) given (ctx: Context): Unit = - kernel.error(msg, source, start, end) + internal.error(msg, source, start, end) def warning(msg: => String, pos: Position) given (ctx: Context): Unit = - kernel.warning(msg, pos) + internal.warning(msg, pos) def warning(msg: => String, source: SourceFile, start: Int, end: Int) given (ctx: Context): Unit = - kernel.warning(msg, source, start, end) + internal.warning(msg, source, start, end) } diff --git a/library/src/scala/tasty/reflect/RootPosition.scala b/library/src/scala/tasty/reflect/RootPosition.scala index 8b8983cb90e0..7330a4137127 100644 --- a/library/src/scala/tasty/reflect/RootPosition.scala +++ b/library/src/scala/tasty/reflect/RootPosition.scala @@ -3,6 +3,6 @@ package scala.tasty.reflect trait RootPosition extends Core { /** Root position of this tasty context. For macros it corresponds to the expansion site. */ - def rootPosition: Position = kernel.rootPosition + def rootPosition: Position = internal.rootPosition } diff --git a/library/src/scala/tasty/reflect/SignatureOps.scala b/library/src/scala/tasty/reflect/SignatureOps.scala index d0e68ad1059f..539a3752c652 100644 --- a/library/src/scala/tasty/reflect/SignatureOps.scala +++ b/library/src/scala/tasty/reflect/SignatureOps.scala @@ -12,10 +12,10 @@ trait SignatureOps extends Core { implicit class SignatureAPI(sig: Signature) { /** The (JVM) erased signatures of the parameters */ - def paramSigs: List[String]= kernel.Signature_paramSigs(sig) + def paramSigs: List[String]= internal.Signature_paramSigs(sig) /** The (JVM) erased result type */ - def resultSig: String = kernel.Signature_resultSig(sig) + def resultSig: String = internal.Signature_resultSig(sig) } diff --git a/library/src/scala/tasty/reflect/StandardDefinitions.scala b/library/src/scala/tasty/reflect/StandardDefinitions.scala index 05b199081381..e31cead95b29 100644 --- a/library/src/scala/tasty/reflect/StandardDefinitions.scala +++ b/library/src/scala/tasty/reflect/StandardDefinitions.scala @@ -14,114 +14,114 @@ trait StandardDefinitions extends Core { trait StandardSymbols { /** The module symbol of root package `_root_`. */ - def RootPackage: Symbol = kernel.Definitions_RootPackage + def RootPackage: Symbol = internal.Definitions_RootPackage /** The class symbol of root package `_root_`. */ - def RootClass: Symbol = kernel.Definitions_RootClass + def RootClass: Symbol = internal.Definitions_RootClass /** The class symbol of empty package `_root_._empty_`. */ - def EmptyPackageClass: Symbol = kernel.Definitions_EmptyPackageClass + def EmptyPackageClass: Symbol = internal.Definitions_EmptyPackageClass /** The module symbol of package `scala`. */ - def ScalaPackage: Symbol = kernel.Definitions_ScalaPackage + def ScalaPackage: Symbol = internal.Definitions_ScalaPackage /** The class symbol of package `scala`. */ - def ScalaPackageClass: Symbol = kernel.Definitions_ScalaPackageClass + def ScalaPackageClass: Symbol = internal.Definitions_ScalaPackageClass /** The class symbol of core class `scala.Any`. */ - def AnyClass: Symbol = kernel.Definitions_AnyClass + def AnyClass: Symbol = internal.Definitions_AnyClass /** The class symbol of core class `scala.AnyVal`. */ - def AnyValClass: Symbol = kernel.Definitions_AnyValClass + def AnyValClass: Symbol = internal.Definitions_AnyValClass /** The class symbol of core class `java.lang.Object`. */ - def ObjectClass: Symbol = kernel.Definitions_ObjectClass + def ObjectClass: Symbol = internal.Definitions_ObjectClass /** The type symbol of core class `scala.AnyRef`. */ - def AnyRefClass: Symbol = kernel.Definitions_AnyRefClass + def AnyRefClass: Symbol = internal.Definitions_AnyRefClass /** The class symbol of core class `scala.Null`. */ - def NullClass: Symbol = kernel.Definitions_NullClass + def NullClass: Symbol = internal.Definitions_NullClass /** The class symbol of core class `scala.Nothing`. */ - def NothingClass: Symbol = kernel.Definitions_NothingClass + def NothingClass: Symbol = internal.Definitions_NothingClass /** The class symbol of primitive class `scala.Unit`. */ - def UnitClass: Symbol = kernel.Definitions_UnitClass + def UnitClass: Symbol = internal.Definitions_UnitClass /** The class symbol of primitive class `scala.Byte`. */ - def ByteClass: Symbol = kernel.Definitions_ByteClass + def ByteClass: Symbol = internal.Definitions_ByteClass /** The class symbol of primitive class `scala.Short`. */ - def ShortClass: Symbol = kernel.Definitions_ShortClass + def ShortClass: Symbol = internal.Definitions_ShortClass /** The class symbol of primitive class `scala.Char`. */ - def CharClass: Symbol = kernel.Definitions_CharClass + def CharClass: Symbol = internal.Definitions_CharClass /** The class symbol of primitive class `scala.Int`. */ - def IntClass: Symbol = kernel.Definitions_IntClass + def IntClass: Symbol = internal.Definitions_IntClass /** The class symbol of primitive class `scala.Long`. */ - def LongClass: Symbol = kernel.Definitions_LongClass + def LongClass: Symbol = internal.Definitions_LongClass /** The class symbol of primitive class `scala.Float`. */ - def FloatClass: Symbol = kernel.Definitions_FloatClass + def FloatClass: Symbol = internal.Definitions_FloatClass /** The class symbol of primitive class `scala.Double`. */ - def DoubleClass: Symbol = kernel.Definitions_DoubleClass + def DoubleClass: Symbol = internal.Definitions_DoubleClass /** The class symbol of primitive class `scala.Boolean`. */ - def BooleanClass: Symbol = kernel.Definitions_BooleanClass + def BooleanClass: Symbol = internal.Definitions_BooleanClass /** The class symbol of class `scala.String`. */ - def StringClass: Symbol = kernel.Definitions_StringClass + def StringClass: Symbol = internal.Definitions_StringClass /** The class symbol of class `java.lang.Class`. */ - def ClassClass: Symbol = kernel.Definitions_ClassClass + def ClassClass: Symbol = internal.Definitions_ClassClass /** The class symbol of class `scala.Array`. */ - def ArrayClass: Symbol = kernel.Definitions_ArrayClass + def ArrayClass: Symbol = internal.Definitions_ArrayClass /** The module symbol of module `scala.Predef`. */ - def PredefModule: Symbol = kernel.Definitions_PredefModule + def PredefModule: Symbol = internal.Definitions_PredefModule /** The method symbol of method `scala.Predef.classOf`. */ - def Predef_classOf: Symbol = kernel.Definitions_Predef_classOf + def Predef_classOf: Symbol = internal.Definitions_Predef_classOf /** The module symbol of package `java.lang`. */ - def JavaLangPackage: Symbol = kernel.Definitions_JavaLangPackage + def JavaLangPackage: Symbol = internal.Definitions_JavaLangPackage /** The module symbol of module `scala.Array`. */ - def ArrayModule: Symbol = kernel.Definitions_ArrayModule + def ArrayModule: Symbol = internal.Definitions_ArrayModule /** The method symbol of method `apply` in class `scala.Array`. */ - def Array_apply: Symbol = kernel.Definitions_Array_apply + def Array_apply: Symbol = internal.Definitions_Array_apply /** The method symbol of method `clone` in class `scala.Array`. */ - def Array_clone: Symbol = kernel.Definitions_Array_clone + def Array_clone: Symbol = internal.Definitions_Array_clone /** The method symbol of method `length` in class `scala.Array`. */ - def Array_length: Symbol = kernel.Definitions_Array_length + def Array_length: Symbol = internal.Definitions_Array_length /** The method symbol of method `update` in class `scala.Array`. */ - def Array_update: Symbol = kernel.Definitions_Array_update + def Array_update: Symbol = internal.Definitions_Array_update /** A dummy class symbol that is used to indicate repeated parameters * compiled by the Scala compiler. */ - def RepeatedParamClass: ClassDefSymbol = kernel.Definitions_RepeatedParamClass + def RepeatedParamClass: ClassDefSymbol = internal.Definitions_RepeatedParamClass /** The class symbol of class `scala.Option`. */ - def OptionClass: Symbol = kernel.Definitions_OptionClass + def OptionClass: Symbol = internal.Definitions_OptionClass /** The module symbol of module `scala.None`. */ - def NoneModule: Symbol = kernel.Definitions_NoneModule + def NoneModule: Symbol = internal.Definitions_NoneModule /** The module symbol of module `scala.Some`. */ - def SomeModule: Symbol = kernel.Definitions_SomeModule + def SomeModule: Symbol = internal.Definitions_SomeModule /** Function-like object that maps arity to symbols for classes `scala.Product` */ - def ProductClass: Symbol = kernel.Definitions_ProductClass + def ProductClass: Symbol = internal.Definitions_ProductClass /** Function-like object that maps arity to symbols for classes `scala.FunctionX`. * - 0th element is `Function0` @@ -130,7 +130,7 @@ trait StandardDefinitions extends Core { * - Nth element is `FunctionN` */ def FunctionClass(arity: Int, isImplicit: Boolean = false, isErased: Boolean = false): Symbol = - kernel.Definitions_FunctionClass(arity, isImplicit, isErased) + internal.Definitions_FunctionClass(arity, isImplicit, isErased) /** Function-like object that maps arity to symbols for classes `scala.TupleX`. * - 0th element is `NoSymbol` @@ -142,7 +142,7 @@ trait StandardDefinitions extends Core { * - ... */ def TupleClass(arity: Int): Symbol = - kernel.Definitions_TupleClass(arity) + internal.Definitions_TupleClass(arity) /** Contains Scala primitive value classes: * - Byte @@ -177,51 +177,51 @@ trait StandardDefinitions extends Core { */ trait StandardTypes { /** The type of primitive type `Unit`. */ - def UnitType: Type = kernel.Definitions_UnitType + def UnitType: Type = internal.Definitions_UnitType /** The type of primitive type `Byte`. */ - def ByteType: Type = kernel.Definitions_ByteType + def ByteType: Type = internal.Definitions_ByteType /** The type of primitive type `Short`. */ - def ShortType: Type = kernel.Definitions_ShortType + def ShortType: Type = internal.Definitions_ShortType /** The type of primitive type `Char`. */ - def CharType: Type = kernel.Definitions_CharType + def CharType: Type = internal.Definitions_CharType /** The type of primitive type `Int`. */ - def IntType: Type = kernel.Definitions_IntType + def IntType: Type = internal.Definitions_IntType /** The type of primitive type `Long`. */ - def LongType: Type = kernel.Definitions_LongType + def LongType: Type = internal.Definitions_LongType /** The type of primitive type `Float`. */ - def FloatType: Type = kernel.Definitions_FloatType + def FloatType: Type = internal.Definitions_FloatType /** The type of primitive type `Double`. */ - def DoubleType: Type = kernel.Definitions_DoubleType + def DoubleType: Type = internal.Definitions_DoubleType /** The type of primitive type `Boolean`. */ - def BooleanType: Type = kernel.Definitions_BooleanType + def BooleanType: Type = internal.Definitions_BooleanType /** The type of core type `Any`. */ - def AnyType: Type = kernel.Definitions_AnyType + def AnyType: Type = internal.Definitions_AnyType /** The type of core type `AnyVal`. */ - def AnyValType: Type = kernel.Definitions_AnyValType + def AnyValType: Type = internal.Definitions_AnyValType /** The type of core type `AnyRef`. */ - def AnyRefType: Type = kernel.Definitions_AnyRefType + def AnyRefType: Type = internal.Definitions_AnyRefType /** The type of core type `Object`. */ - def ObjectType: Type = kernel.Definitions_ObjectType + def ObjectType: Type = internal.Definitions_ObjectType /** The type of core type `Nothing`. */ - def NothingType: Type = kernel.Definitions_NothingType + def NothingType: Type = internal.Definitions_NothingType /** The type of core type `Null`. */ - def NullType: Type = kernel.Definitions_NullType + def NullType: Type = internal.Definitions_NullType /** The type for `scala.String`. */ - def StringType: Type = kernel.Definitions_StringType + def StringType: Type = internal.Definitions_StringType } } diff --git a/library/src/scala/tasty/reflect/SymbolOps.scala b/library/src/scala/tasty/reflect/SymbolOps.scala index e6e7d848e329..db7b3ed7397e 100644 --- a/library/src/scala/tasty/reflect/SymbolOps.scala +++ b/library/src/scala/tasty/reflect/SymbolOps.scala @@ -9,30 +9,30 @@ trait SymbolOps extends Core { implicit class SymbolAPI(self: Symbol) { /** Owner of this symbol. The owner is the symbol in which this symbol is defined */ - def owner given (ctx: Context): Symbol = kernel.Symbol_owner(self) + def owner given (ctx: Context): Symbol = internal.Symbol_owner(self) /** Flags of this symbol */ - def flags given (ctx: Context): Flags = kernel.Symbol_flags(self) + def flags given (ctx: Context): Flags = internal.Symbol_flags(self) /** This symbol is private within the resulting type */ - def privateWithin given (ctx: Context): Option[Type] = kernel.Symbol_privateWithin(self) + def privateWithin given (ctx: Context): Option[Type] = internal.Symbol_privateWithin(self) /** This symbol is protected within the resulting type */ - def protectedWithin given (ctx: Context): Option[Type] = kernel.Symbol_protectedWithin(self) + def protectedWithin given (ctx: Context): Option[Type] = internal.Symbol_protectedWithin(self) /** The name of this symbol */ - def name given (ctx: Context): String = kernel.Symbol_name(self) + def name given (ctx: Context): String = internal.Symbol_name(self) /** The full name of this symbol up to the root package */ - def fullName given (ctx: Context): String = kernel.Symbol_fullName(self) + def fullName given (ctx: Context): String = internal.Symbol_fullName(self) /** The position of this symbol */ - def pos given (ctx: Context): Position = kernel.Symbol_pos(self) + def pos given (ctx: Context): Position = internal.Symbol_pos(self) - def localContext given (ctx: Context): Context = kernel.Symbol_localContext(self) + def localContext given (ctx: Context): Context = internal.Symbol_localContext(self) /** The comment for this symbol, if any */ - def comment given (ctx: Context): Option[Comment] = kernel.Symbol_comment(self) + def comment given (ctx: Context): Option[Comment] = internal.Symbol_comment(self) /** Unsafe cast as to PackageSymbol. Use IsPackageSymbol to safely check and cast to PackageSymbol */ def asPackageDef given (ctx: Context): PackageDefSymbol = self match { @@ -71,190 +71,190 @@ trait SymbolOps extends Core { } /** Annotations attached to this symbol */ - def annots given (ctx: Context): List[Term] = kernel.Symbol_annots(self) + def annots given (ctx: Context): List[Term] = internal.Symbol_annots(self) - def isDefinedInCurrentRun given (ctx: Context): Boolean = kernel.Symbol_isDefinedInCurrentRun(self) + def isDefinedInCurrentRun given (ctx: Context): Boolean = internal.Symbol_isDefinedInCurrentRun(self) - def isLocalDummy given (ctx: Context): Boolean = kernel.Symbol_isLocalDummy(self) - def isRefinementClass given (ctx: Context): Boolean = kernel.Symbol_isRefinementClass(self) - def isAliasType given (ctx: Context): Boolean = kernel.Symbol_isAliasType(self) - def isAnonymousClass given (ctx: Context): Boolean = kernel.Symbol_isAnonymousClass(self) - def isAnonymousFunction given (ctx: Context): Boolean = kernel.Symbol_isAnonymousFunction(self) - def isAbstractType given (ctx: Context): Boolean = kernel.Symbol_isAbstractType(self) - def isClassConstructor given (ctx: Context): Boolean = kernel.Symbol_isClassConstructor(self) + def isLocalDummy given (ctx: Context): Boolean = internal.Symbol_isLocalDummy(self) + def isRefinementClass given (ctx: Context): Boolean = internal.Symbol_isRefinementClass(self) + def isAliasType given (ctx: Context): Boolean = internal.Symbol_isAliasType(self) + def isAnonymousClass given (ctx: Context): Boolean = internal.Symbol_isAnonymousClass(self) + def isAnonymousFunction given (ctx: Context): Boolean = internal.Symbol_isAnonymousFunction(self) + def isAbstractType given (ctx: Context): Boolean = internal.Symbol_isAbstractType(self) + def isClassConstructor given (ctx: Context): Boolean = internal.Symbol_isClassConstructor(self) - def isType given (ctx: Context): Boolean = kernel.matchTypeSymbol(self).isDefined - def isTerm given (ctx: Context): Boolean = kernel.matchTermSymbol(self).isDefined + def isType given (ctx: Context): Boolean = internal.matchTypeSymbol(self).isDefined + def isTerm given (ctx: Context): Boolean = internal.matchTermSymbol(self).isDefined } // PackageSymbol object IsPackageDefSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[PackageDefSymbol] = - kernel.matchPackageDefSymbol(symbol) + internal.matchPackageDefSymbol(symbol) } implicit class PackageDefSymbolAPI(self: PackageDefSymbol) { def tree given (ctx: Context): PackageDef = - kernel.PackageDefSymbol_tree(self) + internal.PackageDefSymbol_tree(self) } // TypeSymbol object IsTypeSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[TypeSymbol] = - kernel.matchTypeSymbol(symbol) + internal.matchTypeSymbol(symbol) } // ClassSymbol object IsClassDefSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[ClassDefSymbol] = - kernel.matchClassDefSymbol(symbol) + internal.matchClassDefSymbol(symbol) } object ClassDefSymbol { /** The ClassSymbol of a global class definition */ def of(fullName: String) given (ctx: Context): ClassDefSymbol = - kernel.ClassDefSymbol_of(fullName) + internal.ClassDefSymbol_of(fullName) } implicit class ClassDefSymbolAPI(self: ClassDefSymbol) { /** ClassDef tree of this defintion */ def tree given (ctx: Context): ClassDef = - kernel.ClassDefSymbol_tree(self) + internal.ClassDefSymbol_tree(self) /** Fields directly declared in the class */ def fields given (ctx: Context): List[Symbol] = - kernel.ClassDefSymbol_fields(self) + internal.ClassDefSymbol_fields(self) /** Field with the given name directly declared in the class */ def field(name: String) given (ctx: Context): Option[Symbol] = - kernel.ClassDefSymbol_field(self)(name) + internal.ClassDefSymbol_field(self)(name) /** Get non-private named methods defined directly inside the class */ def classMethod(name: String) given (ctx: Context): List[DefDefSymbol] = - kernel.ClassDefSymbol_classMethod(self)(name) + internal.ClassDefSymbol_classMethod(self)(name) /** Get all non-private methods defined directly inside the class, exluding constructors */ def classMethods given (ctx: Context): List[DefDefSymbol] = - kernel.ClassDefSymbol_classMethods(self) + internal.ClassDefSymbol_classMethods(self) /** Get named non-private methods declared or inherited */ def method(name: String) given (ctx: Context): List[DefDefSymbol] = - kernel.ClassDefSymbol_method(self)(name) + internal.ClassDefSymbol_method(self)(name) /** Get all non-private methods declared or inherited */ def methods given (ctx: Context): List[DefDefSymbol] = - kernel.ClassDefSymbol_methods(self) + internal.ClassDefSymbol_methods(self) /** Fields of a case class type -- only the ones declared in primary constructor */ def caseFields given (ctx: Context): List[ValDefSymbol] = - kernel.ClassDefSymbol_caseFields(self) + internal.ClassDefSymbol_caseFields(self) /** The class symbol of the companion module class */ def companionClass given (ctx: Context): Option[ClassDefSymbol] = - kernel.ClassDefSymbol_companionClass(self) + internal.ClassDefSymbol_companionClass(self) /** The symbol of the companion module */ def companionModule given (ctx: Context): Option[ValDefSymbol] = - kernel.ClassDefSymbol_companionModule(self) + internal.ClassDefSymbol_companionModule(self) /** The symbol of the class of the companion module */ def moduleClass given (ctx: Context): Option[Symbol] = - kernel.ClassDefSymbol_moduleClass(self) + internal.ClassDefSymbol_moduleClass(self) } // TypeSymbol object IsTypeDefSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[TypeDefSymbol] = - kernel.matchTypeDefSymbol(symbol) + internal.matchTypeDefSymbol(symbol) } implicit class TypeDefSymbolAPI(self: TypeDefSymbol) { /** TypeDef tree of this definition */ def tree given (ctx: Context): TypeDef = - kernel.TypeDefSymbol_tree(self) + internal.TypeDefSymbol_tree(self) def isTypeParam given (ctx: Context): Boolean = - kernel.TypeDefSymbol_isTypeParam(self) + internal.TypeDefSymbol_isTypeParam(self) } // TypeBindSymbol object IsTypeBindSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[TypeBindSymbol] = - kernel.matchTypeBindSymbol(symbol) + internal.matchTypeBindSymbol(symbol) } implicit class TypeBindSymbolAPI(self: TypeBindSymbol) { /** TypeBind pattern of this definition */ def tree given (ctx: Context): TypeBind = - kernel.TypeBindSymbol_tree(self) + internal.TypeBindSymbol_tree(self) } // TermSymbol object IsTermSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[TermSymbol] = - kernel.matchTermSymbol(symbol) + internal.matchTermSymbol(symbol) } // DefSymbol object IsDefDefSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[DefDefSymbol] = - kernel.matchDefDefSymbol(symbol) + internal.matchDefDefSymbol(symbol) } implicit class DefDefSymbolAPI(self: DefDefSymbol) { /** DefDef tree of this defintion */ def tree given (ctx: Context): DefDef = - kernel.DefDefSymbol_tree(self) + internal.DefDefSymbol_tree(self) /** Signature of this defintion */ def signature given (ctx: Context): Signature = - kernel.DefDefSymbol_signature(self) + internal.DefDefSymbol_signature(self) } // ValSymbol object IsValDefSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[ValDefSymbol] = - kernel.matchValDefSymbol(symbol) + internal.matchValDefSymbol(symbol) } implicit class ValDefSymbolAPI(self: ValDefSymbol) { /** ValDef tree of this defintion */ def tree given (ctx: Context): ValDef = - kernel.ValDefSymbol_tree(self) + internal.ValDefSymbol_tree(self) /** The class symbol of the companion module class */ def moduleClass given (ctx: Context): Option[ClassDefSymbol] = - kernel.ValDefSymbol_moduleClass(self) + internal.ValDefSymbol_moduleClass(self) def companionClass given (ctx: Context): Option[ClassDefSymbol] = - kernel.ValDefSymbol_companionClass(self) + internal.ValDefSymbol_companionClass(self) } // BindSymbol object IsBindSymbol { def unapply(symbol: Symbol) given (ctx: Context): Option[BindSymbol] = - kernel.matchBindSymbol(symbol) + internal.matchBindSymbol(symbol) } implicit class BindSymbolAPI(self: BindSymbol) { /** Bind pattern of this definition */ def tree given (ctx: Context): Bind = - kernel.BindSymbol_tree(self) + internal.BindSymbol_tree(self) } // NoSymbol object NoSymbol { def unapply(symbol: Symbol) given (ctx: Context): Boolean = - kernel.matchNoSymbol(symbol) + internal.matchNoSymbol(symbol) } } diff --git a/library/src/scala/tasty/reflect/TreeOps.scala b/library/src/scala/tasty/reflect/TreeOps.scala index d8cea289541b..9976c41c3711 100644 --- a/library/src/scala/tasty/reflect/TreeOps.scala +++ b/library/src/scala/tasty/reflect/TreeOps.scala @@ -7,178 +7,178 @@ trait TreeOps extends Core { implicit class TreeAPI(self: Tree) { /** Position in the source code */ - def pos given (ctx: Context): Position = kernel.Tree_pos(self) + def pos given (ctx: Context): Position = internal.Tree_pos(self) - def symbol given (ctx: Context): Symbol = kernel.Tree_symbol(self) + def symbol given (ctx: Context): Symbol = internal.Tree_symbol(self) } object IsPackageClause { def unapply(tree: Tree) given (ctx: Context): Option[PackageClause] = - kernel.matchPackageClause(tree) + internal.matchPackageClause(tree) } object PackageClause { def apply(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = - kernel.PackageClause_apply(pid, stats) + internal.PackageClause_apply(pid, stats) def copy(original: PackageClause)(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = - kernel.PackageClause_copy(original)(pid, stats) + internal.PackageClause_copy(original)(pid, stats) def unapply(tree: Tree) given (ctx: Context): Option[(Ref, List[Tree])] = - kernel.matchPackageClause(tree).map(x => (x.pid, x.stats)) + internal.matchPackageClause(tree).map(x => (x.pid, x.stats)) } implicit class PackageClauseAPI(self: PackageClause) { - def pid given (ctx: Context): Ref = kernel.PackageClause_pid(self) - def stats given (ctx: Context): List[Tree] = kernel.PackageClause_stats(self) + def pid given (ctx: Context): Ref = internal.PackageClause_pid(self) + def stats given (ctx: Context): List[Tree] = internal.PackageClause_stats(self) } object IsImport { def unapply(tree: Tree) given (ctx: Context): Option[Import] = - kernel.matchImport(tree) + internal.matchImport(tree) } object Import { def apply(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import = - kernel.Import_apply(importImplied, expr, selectors) + internal.Import_apply(importImplied, expr, selectors) def copy(original: Import)(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import = - kernel.Import_copy(original)(importImplied, expr, selectors) + internal.Import_copy(original)(importImplied, expr, selectors) def unapply(tree: Tree) given (ctx: Context): Option[(Boolean, Term, List[ImportSelector])] = - kernel.matchImport(tree).map(x => (x.importImplied, x.expr, x.selectors)) + internal.matchImport(tree).map(x => (x.importImplied, x.expr, x.selectors)) } implicit class ImportAPI(self: Import) { - def importImplied: Boolean = kernel.Import_implied(self) - def expr given (ctx: Context): Term = kernel.Import_expr(self) + def importImplied: Boolean = internal.Import_implied(self) + def expr given (ctx: Context): Term = internal.Import_expr(self) def selectors given (ctx: Context): List[ImportSelector] = - kernel.Import_selectors(self) + internal.Import_selectors(self) } object IsStatement { /** Matches any Statement and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Statement] = kernel.matchStatement(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Statement] = internal.matchStatement(tree) } // ----- Definitions ---------------------------------------------- object IsDefinition { - def unapply(tree: Tree) given (ctx: Context): Option[Definition] = kernel.matchDefinition(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Definition] = internal.matchDefinition(tree) } implicit class DefinitionAPI(self: Definition) { - def name given (ctx: Context): String = kernel.Definition_name(self) + def name given (ctx: Context): String = internal.Definition_name(self) } // ClassDef object IsClassDef { - def unapply(tree: Tree) given (ctx: Context): Option[ClassDef] = kernel.matchClassDef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[ClassDef] = internal.matchClassDef(tree) } object ClassDef { // TODO def apply(name: String, constr: DefDef, parents: List[TermOrTypeTree], selfOpt: Option[ValDef], body: List[Statement]) given (ctx: Context): ClassDef def copy(original: ClassDef)(name: String, constr: DefDef, parents: List[Tree /* Term | TypeTree */], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement]) given (ctx: Context): ClassDef = - kernel.ClassDef_copy(original)(name, constr, parents, derived, selfOpt, body) + internal.ClassDef_copy(original)(name, constr, parents, derived, selfOpt, body) def unapply(tree: Tree) given (ctx: Context): Option[(String, DefDef, List[Tree /* Term | TypeTree */], List[TypeTree], Option[ValDef], List[Statement])] = - kernel.matchClassDef(tree).map(x => (x.name, x.constructor, x.parents, x.derived, x.self, x.body)) + internal.matchClassDef(tree).map(x => (x.name, x.constructor, x.parents, x.derived, x.self, x.body)) } implicit class ClassDefAPI(self: ClassDef) { - def constructor given (ctx: Context): DefDef = kernel.ClassDef_constructor(self) - def parents given (ctx: Context): List[Tree /* Term | TypeTree */] = kernel.ClassDef_parents(self) - def derived given (ctx: Context): List[TypeTree] = kernel.ClassDef_derived(self) - def self given (ctx: Context): Option[ValDef] = kernel.ClassDef_self(self) - def body given (ctx: Context): List[Statement] = kernel.ClassDef_body(self) - def symbol given (ctx: Context): ClassDefSymbol = kernel.ClassDef_symbol(self) + def constructor given (ctx: Context): DefDef = internal.ClassDef_constructor(self) + def parents given (ctx: Context): List[Tree /* Term | TypeTree */] = internal.ClassDef_parents(self) + def derived given (ctx: Context): List[TypeTree] = internal.ClassDef_derived(self) + def self given (ctx: Context): Option[ValDef] = internal.ClassDef_self(self) + def body given (ctx: Context): List[Statement] = internal.ClassDef_body(self) + def symbol given (ctx: Context): ClassDefSymbol = internal.ClassDef_symbol(self) } // DefDef object IsDefDef { - def unapply(tree: Tree) given (ctx: Context): Option[DefDef] = kernel.matchDefDef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[DefDef] = internal.matchDefDef(tree) } object DefDef { def apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term]) given (ctx: Context): DefDef = - kernel.DefDef_apply(symbol, rhsFn) + internal.DefDef_apply(symbol, rhsFn) def copy(original: DefDef)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): DefDef = - kernel.DefDef_copy(original)(name, typeParams, paramss, tpt, rhs) + internal.DefDef_copy(original)(name, typeParams, paramss, tpt, rhs) def unapply(tree: Tree) given (ctx: Context): Option[(String, List[TypeDef], List[List[ValDef]], TypeTree, Option[Term])] = - kernel.matchDefDef(tree).map(x => (x.name, x.typeParams, x.paramss, x.returnTpt, x.rhs)) + internal.matchDefDef(tree).map(x => (x.name, x.typeParams, x.paramss, x.returnTpt, x.rhs)) } implicit class DefDefAPI(self: DefDef) { - def typeParams given (ctx: Context): List[TypeDef] = kernel.DefDef_typeParams(self) - def paramss given (ctx: Context): List[List[ValDef]] = kernel.DefDef_paramss(self) - def returnTpt given (ctx: Context): TypeTree = kernel.DefDef_returnTpt(self) // TODO rename to tpt - def rhs given (ctx: Context): Option[Term] = kernel.DefDef_rhs(self) - def symbol given (ctx: Context): DefDefSymbol = kernel.DefDef_symbol(self) + def typeParams given (ctx: Context): List[TypeDef] = internal.DefDef_typeParams(self) + def paramss given (ctx: Context): List[List[ValDef]] = internal.DefDef_paramss(self) + def returnTpt given (ctx: Context): TypeTree = internal.DefDef_returnTpt(self) // TODO rename to tpt + def rhs given (ctx: Context): Option[Term] = internal.DefDef_rhs(self) + def symbol given (ctx: Context): DefDefSymbol = internal.DefDef_symbol(self) } // ValDef object IsValDef { - def unapply(tree: Tree) given (ctx: Context): Option[ValDef] = kernel.matchValDef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[ValDef] = internal.matchValDef(tree) } object ValDef { def apply(symbol: ValDefSymbol, rhs: Option[Term]) given (ctx: Context): ValDef = - kernel.ValDef_apply(symbol, rhs) + internal.ValDef_apply(symbol, rhs) def copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): ValDef = - kernel.ValDef_copy(original)(name, tpt, rhs) + internal.ValDef_copy(original)(name, tpt, rhs) def unapply(tree: Tree) given (ctx: Context): Option[(String, TypeTree, Option[Term])] = - kernel.matchValDef(tree).map(x => (x.name, x.tpt, x.rhs)) + internal.matchValDef(tree).map(x => (x.name, x.tpt, x.rhs)) } implicit class ValDefAPI(self: ValDef) { - def tpt given (ctx: Context): TypeTree = kernel.ValDef_tpt(self) - def rhs given (ctx: Context): Option[Term] = kernel.ValDef_rhs(self) - def symbol given (ctx: Context): ValDefSymbol = kernel.ValDef_symbol(self) + def tpt given (ctx: Context): TypeTree = internal.ValDef_tpt(self) + def rhs given (ctx: Context): Option[Term] = internal.ValDef_rhs(self) + def symbol given (ctx: Context): ValDefSymbol = internal.ValDef_symbol(self) } // TypeDef object IsTypeDef { - def unapply(tree: Tree) given (ctx: Context): Option[TypeDef] = kernel.matchTypeDef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[TypeDef] = internal.matchTypeDef(tree) } object TypeDef { def apply(symbol: TypeDefSymbol) given (ctx: Context): TypeDef = - kernel.TypeDef_apply(symbol) + internal.TypeDef_apply(symbol) def copy(original: TypeDef)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): TypeDef = - kernel.TypeDef_copy(original)(name, rhs) + internal.TypeDef_copy(original)(name, rhs) def unapply(tree: Tree) given (ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/ /* TypeTree | TypeBoundsTree */)] = - kernel.matchTypeDef(tree).map(x => (x.name, x.rhs)) + internal.matchTypeDef(tree).map(x => (x.name, x.rhs)) } implicit class TypeDefAPI(self: TypeDef) { - def rhs given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.TypeDef_rhs(self) - def symbol given (ctx: Context): TypeDefSymbol = kernel.TypeDef_symbol(self) + def rhs given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.TypeDef_rhs(self) + def symbol given (ctx: Context): TypeDefSymbol = internal.TypeDef_symbol(self) } // PackageDef object IsPackageDef { def unapply(tree: Tree) given (ctx: Context): Option[PackageDef] = - kernel.matchPackageDef(tree) + internal.matchPackageDef(tree) } implicit class PackageDefAPI(self: PackageDef) { - def owner given (ctx: Context): PackageDef = kernel.PackageDef_owner(self) - def members given (ctx: Context): List[Statement] = kernel.PackageDef_members(self) - def symbol given (ctx: Context): PackageDefSymbol = kernel.PackageDef_symbol(self) + def owner given (ctx: Context): PackageDef = internal.PackageDef_owner(self) + def members given (ctx: Context): List[Statement] = internal.PackageDef_members(self) + def symbol given (ctx: Context): PackageDefSymbol = internal.PackageDef_symbol(self) } object PackageDef { def unapply(tree: Tree) given (ctx: Context): Option[(String, PackageDef)] = - kernel.matchPackageDef(tree).map(x => (x.name, x.owner)) + internal.matchPackageDef(tree).map(x => (x.name, x.owner)) } // ----- Terms ---------------------------------------------------- implicit class TermAPI(self: Term) { - def tpe given (ctx: Context): Type = kernel.Term_tpe(self) - def pos given (ctx: Context): Position = kernel.Term_pos(self) - def underlyingArgument given (ctx: Context): Term = kernel.Term_underlyingArgument(self) - def underlying given (ctx: Context): Term = kernel.Term_underlying(self) + def tpe given (ctx: Context): Type = internal.Term_tpe(self) + def pos given (ctx: Context): Position = internal.Term_pos(self) + def underlyingArgument given (ctx: Context): Term = internal.Term_underlyingArgument(self) + def underlying given (ctx: Context): Term = internal.Term_underlying(self) /** A unary apply node with given argument: `tree(arg)` */ def appliedTo(arg: Term) given (ctx: Context): Term = @@ -221,19 +221,19 @@ trait TreeOps extends Core { object IsTerm { /** Matches any term */ def unapply(tree: Tree) given (ctx: Context): Option[Term] = - kernel.matchTerm(tree) + internal.matchTerm(tree) } object IsRef { /** Matches any Ref and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Ref] = kernel.matchRef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Ref] = internal.matchRef(tree) } object Ref { /** Create a reference tree */ def apply(sym: Symbol) given (ctx: Context): Ref = - kernel.Ref_apply(sym) + internal.Ref_apply(sym) // TODO def copy(original: Tree)(name: String) given (ctx: Context): Ref @@ -241,36 +241,36 @@ trait TreeOps extends Core { object IsIdent { /** Matches any Ident and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Ident] = kernel.matchIdent(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Ident] = internal.matchIdent(tree) } implicit class IdentAPI(self: Ident) { - def name given (ctx: Context): String = kernel.Ident_name(self) + def name given (ctx: Context): String = internal.Ident_name(self) } /** Scala term identifier */ object Ident { def apply(tmref: TermRef) given (ctx: Context): Term = - kernel.Ident_apply(tmref) + internal.Ident_apply(tmref) def copy(original: Tree)(name: String) given (ctx: Context): Ident = - kernel.Ident_copy(original)(name) + internal.Ident_copy(original)(name) /** Matches a term identifier and returns its name */ def unapply(tree: Tree) given (ctx: Context): Option[String] = - kernel.matchIdent(tree).map(_.name) + internal.matchIdent(tree).map(_.name) } object IsSelect { /** Matches any Select and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Select] = kernel.matchSelect(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Select] = internal.matchSelect(tree) } /** Scala term selection */ object Select { /** Select a term member by symbol */ def apply(qualifier: Term, symbol: Symbol) given (ctx: Context): Select = - kernel.Select_apply(qualifier, symbol) + internal.Select_apply(qualifier, symbol) /** Select a field or a non-overloaded method by name * @@ -279,30 +279,30 @@ trait TreeOps extends Core { * in that case. */ def unique(qualifier: Term, name: String) given (ctx: Context): Select = - kernel.Select_unique(qualifier, name) + internal.Select_unique(qualifier, name) // TODO rename, this returns an Apply and not a Select /** Call an overloaded method with the given type and term parameters */ def overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term]) given (ctx: Context): Apply = - kernel.Select_overloaded(qualifier, name, targs, args) + internal.Select_overloaded(qualifier, name, targs, args) def copy(original: Tree)(qualifier: Term, name: String) given (ctx: Context): Select = - kernel.Select_copy(original)(qualifier, name) + internal.Select_copy(original)(qualifier, name) /** Matches `.` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, String)] = - kernel.matchSelect(tree).map(x => (x.qualifier, x.name)) + internal.matchSelect(tree).map(x => (x.qualifier, x.name)) } implicit class SelectAPI(self: Select) { - def qualifier given (ctx: Context): Term = kernel.Select_qualifier(self) - def name given (ctx: Context): String = kernel.Select_name(self) - def signature given (ctx: Context): Option[Signature] = kernel.Select_signature(self) + def qualifier given (ctx: Context): Term = internal.Select_qualifier(self) + def name given (ctx: Context): String = internal.Select_name(self) + def signature given (ctx: Context): Option[Signature] = internal.Select_signature(self) } object IsLiteral { /** Matches any Literal and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Literal] = kernel.matchLiteral(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Literal] = internal.matchLiteral(tree) } /** Scala literal constant */ @@ -310,23 +310,23 @@ trait TreeOps extends Core { /** Create a literal constant */ def apply(constant: Constant) given (ctx: Context): Literal = - kernel.Literal_apply(constant) + internal.Literal_apply(constant) def copy(original: Tree)(constant: Constant) given (ctx: Context): Literal = - kernel.Literal_copy(original)(constant) + internal.Literal_copy(original)(constant) /** Matches a literal constant */ def unapply(tree: Tree) given (ctx: Context): Option[Constant] = - kernel.matchLiteral(tree).map(_.constant) + internal.matchLiteral(tree).map(_.constant) } implicit class LiteralAPI(self: Literal) { - def constant given (ctx: Context): Constant = kernel.Literal_constant(self) + def constant given (ctx: Context): Constant = internal.Literal_constant(self) } object IsThis { /** Matches any This and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[This] = kernel.matchThis(tree) + def unapply(tree: Tree) given (ctx: Context): Option[This] = internal.matchThis(tree) } /** Scala `this` or `this[id]` */ @@ -334,24 +334,24 @@ trait TreeOps extends Core { /** Create a `this[` */ def apply(cls: ClassDefSymbol) given (ctx: Context): This = - kernel.This_apply(cls) + internal.This_apply(cls) def copy(original: Tree)(qual: Option[Id]) given (ctx: Context): This = - kernel.This_copy(original)(qual) + internal.This_copy(original)(qual) /** Matches `this[` */ def unapply(tree: Tree) given (ctx: Context): Option[Option[Id]] = - kernel.matchThis(tree).map(_.id) + internal.matchThis(tree).map(_.id) } implicit class ThisAPI(self: This) { - def id given (ctx: Context): Option[Id] = kernel.This_id(self) + def id given (ctx: Context): Option[Id] = internal.This_id(self) } object IsNew { /** Matches any New and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[New] = kernel.matchNew(tree) + def unapply(tree: Tree) given (ctx: Context): Option[New] = internal.matchNew(tree) } /** Scala `new` */ @@ -359,23 +359,23 @@ trait TreeOps extends Core { /** Create a `new ` */ def apply(tpt: TypeTree) given (ctx: Context): New = - kernel.New_apply(tpt) + internal.New_apply(tpt) def copy(original: Tree)(tpt: TypeTree) given (ctx: Context): New = - kernel.New_copy(original)(tpt) + internal.New_copy(original)(tpt) /** Matches a `new ` */ def unapply(tree: Tree) given (ctx: Context): Option[TypeTree] = - kernel.matchNew(tree).map(_.tpt) + internal.matchNew(tree).map(_.tpt) } implicit class NewAPI(self: New) { - def tpt given (ctx: Context): TypeTree = kernel.New_tpt(self) + def tpt given (ctx: Context): TypeTree = internal.New_tpt(self) } object IsNamedArg { /** Matches any NamedArg and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[NamedArg] = kernel.matchNamedArg(tree) + def unapply(tree: Tree) given (ctx: Context): Option[NamedArg] = internal.matchNamedArg(tree) } /** Scala named argument `x = y` in argument position */ @@ -383,25 +383,25 @@ trait TreeOps extends Core { /** Create a named argument ` = ` */ def apply(name: String, arg: Term) given (ctx: Context): NamedArg = - kernel.NamedArg_apply(name, arg) + internal.NamedArg_apply(name, arg) def copy(original: NamedArg)(name: String, arg: Term) given (ctx: Context): NamedArg = - kernel.NamedArg_copy(original)(name, arg) + internal.NamedArg_copy(original)(name, arg) /** Matches a named argument ` = ` */ def unapply(tree: Tree) given (ctx: Context): Option[(String, Term)] = - kernel.matchNamedArg(tree).map(x => (x.name, x.value)) + internal.matchNamedArg(tree).map(x => (x.name, x.value)) } implicit class NamedArgAPI(self: NamedArg) { - def name given (ctx: Context): String = kernel.NamedArg_name(self) - def value given (ctx: Context): Term = kernel.NamedArg_value(self) + def name given (ctx: Context): String = internal.NamedArg_name(self) + def value given (ctx: Context): Term = internal.NamedArg_value(self) } object IsApply { /** Matches any Apply and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Apply] = kernel.matchApply(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Apply] = internal.matchApply(tree) } /** Scala parameter application */ @@ -409,25 +409,25 @@ trait TreeOps extends Core { /** Create a function application `()` */ def apply(fun: Term, args: List[Term]) given (ctx: Context): Apply = - kernel.Apply_apply(fun, args) + internal.Apply_apply(fun, args) def copy(original: Tree)(fun: Term, args: List[Term]) given (ctx: Context): Apply = - kernel.Apply_copy(original)(fun, args) + internal.Apply_copy(original)(fun, args) /** Matches a function application `()` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, List[Term])] = - kernel.matchApply(tree).map(x => (x.fun, x.args)) + internal.matchApply(tree).map(x => (x.fun, x.args)) } implicit class ApplyAPI(self: Apply) { - def fun given (ctx: Context): Term = kernel.Apply_fun(self) - def args given (ctx: Context): List[Term] = kernel.Apply_args(self) + def fun given (ctx: Context): Term = internal.Apply_fun(self) + def args given (ctx: Context): List[Term] = internal.Apply_args(self) } object IsTypeApply { /** Matches any TypeApply and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[TypeApply] = - kernel.matchTypeApply(tree) + internal.matchTypeApply(tree) } /** Scala type parameter application */ @@ -435,25 +435,25 @@ trait TreeOps extends Core { /** Create a function type application `[]` */ def apply(fun: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = - kernel.TypeApply_apply(fun, args) + internal.TypeApply_apply(fun, args) def copy(original: Tree)(fun: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = - kernel.TypeApply_copy(original)(fun, args) + internal.TypeApply_copy(original)(fun, args) /** Matches a function type application `[]` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, List[TypeTree])] = - kernel.matchTypeApply(tree).map(x => (x.fun, x.args)) + internal.matchTypeApply(tree).map(x => (x.fun, x.args)) } implicit class TypeApplyAPI(self: TypeApply) { - def fun given (ctx: Context): Term = kernel.TypeApply_fun(self) - def args given (ctx: Context): List[TypeTree] = kernel.TypeApply_args(self) + def fun given (ctx: Context): Term = internal.TypeApply_fun(self) + def args given (ctx: Context): List[TypeTree] = internal.TypeApply_args(self) } object IsSuper { /** Matches any Super and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Super] = kernel.matchSuper(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Super] = internal.matchSuper(tree) } /** Scala `x.super` or `x.super[id]` */ @@ -461,24 +461,24 @@ trait TreeOps extends Core { /** Creates a `.super[` */ def apply(qual: Term, mix: Option[Id]) given (ctx: Context): Super = - kernel.Super_apply(qual, mix) + internal.Super_apply(qual, mix) def copy(original: Tree)(qual: Term, mix: Option[Id]) given (ctx: Context): Super = - kernel.Super_copy(original)(qual, mix) + internal.Super_copy(original)(qual, mix) /** Matches a `.super[` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, Option[Id])] = - kernel.matchSuper(tree).map(x => (x.qualifier, x.id)) + internal.matchSuper(tree).map(x => (x.qualifier, x.id)) } implicit class SuperAPI(self: Super) { - def qualifier given (ctx: Context): Term = kernel.Super_qualifier(self) - def id given (ctx: Context): Option[Id] = kernel.Super_id(self) + def qualifier given (ctx: Context): Term = internal.Super_qualifier(self) + def id given (ctx: Context): Option[Id] = internal.Super_id(self) } object IsTyped { /** Matches any Typed and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Typed] = kernel.matchTyped(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Typed] = internal.matchTyped(tree) } /** Scala ascription `x: T` */ @@ -486,25 +486,25 @@ trait TreeOps extends Core { /** Create a type ascription `: ` */ def apply(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = - kernel.Typed_apply(expr, tpt) + internal.Typed_apply(expr, tpt) def copy(original: Tree)(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = - kernel.Typed_copy(original)(expr, tpt) + internal.Typed_copy(original)(expr, tpt) /** Matches `: ` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, TypeTree)] = - kernel.matchTyped(tree).map(x => (x.expr, x.tpt)) + internal.matchTyped(tree).map(x => (x.expr, x.tpt)) } implicit class TypedAPI(self: Typed) { - def expr given (ctx: Context): Term = kernel.Typed_expr(self) - def tpt given (ctx: Context): TypeTree = kernel.Typed_tpt(self) + def expr given (ctx: Context): Term = internal.Typed_expr(self) + def tpt given (ctx: Context): TypeTree = internal.Typed_tpt(self) } object IsAssign { /** Matches any Assign and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Assign] = kernel.matchAssign(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Assign] = internal.matchAssign(tree) } /** Scala assign `x = y` */ @@ -512,24 +512,24 @@ trait TreeOps extends Core { /** Create an assignment ` = ` */ def apply(lhs: Term, rhs: Term) given (ctx: Context): Assign = - kernel.Assign_apply(lhs, rhs) + internal.Assign_apply(lhs, rhs) def copy(original: Tree)(lhs: Term, rhs: Term) given (ctx: Context): Assign = - kernel.Assign_copy(original)(lhs, rhs) + internal.Assign_copy(original)(lhs, rhs) /** Matches an assignment ` = ` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, Term)] = - kernel.matchAssign(tree).map(x => (x.lhs, x.rhs)) + internal.matchAssign(tree).map(x => (x.lhs, x.rhs)) } implicit class AssignAPI(self: Assign) { - def lhs given (ctx: Context): Term = kernel.Assign_lhs(self) - def rhs given (ctx: Context): Term = kernel.Assign_rhs(self) + def lhs given (ctx: Context): Term = internal.Assign_lhs(self) + def rhs given (ctx: Context): Term = internal.Assign_rhs(self) } object IsBlock { /** Matches any Block and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Block] = kernel.matchBlock(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Block] = internal.matchBlock(tree) } /** Scala code block `{ stat0; ...; statN; expr }` term */ @@ -537,41 +537,41 @@ trait TreeOps extends Core { /** Creates a block `{ ; }` */ def apply(stats: List[Statement], expr: Term) given (ctx: Context): Block = - kernel.Block_apply(stats, expr) + internal.Block_apply(stats, expr) def copy(original: Tree)(stats: List[Statement], expr: Term) given (ctx: Context): Block = - kernel.Block_copy(original)(stats, expr) + internal.Block_copy(original)(stats, expr) /** Matches a block `{ ; }` */ def unapply(tree: Tree) given (ctx: Context): Option[(List[Statement], Term)] = - kernel.matchBlock(tree).map(x => (x.statements, x.expr)) + internal.matchBlock(tree).map(x => (x.statements, x.expr)) } implicit class BlockAPI(self: Block) { - def statements given (ctx: Context): List[Statement] = kernel.Block_statements(self) - def expr given (ctx: Context): Term = kernel.Block_expr(self) + def statements given (ctx: Context): List[Statement] = internal.Block_statements(self) + def expr given (ctx: Context): Term = internal.Block_expr(self) } object IsClosure { /** Matches any Closure and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Closure] = kernel.matchClosure(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Closure] = internal.matchClosure(tree) } object Closure { def apply(meth: Term, tpt: Option[Type]) given (ctx: Context): Closure = - kernel.Closure_apply(meth, tpt) + internal.Closure_apply(meth, tpt) def copy(original: Tree)(meth: Tree, tpt: Option[Type]) given (ctx: Context): Closure = - kernel.Closure_copy(original)(meth, tpt) + internal.Closure_copy(original)(meth, tpt) def unapply(tree: Tree) given (ctx: Context): Option[(Term, Option[Type])] = - kernel.matchClosure(tree).map(x => (x.meth, x.tpeOpt)) + internal.matchClosure(tree).map(x => (x.meth, x.tpeOpt)) } implicit class ClosureAPI(self: Closure) { - def meth given (ctx: Context): Term = kernel.Closure_meth(self) - def tpeOpt given (ctx: Context): Option[Type] = kernel.Closure_tpeOpt(self) + def meth given (ctx: Context): Term = internal.Closure_meth(self) + def tpeOpt given (ctx: Context): Option[Type] = internal.Closure_tpeOpt(self) } /** A lambda `(...) => ...` in the source code is represented as @@ -598,7 +598,7 @@ trait TreeOps extends Core { object IsIf { /** Matches any If and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[If] = kernel.matchIf(tree) + def unapply(tree: Tree) given (ctx: Context): Option[If] = internal.matchIf(tree) } /** Scala `if`/`else` term */ @@ -606,26 +606,26 @@ trait TreeOps extends Core { /** Create an if/then/else `if () else ` */ def apply(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = - kernel.If_apply(cond, thenp, elsep) + internal.If_apply(cond, thenp, elsep) def copy(original: Tree)(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = - kernel.If_copy(original)(cond, thenp, elsep) + internal.If_copy(original)(cond, thenp, elsep) /** Matches an if/then/else `if () else ` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, Term, Term)] = - kernel.matchIf(tree).map(x => (x.cond, x.thenp, x.elsep)) + internal.matchIf(tree).map(x => (x.cond, x.thenp, x.elsep)) } implicit class IfAPI(self: If) { - def cond given (ctx: Context): Term = kernel.If_cond(self) - def thenp given (ctx: Context): Term = kernel.If_thenp(self) - def elsep given (ctx: Context): Term = kernel.If_elsep(self) + def cond given (ctx: Context): Term = internal.If_cond(self) + def thenp given (ctx: Context): Term = internal.If_thenp(self) + def elsep given (ctx: Context): Term = internal.If_elsep(self) } object IsMatch { /** Matches any Match and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Match] = kernel.matchMatch(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Match] = internal.matchMatch(tree) } /** Scala `match` term */ @@ -633,25 +633,25 @@ trait TreeOps extends Core { /** Creates a pattern match ` match { }` */ def apply(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = - kernel.Match_apply(selector, cases) + internal.Match_apply(selector, cases) def copy(original: Tree)(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = - kernel.Match_copy(original)(selector, cases) + internal.Match_copy(original)(selector, cases) /** Matches a pattern match ` match { }` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, List[CaseDef])] = - kernel.matchMatch(tree).map(x => (x.scrutinee, x.cases)) + internal.matchMatch(tree).map(x => (x.scrutinee, x.cases)) } implicit class MatchAPI(self: Match) { - def scrutinee given (ctx: Context): Term = kernel.Match_scrutinee(self) - def cases given (ctx: Context): List[CaseDef] = kernel.Match_cases(self) + def scrutinee given (ctx: Context): Term = internal.Match_scrutinee(self) + def cases given (ctx: Context): List[CaseDef] = internal.Match_cases(self) } object IsImplicitMatch { /** Matches any ImpliedMatch and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[ImpliedMatch] = kernel.matchImplicitMatch(tree) + def unapply(tree: Tree) given (ctx: Context): Option[ImpliedMatch] = internal.matchImplicitMatch(tree) } /** Scala implicit `match` term */ @@ -659,24 +659,24 @@ trait TreeOps extends Core { /** Creates a pattern match `delegate match { }` */ def apply(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = - kernel.ImplicitMatch_apply(cases) + internal.ImplicitMatch_apply(cases) def copy(original: Tree)(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = - kernel.ImplicitMatch_copy(original)(cases) + internal.ImplicitMatch_copy(original)(cases) /** Matches a pattern match `delegate match { }` */ def unapply(tree: Tree) given (ctx: Context): Option[List[CaseDef]] = - kernel.matchImplicitMatch(tree).map(_.cases) + internal.matchImplicitMatch(tree).map(_.cases) } implicit class ImplicitMatchAPI(self: ImpliedMatch) { - def cases given (ctx: Context): List[CaseDef] = kernel.ImplicitMatch_cases(self) + def cases given (ctx: Context): List[CaseDef] = internal.ImplicitMatch_cases(self) } object IsTry { /** Matches any Try and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Try] = kernel.matchTry(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Try] = internal.matchTry(tree) } /** Scala `try`/`catch`/`finally` term */ @@ -684,26 +684,26 @@ trait TreeOps extends Core { /** Create a try/catch `try catch { } finally ` */ def apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try = - kernel.Try_apply(expr, cases, finalizer) + internal.Try_apply(expr, cases, finalizer) def copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try = - kernel.Try_copy(original)(expr, cases, finalizer) + internal.Try_copy(original)(expr, cases, finalizer) /** Matches a try/catch `try catch { } finally ` */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, List[CaseDef], Option[Term])] = - kernel.matchTry(tree).map(x => (x.body, x.cases, x.finalizer)) + internal.matchTry(tree).map(x => (x.body, x.cases, x.finalizer)) } implicit class TryAPI(self: Try) { - def body given (ctx: Context): Term = kernel.Try_body(self) - def cases given (ctx: Context): List[CaseDef] = kernel.Try_cases(self) - def finalizer given (ctx: Context): Option[Term] = kernel.Try_finalizer(self) + def body given (ctx: Context): Term = internal.Try_body(self) + def cases given (ctx: Context): List[CaseDef] = internal.Try_cases(self) + def finalizer given (ctx: Context): Option[Term] = internal.Try_finalizer(self) } object IsReturn { /** Matches any Return and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Return] = kernel.matchReturn(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Return] = internal.matchReturn(tree) } /** Scala local `return` */ @@ -711,460 +711,460 @@ trait TreeOps extends Core { /** Creates `return ` */ def apply(expr: Term) given (ctx: Context): Return = - kernel.Return_apply(expr) + internal.Return_apply(expr) def copy(original: Tree)(expr: Term) given (ctx: Context): Return = - kernel.Return_copy(original)(expr) + internal.Return_copy(original)(expr) /** Matches `return ` */ def unapply(tree: Tree) given (ctx: Context): Option[Term] = - kernel.matchReturn(tree).map(_.expr) + internal.matchReturn(tree).map(_.expr) } implicit class ReturnAPI(self: Return) { - def expr given (ctx: Context): Term = kernel.Return_expr(self) + def expr given (ctx: Context): Term = internal.Return_expr(self) } object IsRepeated { /** Matches any Repeated and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Repeated] = kernel.matchRepeated(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Repeated] = internal.matchRepeated(tree) } object Repeated { def apply(elems: List[Term], tpt: TypeTree) given (ctx: Context): Repeated = - kernel.Repeated_apply(elems, tpt) + internal.Repeated_apply(elems, tpt) def copy(original: Tree)(elems: List[Term], tpt: TypeTree) given (ctx: Context): Repeated = - kernel.Repeated_copy(original)(elems, tpt) + internal.Repeated_copy(original)(elems, tpt) def unapply(tree: Tree) given (ctx: Context): Option[(List[Term], TypeTree)] = - kernel.matchRepeated(tree).map(x => (x.elems, x.elemtpt)) + internal.matchRepeated(tree).map(x => (x.elems, x.elemtpt)) } implicit class RepeatedAPI(self: Repeated) { - def elems given (ctx: Context): List[Term] = kernel.Repeated_elems(self) - def elemtpt given (ctx: Context): TypeTree = kernel.Repeated_elemtpt(self) + def elems given (ctx: Context): List[Term] = internal.Repeated_elems(self) + def elemtpt given (ctx: Context): TypeTree = internal.Repeated_elemtpt(self) } object IsInlined { /** Matches any Inlined and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[Inlined] = kernel.matchInlined(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Inlined] = internal.matchInlined(tree) } object Inlined { def apply(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = - kernel.Inlined_apply(call, bindings, expansion) + internal.Inlined_apply(call, bindings, expansion) def copy(original: Tree)(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = - kernel.Inlined_copy(original)(call, bindings, expansion) + internal.Inlined_copy(original)(call, bindings, expansion) def unapply(tree: Tree) given (ctx: Context): Option[(Option[Tree /* Term | TypeTree */], List[Definition], Term)] = - kernel.matchInlined(tree).map(x => (x.call, x.bindings, x.body)) + internal.matchInlined(tree).map(x => (x.call, x.bindings, x.body)) } implicit class InlinedAPI(self: Inlined) { - def call given (ctx: Context): Option[Tree /* Term | TypeTree */] = kernel.Inlined_call(self) - def bindings given (ctx: Context): List[Definition] = kernel.Inlined_bindings(self) - def body given (ctx: Context): Term = kernel.Inlined_body(self) + def call given (ctx: Context): Option[Tree /* Term | TypeTree */] = internal.Inlined_call(self) + def bindings given (ctx: Context): List[Definition] = internal.Inlined_bindings(self) + def body given (ctx: Context): Term = internal.Inlined_body(self) } object IsSelectOuter { /** Matches any SelectOuter and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[SelectOuter] = kernel.matchSelectOuter(tree) + def unapply(tree: Tree) given (ctx: Context): Option[SelectOuter] = internal.matchSelectOuter(tree) } object SelectOuter { def apply(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = - kernel.SelectOuter_apply(qualifier, name, levels) + internal.SelectOuter_apply(qualifier, name, levels) def copy(original: Tree)(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = - kernel.SelectOuter_copy(original)(qualifier, name, levels) + internal.SelectOuter_copy(original)(qualifier, name, levels) def unapply(tree: Tree) given (ctx: Context): Option[(Term, Int, Type)] = // TODO homogenize order of parameters - kernel.matchSelectOuter(tree).map(x => (x.qualifier, x.level, x.tpe)) + internal.matchSelectOuter(tree).map(x => (x.qualifier, x.level, x.tpe)) } implicit class SelectOuterAPI(self: SelectOuter) { - def qualifier given (ctx: Context): Term = kernel.SelectOuter_qualifier(self) - def level given (ctx: Context): Int = kernel.SelectOuter_level(self) - def tpe given (ctx: Context): Type = kernel.SelectOuter_tpe(self) + def qualifier given (ctx: Context): Term = internal.SelectOuter_qualifier(self) + def level given (ctx: Context): Int = internal.SelectOuter_level(self) + def tpe given (ctx: Context): Type = internal.SelectOuter_tpe(self) } object IsWhile { /** Matches any While and returns it */ - def unapply(tree: Tree) given (ctx: Context): Option[While] = kernel.matchWhile(tree) + def unapply(tree: Tree) given (ctx: Context): Option[While] = internal.matchWhile(tree) } object While { /** Creates a while loop `while () ` and returns (, ) */ def apply(cond: Term, body: Term) given (ctx: Context): While = - kernel.While_apply(cond, body) + internal.While_apply(cond, body) def copy(original: Tree)(cond: Term, body: Term) given (ctx: Context): While = - kernel.While_copy(original)(cond, body) + internal.While_copy(original)(cond, body) /** Extractor for while loops. Matches `while () ` and returns (, ) */ def unapply(tree: Tree) given (ctx: Context): Option[(Term, Term)] = - kernel.matchWhile(tree).map(x => (x.cond, x.body)) + internal.matchWhile(tree).map(x => (x.cond, x.body)) } implicit class WhileAPI(self: While) { - def cond given (ctx: Context): Term = kernel.While_cond(self) - def body given (ctx: Context): Term = kernel.While_body(self) + def cond given (ctx: Context): Term = internal.While_cond(self) + def body given (ctx: Context): Term = internal.While_body(self) } // ----- TypeTrees ------------------------------------------------ implicit class TypeTreeAPI(self: TypeTree) { /** Position in the source code */ - def pos given (ctx: Context): Position = kernel.TypeTree_pos(self) + def pos given (ctx: Context): Position = internal.TypeTree_pos(self) /** Type of this type tree */ - def tpe given (ctx: Context): Type = kernel.TypeTree_tpe(self) + def tpe given (ctx: Context): Type = internal.TypeTree_tpe(self) /** Symbol of this type tree */ - def symbol given (ctx: Context): Symbol = kernel.TypeTree_symbol(self) + def symbol given (ctx: Context): Symbol = internal.TypeTree_symbol(self) } object IsTypeTree { def unapply(tpt: Tree) given (ctx: Context): Option[TypeTree] = - kernel.matchTypeTree(tpt) + internal.matchTypeTree(tpt) } object IsInferred { /** Matches any Inferred and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[Inferred] = - kernel.matchInferred(tree) + internal.matchInferred(tree) } /** TypeTree containing an inferred type */ object Inferred { def apply(tpe: Type) given (ctx: Context): Inferred = - kernel.Inferred_apply(tpe) + internal.Inferred_apply(tpe) /** Matches a TypeTree containing an inferred type */ def unapply(tree: Tree) given (ctx: Context): Boolean = - kernel.matchInferred(tree).isDefined + internal.matchInferred(tree).isDefined } object IsTypeIdent { /** Matches any TypeIdent and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[TypeIdent] = - kernel.matchTypeIdent(tree) + internal.matchTypeIdent(tree) } implicit class TypeIdentAPI(self: TypeIdent) { - def name given (ctx: Context): String = kernel.TypeIdent_name(self) + def name given (ctx: Context): String = internal.TypeIdent_name(self) } object TypeIdent { // TODO def apply(name: String) given (ctx: Context): TypeIdent def copy(original: TypeIdent)(name: String) given (ctx: Context): TypeIdent = - kernel.TypeIdent_copy(original)(name) + internal.TypeIdent_copy(original)(name) def unapply(tree: Tree) given (ctx: Context): Option[String] = - kernel.matchTypeIdent(tree).map(_.name) + internal.matchTypeIdent(tree).map(_.name) } object IsTypeSelect { /** Matches any TypeSelect and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[TypeSelect] = - kernel.matchTypeSelect(tree) + internal.matchTypeSelect(tree) } object TypeSelect { def apply(qualifier: Term, name: String) given (ctx: Context): TypeSelect = - kernel.TypeSelect_apply(qualifier, name) + internal.TypeSelect_apply(qualifier, name) def copy(original: TypeSelect)(qualifier: Term, name: String) given (ctx: Context): TypeSelect = - kernel.TypeSelect_copy(original)(qualifier, name) + internal.TypeSelect_copy(original)(qualifier, name) def unapply(tree: Tree) given (ctx: Context): Option[(Term, String)] = - kernel.matchTypeSelect(tree).map(x => (x.qualifier, x.name)) + internal.matchTypeSelect(tree).map(x => (x.qualifier, x.name)) } implicit class TypeSelectAPI(self: TypeSelect) { - def qualifier given (ctx: Context): Term = kernel.TypeSelect_qualifier(self) - def name given (ctx: Context): String = kernel.TypeSelect_name(self) + def qualifier given (ctx: Context): Term = internal.TypeSelect_qualifier(self) + def name given (ctx: Context): String = internal.TypeSelect_name(self) } object IsProjection { /** Matches any Projection and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[Projection] = - kernel.matchProjection(tree) + internal.matchProjection(tree) } object Projection { // TODO def apply(qualifier: TypeTree, name: String) given (ctx: Context): Project def copy(original: Projection)(qualifier: TypeTree, name: String) given (ctx: Context): Projection = - kernel.Projection_copy(original)(qualifier, name) + internal.Projection_copy(original)(qualifier, name) def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, String)] = - kernel.matchProjection(tree).map(x => (x.qualifier, x.name)) + internal.matchProjection(tree).map(x => (x.qualifier, x.name)) } implicit class ProjectionAPI(self: Projection) { - def qualifier given (ctx: Context): TypeTree = kernel.Projection_qualifier(self) - def name given (ctx: Context): String = kernel.Projection_name(self) + def qualifier given (ctx: Context): TypeTree = internal.Projection_qualifier(self) + def name given (ctx: Context): String = internal.Projection_name(self) } object IsSingleton { /** Matches any Singleton and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[Singleton] = - kernel.matchSingleton(tree) + internal.matchSingleton(tree) } object Singleton { def apply(ref: Term) given (ctx: Context): Singleton = - kernel.Singleton_apply(ref) + internal.Singleton_apply(ref) def copy(original: Singleton)(ref: Term) given (ctx: Context): Singleton = - kernel.Singleton_copy(original)(ref) + internal.Singleton_copy(original)(ref) def unapply(tree: Tree) given (ctx: Context): Option[Term] = - kernel.matchSingleton(tree).map(_.ref) + internal.matchSingleton(tree).map(_.ref) } implicit class SingletonAPI(self: Singleton) { - def ref given (ctx: Context): Term = kernel.Singleton_ref(self) + def ref given (ctx: Context): Term = internal.Singleton_ref(self) } object IsRefined { /** Matches any Refined and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[Refined] = - kernel.matchRefined(tree) + internal.matchRefined(tree) } object Refined { // TODO def apply(tpt: TypeTree, refinements: List[Definition]) given (ctx: Context): Refined def copy(original: Refined)(tpt: TypeTree, refinements: List[Definition]) given (ctx: Context): Refined = - kernel.Refined_copy(original)(tpt, refinements) + internal.Refined_copy(original)(tpt, refinements) def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, List[Definition])] = - kernel.matchRefined(tree).map(x => (x.tpt, x.refinements)) + internal.matchRefined(tree).map(x => (x.tpt, x.refinements)) } implicit class RefinedAPI(self: Refined) { - def tpt given (ctx: Context): TypeTree = kernel.Refined_tpt(self) - def refinements given (ctx: Context): List[Definition] = kernel.Refined_refinements(self) + def tpt given (ctx: Context): TypeTree = internal.Refined_tpt(self) + def refinements given (ctx: Context): List[Definition] = internal.Refined_refinements(self) } object IsApplied { /** Matches any Applied and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[Applied] = - kernel.matchApplied(tree) + internal.matchApplied(tree) } object Applied { def apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/]) given (ctx: Context): Applied = - kernel.Applied_apply(tpt, args) + internal.Applied_apply(tpt, args) def copy(original: Applied)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/]) given (ctx: Context): Applied = - kernel.Applied_copy(original)(tpt, args) + internal.Applied_copy(original)(tpt, args) def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, List[Tree /*TypeTree | TypeBoundsTree*/])] = - kernel.matchApplied(tree).map(x => (x.tpt, x.args)) + internal.matchApplied(tree).map(x => (x.tpt, x.args)) } implicit class AppliedAPI(self: Applied) { - def tpt given (ctx: Context): TypeTree = kernel.Applied_tpt(self) - def args given (ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] = kernel.Applied_args(self) + def tpt given (ctx: Context): TypeTree = internal.Applied_tpt(self) + def args given (ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] = internal.Applied_args(self) } object IsAnnotated { /** Matches any Annotated and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[Annotated] = - kernel.matchAnnotated(tree) + internal.matchAnnotated(tree) } object Annotated { def apply(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = - kernel.Annotated_apply(arg, annotation) + internal.Annotated_apply(arg, annotation) def copy(original: Annotated)(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = - kernel.Annotated_copy(original)(arg, annotation) + internal.Annotated_copy(original)(arg, annotation) def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, Term)] = - kernel.matchAnnotated(tree).map(x => (x.arg, x.annotation)) + internal.matchAnnotated(tree).map(x => (x.arg, x.annotation)) } implicit class AnnotatedAPI(self: Annotated) { - def arg given (ctx: Context): TypeTree = kernel.Annotated_arg(self) - def annotation given (ctx: Context): Term = kernel.Annotated_annotation(self) + def arg given (ctx: Context): TypeTree = internal.Annotated_arg(self) + def annotation given (ctx: Context): Term = internal.Annotated_annotation(self) } object IsMatchTypeTree { /** Matches any MatchTypeTree and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[MatchTypeTree] = - kernel.matchMatchTypeTree(tree) + internal.matchMatchTypeTree(tree) } object MatchTypeTree { def apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree = - kernel.MatchTypeTree_apply(bound, selector, cases) + internal.MatchTypeTree_apply(bound, selector, cases) def copy(original: MatchTypeTree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree = - kernel.MatchTypeTree_copy(original)(bound, selector, cases) + internal.MatchTypeTree_copy(original)(bound, selector, cases) def unapply(tree: Tree) given (ctx: Context): Option[(Option[TypeTree], TypeTree, List[TypeCaseDef])] = - kernel.matchMatchTypeTree(tree).map(x => (x.bound, x.selector, x.cases)) + internal.matchMatchTypeTree(tree).map(x => (x.bound, x.selector, x.cases)) } implicit class MatchTypeTreeAPI(self: MatchTypeTree) { - def bound given (ctx: Context): Option[TypeTree] = kernel.MatchTypeTree_bound(self) - def selector given (ctx: Context): TypeTree = kernel.MatchTypeTree_selector(self) - def cases given (ctx: Context): List[TypeCaseDef] = kernel.MatchTypeTree_cases(self) + def bound given (ctx: Context): Option[TypeTree] = internal.MatchTypeTree_bound(self) + def selector given (ctx: Context): TypeTree = internal.MatchTypeTree_selector(self) + def cases given (ctx: Context): List[TypeCaseDef] = internal.MatchTypeTree_cases(self) } object IsByName { /** Matches any ByName and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[ByName] = - kernel.matchByName(tree) + internal.matchByName(tree) } object ByName { def apply(result: TypeTree) given (ctx: Context): ByName = - kernel.ByName_apply(result) + internal.ByName_apply(result) def copy(original: ByName)(result: TypeTree) given (ctx: Context): ByName = - kernel.ByName_copy(original)(result) + internal.ByName_copy(original)(result) def unapply(tree: Tree) given (ctx: Context): Option[TypeTree] = - kernel.matchByName(tree).map(_.result) + internal.matchByName(tree).map(_.result) } implicit class ByNameAPI(self: ByName) { - def result given (ctx: Context): TypeTree = kernel.ByName_result(self) + def result given (ctx: Context): TypeTree = internal.ByName_result(self) } object IsLambdaTypeTree { /** Matches any LambdaTypeTree and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[LambdaTypeTree] = - kernel.matchLambdaTypeTree(tree) + internal.matchLambdaTypeTree(tree) } object LambdaTypeTree { def apply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): LambdaTypeTree = - kernel.Lambdaapply(tparams, body) + internal.Lambdaapply(tparams, body) def copy(original: LambdaTypeTree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): LambdaTypeTree = - kernel.Lambdacopy(original)(tparams, body) + internal.Lambdacopy(original)(tparams, body) def unapply(tree: Tree) given (ctx: Context): Option[(List[TypeDef], Tree /*TypeTree | TypeBoundsTree*/)] = - kernel.matchLambdaTypeTree(tree).map(x => (x.tparams, x.body)) + internal.matchLambdaTypeTree(tree).map(x => (x.tparams, x.body)) } implicit class LambdaTypeTreeAPI(self: LambdaTypeTree) { - def tparams given (ctx: Context): List[TypeDef] = kernel.Lambdatparams(self) - def body given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.Lambdabody(self) + def tparams given (ctx: Context): List[TypeDef] = internal.Lambdatparams(self) + def body given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.Lambdabody(self) } object IsTypeBind { /** Matches any TypeBind and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[TypeBind] = - kernel.matchTypeBind(tree) + internal.matchTypeBind(tree) } object TypeBind { // TODO def apply(name: String, tree: Tree) given (ctx: Context): TypeBind def copy(original: TypeBind)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): TypeBind = - kernel.TypeBind_copy(original)(name, tpt) + internal.TypeBind_copy(original)(name, tpt) def unapply(tree: Tree) given (ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/)] = - kernel.matchTypeBind(tree).map(x => (x.name, x.body)) + internal.matchTypeBind(tree).map(x => (x.name, x.body)) } implicit class TypeBindAPI(self: TypeBind) { - def name given (ctx: Context): String = kernel.TypeBind_name(self) - def body given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.TypeBind_body(self) + def name given (ctx: Context): String = internal.TypeBind_name(self) + def body given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.TypeBind_body(self) } object IsTypeBlock { /** Matches any TypeBlock and returns it */ def unapply(tree: Tree) given (ctx: Context): Option[TypeBlock] = - kernel.matchTypeBlock(tree) + internal.matchTypeBlock(tree) } object TypeBlock { def apply(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = - kernel.TypeBlock_apply(aliases, tpt) + internal.TypeBlock_apply(aliases, tpt) def copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = - kernel.TypeBlock_copy(original)(aliases, tpt) + internal.TypeBlock_copy(original)(aliases, tpt) def unapply(tree: Tree) given (ctx: Context): Option[(List[TypeDef], TypeTree)] = - kernel.matchTypeBlock(tree).map(x => (x.aliases, x.tpt)) + internal.matchTypeBlock(tree).map(x => (x.aliases, x.tpt)) } implicit class TypeBlockAPI(self: TypeBlock) { - def aliases given (ctx: Context): List[TypeDef] = kernel.TypeBlock_aliases(self) - def tpt given (ctx: Context): TypeTree = kernel.TypeBlock_tpt(self) + def aliases given (ctx: Context): List[TypeDef] = internal.TypeBlock_aliases(self) + def tpt given (ctx: Context): TypeTree = internal.TypeBlock_tpt(self) } // ----- TypeBoundsTrees ------------------------------------------------ implicit class TypeBoundsTreeAPI(self: TypeBoundsTree) { - def tpe given (ctx: Context): TypeBounds = kernel.TypeBoundsTree_tpe(self) - def low given (ctx: Context): TypeTree = kernel.TypeBoundsTree_low(self) - def hi given (ctx: Context): TypeTree = kernel.TypeBoundsTree_hi(self) + def tpe given (ctx: Context): TypeBounds = internal.TypeBoundsTree_tpe(self) + def low given (ctx: Context): TypeTree = internal.TypeBoundsTree_low(self) + def hi given (ctx: Context): TypeTree = internal.TypeBoundsTree_hi(self) } object IsTypeBoundsTree { def unapply(tree: Tree) given (ctx: Context): Option[TypeBoundsTree] = - kernel.matchTypeBoundsTree(tree) + internal.matchTypeBoundsTree(tree) } object TypeBoundsTree { def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, TypeTree)] = - kernel.matchTypeBoundsTree(tree).map(x => (x.low, x.hi)) + internal.matchTypeBoundsTree(tree).map(x => (x.low, x.hi)) } implicit class WildcardTypeTreeAPI(self: WildcardTypeTree) { - def tpe given (ctx: Context): TypeOrBounds = kernel.WildcardTypeTree_tpe(self) + def tpe given (ctx: Context): TypeOrBounds = internal.WildcardTypeTree_tpe(self) } object IsWildcardTypeTree { def unapply(tree: Tree) given (ctx: Context): Option[WildcardTypeTree] = - kernel.matchWildcardTypeTree(tree) + internal.matchWildcardTypeTree(tree) } /** TypeBoundsTree containing wildcard type bounds */ object WildcardTypeTree { /** Matches a TypeBoundsTree containing wildcard type bounds */ def unapply(tree: Tree) given (ctx: Context): Boolean = - kernel.matchWildcardTypeTree(tree).isDefined + internal.matchWildcardTypeTree(tree).isDefined } // ----- CaseDefs ------------------------------------------------ implicit class CaseDefAPI(caseDef: CaseDef) { - def pattern given (ctx: Context): Pattern = kernel.CaseDef_pattern(caseDef) - def guard given (ctx: Context): Option[Term] = kernel.CaseDef_guard(caseDef) - def rhs given (ctx: Context): Term = kernel.CaseDef_rhs(caseDef) + def pattern given (ctx: Context): Pattern = internal.CaseDef_pattern(caseDef) + def guard given (ctx: Context): Option[Term] = internal.CaseDef_guard(caseDef) + def rhs given (ctx: Context): Term = internal.CaseDef_rhs(caseDef) } object IsCaseDef { def unapply(self: Tree) given (ctx: Context): Option[CaseDef] = - kernel.matchCaseDef(self) + internal.matchCaseDef(self) } object CaseDef { def apply(pattern: Pattern, guard: Option[Term], rhs: Term) given (ctx: Context): CaseDef = - kernel.CaseDef_module_apply(pattern, guard, rhs) + internal.CaseDef_module_apply(pattern, guard, rhs) def copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], rhs: Term) given (ctx: Context): CaseDef = - kernel.CaseDef_module_copy(original)(pattern, guard, rhs) + internal.CaseDef_module_copy(original)(pattern, guard, rhs) def unapply(tree: Tree) given (ctx: Context): Option[(Pattern, Option[Term], Term)] = - kernel.matchCaseDef(tree).map( x => (x.pattern, x.guard, x.rhs)) + internal.matchCaseDef(tree).map( x => (x.pattern, x.guard, x.rhs)) } implicit class TypeCaseDefAPI(caseDef: TypeCaseDef) { - def pattern given (ctx: Context): TypeTree = kernel.TypeCaseDef_pattern(caseDef) - def rhs given (ctx: Context): TypeTree = kernel.TypeCaseDef_rhs(caseDef) + def pattern given (ctx: Context): TypeTree = internal.TypeCaseDef_pattern(caseDef) + def rhs given (ctx: Context): TypeTree = internal.TypeCaseDef_rhs(caseDef) } object IsTypeCaseDef { def unapply(self: Tree) given (ctx: Context): Option[TypeCaseDef] = - kernel.matchTypeCaseDef(self) + internal.matchTypeCaseDef(self) } object TypeCaseDef { def apply(pattern: TypeTree, rhs: TypeTree) given (ctx: Context): TypeCaseDef = - kernel.TypeCaseDef_module_apply(pattern, rhs) + internal.TypeCaseDef_module_apply(pattern, rhs) def copy(original: TypeCaseDef)(pattern: TypeTree, rhs: TypeTree) given (ctx: Context): TypeCaseDef = - kernel.TypeCaseDef_module_copy(original)(pattern, rhs) + internal.TypeCaseDef_module_copy(original)(pattern, rhs) def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, TypeTree)] = - kernel.matchTypeCaseDef(tree).map( x => (x.pattern, x.rhs)) + internal.matchTypeCaseDef(tree).map( x => (x.pattern, x.rhs)) } } diff --git a/library/src/scala/tasty/reflect/TypeOrBoundsOps.scala b/library/src/scala/tasty/reflect/TypeOrBoundsOps.scala index 2c7b6eb09a89..78adc34f6e8d 100644 --- a/library/src/scala/tasty/reflect/TypeOrBoundsOps.scala +++ b/library/src/scala/tasty/reflect/TypeOrBoundsOps.scala @@ -8,24 +8,24 @@ trait TypeOrBoundsOps extends Core { def typeOf[T: scala.quoted.Type]: Type implicit class TypeAPI(self: Type) { - def =:=(that: Type) given (ctx: Context): Boolean = kernel.`Type_=:=`(self)(that) - def <:<(that: Type) given (ctx: Context): Boolean = kernel.`Type_<:<`(self)(that) - def widen given (ctx: Context): Type = kernel.Type_widen(self) + def =:=(that: Type) given (ctx: Context): Boolean = internal.`Type_=:=`(self)(that) + def <:<(that: Type) given (ctx: Context): Boolean = internal.`Type_<:<`(self)(that) + def widen given (ctx: Context): Type = internal.Type_widen(self) /** Follow aliases and dereferences LazyRefs, annotated types and instantiated * TypeVars until type is no longer alias type, annotated type, LazyRef, * or instantiated type variable. */ - def dealias given (ctx: Context): Type = kernel.Type_dealias(self) + def dealias given (ctx: Context): Type = internal.Type_dealias(self) - def classSymbol given (ctx: Context): Option[ClassDefSymbol] = kernel.Type_classSymbol(self) - def typeSymbol given (ctx: Context): Symbol = kernel.Type_typeSymbol(self) - def isSingleton given (ctx: Context): Boolean = kernel.Type_isSingleton(self) - def memberType(member: Symbol) given (ctx: Context): Type = kernel.Type_memberType(self)(member) + def classSymbol given (ctx: Context): Option[ClassDefSymbol] = internal.Type_classSymbol(self) + def typeSymbol given (ctx: Context): Symbol = internal.Type_typeSymbol(self) + def isSingleton given (ctx: Context): Boolean = internal.Type_isSingleton(self) + def memberType(member: Symbol) given (ctx: Context): Type = internal.Type_memberType(self)(member) /** Is this type an instance of a non-bottom subclass of the given class `cls`? */ def derivesFrom(cls: ClassDefSymbol) given (ctx: Context): Boolean = - kernel.Type_derivesFrom(self)(cls) + internal.Type_derivesFrom(self)(cls) /** Is this type a function type? * @@ -36,368 +36,368 @@ trait TypeOrBoundsOps extends Core { * - returns true for `given Int => Int` and `erased Int => Int` * - returns false for `List[Int]`, despite that `List[Int] <:< Int => Int`. */ - def isFunctionType given (ctx: Context): Boolean = kernel.Type_isFunctionType(self) + def isFunctionType given (ctx: Context): Boolean = internal.Type_isFunctionType(self) /** Is this type an implicit function type? * * @see `isFunctionType` */ - def isImplicitFunctionType given (ctx: Context): Boolean = kernel.Type_isImplicitFunctionType(self) + def isImplicitFunctionType given (ctx: Context): Boolean = internal.Type_isImplicitFunctionType(self) /** Is this type an erased function type? * * @see `isFunctionType` */ - def isErasedFunctionType given (ctx: Context): Boolean = kernel.Type_isErasedFunctionType(self) + def isErasedFunctionType given (ctx: Context): Boolean = internal.Type_isErasedFunctionType(self) /** Is this type a dependent function type? * * @see `isFunctionType` */ - def isDependentFunctionType given (ctx: Context): Boolean = kernel.Type_isDependentFunctionType(self) + def isDependentFunctionType given (ctx: Context): Boolean = internal.Type_isDependentFunctionType(self) } object IsType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Type] = - kernel.matchType(typeOrBounds) + internal.matchType(typeOrBounds) } object Type { - def apply(clazz: Class[_]) given (ctx: Context): Type = kernel.Type_apply(clazz) + def apply(clazz: Class[_]) given (ctx: Context): Type = internal.Type_apply(clazz) object IsConstantType { /** Matches any ConstantType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[ConstantType] = - kernel.matchConstantType(tpe) + internal.matchConstantType(tpe) } object ConstantType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Constant] = - kernel.matchConstantType(typeOrBounds).map(_.constant) + internal.matchConstantType(typeOrBounds).map(_.constant) } object IsSymRef { /** Matches any SymRef and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[SymRef] = - kernel.matchSymRef(tpe) + internal.matchSymRef(tpe) } object SymRef { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Symbol, TypeOrBounds /* Type | NoPrefix */)] = - kernel.matchSymRef_unapply(typeOrBounds) + internal.matchSymRef_unapply(typeOrBounds) } object IsTermRef { /** Matches any TermRef and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[TermRef] = - kernel.matchTermRef(tpe) + internal.matchTermRef(tpe) } object TermRef { // TODO should qual be a Type? def apply(qual: TypeOrBounds, name: String) given (ctx: Context): TermRef = - kernel.TermRef_apply(qual, name) + internal.TermRef_apply(qual, name) def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(String, TypeOrBounds /* Type | NoPrefix */)] = - kernel.matchTermRef(typeOrBounds).map(x => (x.name, x.qualifier)) + internal.matchTermRef(typeOrBounds).map(x => (x.name, x.qualifier)) } object IsTypeRef { /** Matches any TypeRef and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[TypeRef] = - kernel.matchTypeRef(tpe) + internal.matchTypeRef(tpe) } object TypeRef { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(String, TypeOrBounds /* Type | NoPrefix */)] = - kernel.matchTypeRef(typeOrBounds).map(x => (x.name, x.qualifier)) + internal.matchTypeRef(typeOrBounds).map(x => (x.name, x.qualifier)) } object IsSuperType { /** Matches any SuperType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[SuperType] = - kernel.matchSuperType(tpe) + internal.matchSuperType(tpe) } object SuperType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type)] = - kernel.matchSuperType(typeOrBounds).map(x => (x.thistpe, x.supertpe)) + internal.matchSuperType(typeOrBounds).map(x => (x.thistpe, x.supertpe)) } object IsRefinement { /** Matches any Refinement and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[Refinement] = - kernel.matchRefinement(tpe) + internal.matchRefinement(tpe) } object Refinement { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, String, TypeOrBounds /* Type | TypeBounds */)] = - kernel.matchRefinement(typeOrBounds).map(x => (x.parent, x.name, x.info)) + internal.matchRefinement(typeOrBounds).map(x => (x.parent, x.name, x.info)) } object IsAppliedType { /** Matches any AppliedType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[AppliedType] = - kernel.matchAppliedType(tpe) + internal.matchAppliedType(tpe) } object AppliedType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, List[TypeOrBounds /* Type | TypeBounds */])] = - kernel.matchAppliedType(typeOrBounds).map(x => (x.tycon, x.args)) + internal.matchAppliedType(typeOrBounds).map(x => (x.tycon, x.args)) } object IsAnnotatedType { /** Matches any AnnotatedType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[AnnotatedType] = - kernel.matchAnnotatedType(tpe) + internal.matchAnnotatedType(tpe) } object AnnotatedType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Term)] = - kernel.matchAnnotatedType(typeOrBounds).map(x => (x.underlying, x.annot)) + internal.matchAnnotatedType(typeOrBounds).map(x => (x.underlying, x.annot)) } object IsAndType { /** Matches any AndType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[AndType] = - kernel.matchAndType(tpe) + internal.matchAndType(tpe) } object AndType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type)] = - kernel.matchAndType(typeOrBounds).map(x => (x.left, x.right)) + internal.matchAndType(typeOrBounds).map(x => (x.left, x.right)) } object IsOrType { /** Matches any OrType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[OrType] = - kernel.matchOrType(tpe) + internal.matchOrType(tpe) } object OrType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type)] = - kernel.matchOrType(typeOrBounds).map(x => (x.left, x.right)) + internal.matchOrType(typeOrBounds).map(x => (x.left, x.right)) } object IsMatchType { /** Matches any MatchType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[MatchType] = - kernel.matchMatchType(tpe) + internal.matchMatchType(tpe) } object MatchType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type, List[Type])] = - kernel.matchMatchType(typeOrBounds).map(x => (x.bound, x.scrutinee, x.cases)) + internal.matchMatchType(typeOrBounds).map(x => (x.bound, x.scrutinee, x.cases)) } object IsByNameType { /** Matches any ByNameType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[ByNameType] = - kernel.matchByNameType(tpe) + internal.matchByNameType(tpe) } object ByNameType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Type] = - kernel.matchByNameType(typeOrBounds).map(_.underlying) + internal.matchByNameType(typeOrBounds).map(_.underlying) } object IsParamRef { /** Matches any ParamRef and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[ParamRef] = - kernel.matchParamRef(tpe) + internal.matchParamRef(tpe) } object ParamRef { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(LambdaType[TypeOrBounds], Int)] = - kernel.matchParamRef(typeOrBounds).map(x => (x.binder, x.paramNum)) + internal.matchParamRef(typeOrBounds).map(x => (x.binder, x.paramNum)) } object IsThisType { /** Matches any ThisType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[ThisType] = - kernel.matchThisType(tpe) + internal.matchThisType(tpe) } object ThisType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Type] = - kernel.matchThisType(typeOrBounds).map(_.tref) + internal.matchThisType(typeOrBounds).map(_.tref) } object IsRecursiveThis { /** Matches any RecursiveThis and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveThis] = - kernel.matchRecursiveThis(tpe) + internal.matchRecursiveThis(tpe) } object RecursiveThis { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[RecursiveType] = - kernel.matchRecursiveThis(typeOrBounds).map(_.binder) + internal.matchRecursiveThis(typeOrBounds).map(_.binder) } object IsRecursiveType { /** Matches any RecursiveType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveType] = - kernel.matchRecursiveType(tpe) + internal.matchRecursiveType(tpe) } object RecursiveType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Type] = - kernel.matchRecursiveType(typeOrBounds).map(_.underlying) + internal.matchRecursiveType(typeOrBounds).map(_.underlying) } object IsMethodType { /** Matches any MethodType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[MethodType] = - kernel.matchMethodType(tpe) + internal.matchMethodType(tpe) } object MethodType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(List[String], List[Type], Type)] = - kernel.matchMethodType(typeOrBounds).map(x => (x.paramNames, x.paramTypes, x.resType)) + internal.matchMethodType(typeOrBounds).map(x => (x.paramNames, x.paramTypes, x.resType)) } object IsPolyType { /** Matches any PolyType and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[PolyType] = - kernel.matchPolyType(tpe) + internal.matchPolyType(tpe) } object PolyType { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(List[String], List[TypeBounds], Type)] = - kernel.matchPolyType(typeOrBounds).map(x => (x.paramNames, x.paramBounds, x.resType)) + internal.matchPolyType(typeOrBounds).map(x => (x.paramNames, x.paramBounds, x.resType)) } object IsTypeLambda { /** Matches any TypeLambda and returns it */ def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[TypeLambda] = - kernel.matchTypeLambda(tpe) + internal.matchTypeLambda(tpe) } object TypeLambda { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(List[String], List[TypeBounds], Type)] = - kernel.matchTypeLambda(typeOrBounds).map(x => (x.paramNames, x.paramBounds, x.resType)) + internal.matchTypeLambda(typeOrBounds).map(x => (x.paramNames, x.paramBounds, x.resType)) } } implicit class Type_ConstantTypeAPI(self: ConstantType) { - def constant given (ctx: Context): Constant = kernel.ConstantType_constant(self) + def constant given (ctx: Context): Constant = internal.ConstantType_constant(self) } implicit class Type_SymRefAPI(self: SymRef) { - def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.SymRef_qualifier(self) + def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = internal.SymRef_qualifier(self) } implicit class Type_TermRefAPI(self: TermRef) { - def name given (ctx: Context): String = kernel.TermRef_name(self) - def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.TermRef_qualifier(self) + def name given (ctx: Context): String = internal.TermRef_name(self) + def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = internal.TermRef_qualifier(self) } implicit class Type_TypeRefAPI(self: TypeRef) { - def name given (ctx: Context): String = kernel.TypeRef_name(self) - def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.TypeRef_qualifier(self) + def name given (ctx: Context): String = internal.TypeRef_name(self) + def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = internal.TypeRef_qualifier(self) } implicit class Type_SuperTypeAPI(self: SuperType) { - def thistpe given (ctx: Context): Type = kernel.SuperType_thistpe(self) - def supertpe given (ctx: Context): Type = kernel.SuperType_supertpe(self) + def thistpe given (ctx: Context): Type = internal.SuperType_thistpe(self) + def supertpe given (ctx: Context): Type = internal.SuperType_supertpe(self) } implicit class Type_RefinementAPI(self: Refinement) { - def parent given (ctx: Context): Type = kernel.Refinement_parent(self) - def name given (ctx: Context): String = kernel.Refinement_name(self) - def info given (ctx: Context): TypeOrBounds = kernel.Refinement_info(self) + def parent given (ctx: Context): Type = internal.Refinement_parent(self) + def name given (ctx: Context): String = internal.Refinement_name(self) + def info given (ctx: Context): TypeOrBounds = internal.Refinement_info(self) } implicit class Type_AppliedTypeAPI(self: AppliedType) { - def tycon given (ctx: Context): Type = kernel.AppliedType_tycon(self) - def args given (ctx: Context): List[TypeOrBounds /* Type | TypeBounds */] = kernel.AppliedType_args(self) + def tycon given (ctx: Context): Type = internal.AppliedType_tycon(self) + def args given (ctx: Context): List[TypeOrBounds /* Type | TypeBounds */] = internal.AppliedType_args(self) } implicit class Type_AnnotatedTypeAPI(self: AnnotatedType) { - def underlying given (ctx: Context): Type = kernel.AnnotatedType_underlying(self) - def annot given (ctx: Context): Term = kernel.AnnotatedType_annot(self) + def underlying given (ctx: Context): Type = internal.AnnotatedType_underlying(self) + def annot given (ctx: Context): Term = internal.AnnotatedType_annot(self) } implicit class Type_AndTypeAPI(self: AndType) { - def left given (ctx: Context): Type = kernel.AndType_left(self) - def right given (ctx: Context): Type = kernel.AndType_right(self) + def left given (ctx: Context): Type = internal.AndType_left(self) + def right given (ctx: Context): Type = internal.AndType_right(self) } implicit class Type_OrTypeAPI(self: OrType) { - def left given (ctx: Context): Type = kernel.OrType_left(self) - def right given (ctx: Context): Type = kernel.OrType_right(self) + def left given (ctx: Context): Type = internal.OrType_left(self) + def right given (ctx: Context): Type = internal.OrType_right(self) } implicit class Type_MatchTypeAPI(self: MatchType) { - def bound given (ctx: Context): Type = kernel.MatchType_bound(self) - def scrutinee given (ctx: Context): Type = kernel.MatchType_scrutinee(self) - def cases given (ctx: Context): List[Type] = kernel.MatchType_cases(self) + def bound given (ctx: Context): Type = internal.MatchType_bound(self) + def scrutinee given (ctx: Context): Type = internal.MatchType_scrutinee(self) + def cases given (ctx: Context): List[Type] = internal.MatchType_cases(self) } implicit class Type_ByNameTypeAPI(self: ByNameType) { - def underlying given (ctx: Context): Type = kernel.ByNameType_underlying(self) + def underlying given (ctx: Context): Type = internal.ByNameType_underlying(self) } implicit class Type_ParamRefAPI(self: ParamRef) { - def binder given (ctx: Context): LambdaType[TypeOrBounds] = kernel.ParamRef_binder(self) - def paramNum given (ctx: Context): Int = kernel.ParamRef_paramNum(self) + def binder given (ctx: Context): LambdaType[TypeOrBounds] = internal.ParamRef_binder(self) + def paramNum given (ctx: Context): Int = internal.ParamRef_paramNum(self) } implicit class Type_ThisTypeAPI(self: ThisType) { - def tref given (ctx: Context): Type = kernel.ThisType_tref(self) + def tref given (ctx: Context): Type = internal.ThisType_tref(self) } implicit class Type_RecursiveThisAPI(self: RecursiveThis) { - def binder given (ctx: Context): RecursiveType = kernel.RecursiveThis_binder(self) + def binder given (ctx: Context): RecursiveType = internal.RecursiveThis_binder(self) } implicit class Type_RecursiveTypeAPI(self: RecursiveType) { - def underlying given (ctx: Context): Type = kernel.RecursiveType_underlying(self) + def underlying given (ctx: Context): Type = internal.RecursiveType_underlying(self) } implicit class Type_MethodTypeAPI(self: MethodType) { - def isImplicit: Boolean = kernel.MethodType_isImplicit(self) - def isErased: Boolean = kernel.MethodType_isErased(self) - def paramNames given (ctx: Context): List[String] = kernel.MethodType_paramNames(self) - def paramTypes given (ctx: Context): List[Type] = kernel.MethodType_paramTypes(self) - def resType given (ctx: Context): Type = kernel.MethodType_resType(self) + def isImplicit: Boolean = internal.MethodType_isImplicit(self) + def isErased: Boolean = internal.MethodType_isErased(self) + def paramNames given (ctx: Context): List[String] = internal.MethodType_paramNames(self) + def paramTypes given (ctx: Context): List[Type] = internal.MethodType_paramTypes(self) + def resType given (ctx: Context): Type = internal.MethodType_resType(self) } implicit class Type_PolyTypeAPI(self: PolyType) { - def paramNames given (ctx: Context): List[String] = kernel.PolyType_paramNames(self) - def paramBounds given (ctx: Context): List[TypeBounds] = kernel.PolyType_paramBounds(self) - def resType given (ctx: Context): Type = kernel.PolyType_resType(self) + def paramNames given (ctx: Context): List[String] = internal.PolyType_paramNames(self) + def paramBounds given (ctx: Context): List[TypeBounds] = internal.PolyType_paramBounds(self) + def resType given (ctx: Context): Type = internal.PolyType_resType(self) } implicit class Type_TypeLambdaAPI(self: TypeLambda) { - def paramNames given (ctx: Context): List[String] = kernel.TypeLambda_paramNames(self) - def paramBounds given (ctx: Context): List[TypeBounds] = kernel.TypeLambda_paramBounds(self) - def resType given (ctx: Context): Type = kernel.TypeLambda_resType(self) + def paramNames given (ctx: Context): List[String] = internal.TypeLambda_paramNames(self) + def paramBounds given (ctx: Context): List[TypeBounds] = internal.TypeLambda_paramBounds(self) + def resType given (ctx: Context): Type = internal.TypeLambda_resType(self) } // ----- TypeBounds ----------------------------------------------- object IsTypeBounds { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[TypeBounds] = - kernel.matchTypeBounds(typeOrBounds) + internal.matchTypeBounds(typeOrBounds) } object TypeBounds { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type)] = - kernel.matchTypeBounds(typeOrBounds).map(x => (x.low, x.hi)) + internal.matchTypeBounds(typeOrBounds).map(x => (x.low, x.hi)) } implicit class TypeBoundsAPI(self: TypeBounds) { - def low given (ctx: Context): Type = kernel.TypeBounds_low(self) - def hi given (ctx: Context): Type = kernel.TypeBounds_hi(self) + def low given (ctx: Context): Type = internal.TypeBounds_low(self) + def hi given (ctx: Context): Type = internal.TypeBounds_hi(self) } // ----- NoPrefix ------------------------------------------------- object NoPrefix { def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Boolean = - kernel.matchNoPrefix(typeOrBounds).isDefined + internal.matchNoPrefix(typeOrBounds).isDefined } }