diff --git a/community-build/community-projects/semanticdb b/community-build/community-projects/semanticdb index f34172a4e446..136ea646f10a 160000 --- a/community-build/community-projects/semanticdb +++ b/community-build/community-projects/semanticdb @@ -1 +1 @@ -Subproject commit f34172a4e4463b367003890eb7a04a7a06cfc3aa +Subproject commit 136ea646f10a4c830bccc3745790f265c87fd29a diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala index a529b69ff751..146f74db64cd 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionImpl.scala @@ -21,7 +21,7 @@ object ReflectionImpl { val syntaxHighlight = if (ctx.settings.color.value == "always") SyntaxHighlight.ANSI else SyntaxHighlight.plain - new refl.SourceCodePrinter(syntaxHighlight).showTree(reflTree)(reflCtx) + new refl.SourceCodePrinter(syntaxHighlight).showTree(reflTree) given reflCtx } } diff --git a/library/src/scala/tasty/Reflection.scala b/library/src/scala/tasty/Reflection.scala index 7d56751dff4e..c8f1bf8f8b0b 100644 --- a/library/src/scala/tasty/Reflection.scala +++ b/library/src/scala/tasty/Reflection.scala @@ -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)(ctx) + def typeChecks(code: String)(implicit ctx: Context): Boolean = kernel.typeChecks(code) } // TODO integrate with TreeUtils diff --git a/library/src/scala/tasty/reflect/ConstantOps.scala b/library/src/scala/tasty/reflect/ConstantOps.scala index dbfc3c25d638..58cae3bb2129 100644 --- a/library/src/scala/tasty/reflect/ConstantOps.scala +++ b/library/src/scala/tasty/reflect/ConstantOps.scala @@ -19,7 +19,7 @@ trait ConstantOps extends Core { /** Module of ClassTag literals */ object ClassTag { /** scala.reflect.ClassTag literal */ - def apply[T](implicit x: Type): Constant = + def apply[T] given (x: Type): Constant = kernel.Constant_ClassTag_apply(x) /** Extractor for ClassTag literals */ diff --git a/library/src/scala/tasty/reflect/IdOps.scala b/library/src/scala/tasty/reflect/IdOps.scala index b7f79340840d..8bd1ebc00a00 100644 --- a/library/src/scala/tasty/reflect/IdOps.scala +++ b/library/src/scala/tasty/reflect/IdOps.scala @@ -6,15 +6,15 @@ trait IdOps extends Core { implicit class IdAPI(id: Id) { /** Position in the source code */ - def pos(implicit ctx: Context): Position = kernel.Id_pos(id) + def pos given (ctx: Context): Position = kernel.Id_pos(id) /** Name of the identifier */ - def name(implicit ctx: Context): String = kernel.Id_name(id) + def name given (ctx: Context): String = kernel.Id_name(id) } object Id { - def unapply(id: Id)(implicit ctx: Context): Option[String] = Some(id.name) + def unapply(id: Id) given (ctx: Context): Option[String] = Some(id.name) } } diff --git a/library/src/scala/tasty/reflect/ImplicitsOps.scala b/library/src/scala/tasty/reflect/ImplicitsOps.scala index 508fdda60cec..99958a142d75 100644 --- a/library/src/scala/tasty/reflect/ImplicitsOps.scala +++ b/library/src/scala/tasty/reflect/ImplicitsOps.scala @@ -2,39 +2,39 @@ package scala.tasty.reflect trait ImplicitsOps extends Core { - def searchImplicit(tpe: Type)(implicit ctx: Context): ImplicitSearchResult = + def searchImplicit(tpe: Type) given (ctx: Context): ImplicitSearchResult = kernel.searchImplicit(tpe) object IsImplicitSearchSuccess { - def unapply(isr: ImplicitSearchResult)(implicit ctx: Context): Option[ImplicitSearchSuccess] = + def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchSuccess] = kernel.matchImplicitSearchSuccess(isr) } implicit class IsImplicitSearchSuccessAPI(self: ImplicitSearchSuccess) { - def tree(implicit ctx: Context): Term = kernel.ImplicitSearchSuccess_tree(self) + def tree given (ctx: Context): Term = kernel.ImplicitSearchSuccess_tree(self) } object IsImplicitSearchFailure { - def unapply(isr: ImplicitSearchResult)(implicit ctx: Context): Option[ImplicitSearchFailure] = + def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchFailure] = kernel.matchImplicitSearchFailure(isr) } implicit class ImplicitSearchFailureAPI(self: ImplicitSearchFailure) { - def explanation(implicit ctx: Context): String = kernel.ImplicitSearchFailure_explanation(self) + def explanation given (ctx: Context): String = kernel.ImplicitSearchFailure_explanation(self) } object IsDivergingImplicit { - def unapply(isr: ImplicitSearchResult)(implicit ctx: Context): Option[DivergingImplicit] = + def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[DivergingImplicit] = kernel.matchDivergingImplicit(isr) } object IsNoMatchingImplicits { - def unapply(isr: ImplicitSearchResult)(implicit ctx: Context): Option[NoMatchingImplicits] = + def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[NoMatchingImplicits] = kernel.matchNoMatchingImplicits(isr) } object IsAmbiguousImplicits { - def unapply(isr: ImplicitSearchResult)(implicit ctx: Context): Option[AmbiguousImplicits] = + def unapply(isr: ImplicitSearchResult) given (ctx: Context): Option[AmbiguousImplicits] = kernel.matchAmbiguousImplicits(isr) } diff --git a/library/src/scala/tasty/reflect/ImportSelectorOps.scala b/library/src/scala/tasty/reflect/ImportSelectorOps.scala index 19e244fded4b..5dc99bd7c0c0 100644 --- a/library/src/scala/tasty/reflect/ImportSelectorOps.scala +++ b/library/src/scala/tasty/reflect/ImportSelectorOps.scala @@ -4,35 +4,35 @@ package reflect trait ImportSelectorOps extends Core { implicit class SimpleSelectorAPI(self: SimpleSelector) { - def selection(implicit ctx: Context): Id = + def selection given (ctx: Context): Id = kernel.SimpleSelector_selection(self) } object SimpleSelector { - def unapply(importSelector: ImportSelector)(implicit ctx: Context): Option[Id] = + def unapply(importSelector: ImportSelector) given (ctx: Context): Option[Id] = kernel.matchSimpleSelector(importSelector).map(_.selection) } implicit class RenameSelectorAPI(self: RenameSelector) { - def from(implicit ctx: Context): Id = + def from given (ctx: Context): Id = kernel.RenameSelector_from(self) - def to(implicit ctx: Context): Id = + def to given (ctx: Context): Id = kernel.RenameSelector_to(self) } object RenameSelector { - def unapply(importSelector: ImportSelector)(implicit ctx: Context): Option[(Id, Id)] = + def unapply(importSelector: ImportSelector) given (ctx: Context): Option[(Id, Id)] = kernel.matchRenameSelector(importSelector).map(x => (x.from, x.to)) } implicit class OmitSelectorAPI(self: OmitSelector) { - def omitted(implicit ctx: Context): Id = + def omitted given (ctx: Context): Id = kernel.SimpleSelector_omited(self) } object OmitSelector { - def unapply(importSelector: ImportSelector)(implicit ctx: Context): Option[Id] = + def unapply(importSelector: ImportSelector) given (ctx: Context): Option[Id] = kernel.matchOmitSelector(importSelector).map(_.omitted) } diff --git a/library/src/scala/tasty/reflect/Kernel.scala b/library/src/scala/tasty/reflect/Kernel.scala index 9f07ae8065e9..ae24cfd49616 100644 --- a/library/src/scala/tasty/reflect/Kernel.scala +++ b/library/src/scala/tasty/reflect/Kernel.scala @@ -151,16 +151,16 @@ trait Kernel { // /** Report a compilation error with the given message at the given position */ - def error(msg: => String, pos: Position)(implicit ctx: Context): Unit + def error(msg: => String, pos: Position) given (ctx: Context): Unit /** Report a compilation error with the given message at the given position range */ - def error(msg: => String, source: SourceFile, start: Int, end: Int)(implicit ctx: Context): Unit + def error(msg: => String, source: SourceFile, start: Int, end: Int) given (ctx: Context): Unit /** Report a compilation warning with the given message at the given position */ - def warning(msg: => String, pos: Position)(implicit ctx: Context): Unit + def warning(msg: => String, pos: Position) given (ctx: Context): Unit /** Report a compilation warning with the given message at the given position range */ - def warning(msg: => String, source: SourceFile, start: Int, end: Int)(implicit ctx: Context): Unit + def warning(msg: => String, source: SourceFile, start: Int, end: Int) given (ctx: Context): Unit // // Settings @@ -180,7 +180,7 @@ trait 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 + def typeChecks(code: String) given (ctx: Context): Boolean // // TREES @@ -189,254 +189,254 @@ trait Kernel { /** Tree representing code written in the source */ type Tree <: AnyRef - def Tree_pos(self: Tree)(implicit ctx: Context): Position - def Tree_symbol(self: Tree)(implicit ctx: Context): Symbol + def Tree_pos(self: Tree) given (ctx: Context): Position + def Tree_symbol(self: Tree) given (ctx: Context): Symbol /** Tree representing a pacakage clause in the source code */ type PackageClause <: Tree - def matchPackageClause(tree: Tree)(implicit ctx: Context): Option[PackageClause] + def matchPackageClause(tree: Tree) given (ctx: Context): Option[PackageClause] - def PackageClause_pid(self: PackageClause)(implicit ctx: Context): Ref - def PackageClause_stats(self: PackageClause)(implicit ctx: Context): List[Tree] + def PackageClause_pid(self: PackageClause) given (ctx: Context): Ref + def PackageClause_stats(self: PackageClause) given (ctx: Context): List[Tree] - def PackageClause_apply(pid: Ref, stats: List[Tree])(implicit ctx: Context): PackageClause + def PackageClause_apply(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause - def PackageClause_copy(original: PackageClause)(pid: Ref, stats: List[Tree])(implicit ctx: Context): PackageClause + def PackageClause_copy(original: PackageClause)(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause /** Tree representing a statement in the source code */ type Statement <: Tree - def matchStatement(tree: Tree)(implicit ctx: Context): Option[Statement] + def matchStatement(tree: Tree) given (ctx: Context): Option[Statement] /** Tree representing an import in the source code */ type Import <: Statement - def matchImport(tree: Tree)(implicit ctx: Context): Option[Import] + def matchImport(tree: Tree) given (ctx: Context): Option[Import] def Import_implied(self: Import): Boolean - def Import_expr(self: Import)(implicit ctx: Context): Term - def Import_selectors(self: Import)(implicit ctx: Context): List[ImportSelector] + def Import_expr(self: Import) given (ctx: Context): Term + def Import_selectors(self: Import) given (ctx: Context): List[ImportSelector] - def Import_apply(importImplied: Boolean, expr: Term, selectors: List[ImportSelector])(implicit ctx: Context): Import + def Import_apply(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import - def Import_copy(original: Import)(importImplied: Boolean, expr: Term, selectors: List[ImportSelector])(implicit ctx: Context): Import + def Import_copy(original: Import)(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import /** Tree representing a definition in the source code. It can be `PackageDef`, `ClassDef`, `TypeDef`, `DefDef` or `ValDef` */ type Definition <: Statement - def matchDefinition(tree: Tree)(implicit ctx: Context): Option[Definition] + def matchDefinition(tree: Tree) given (ctx: Context): Option[Definition] - def Definition_name(self: Definition)(implicit ctx: Context): String + def Definition_name(self: Definition) given (ctx: Context): String /** Tree representing a package definition. This includes definitions in all source files */ type PackageDef <: Definition - def matchPackageDef(tree: Tree)(implicit ctx: Context): Option[PackageDef] + def matchPackageDef(tree: Tree) given (ctx: Context): Option[PackageDef] - def PackageDef_owner(self: PackageDef)(implicit ctx: Context): PackageDef - def PackageDef_members(self: PackageDef)(implicit ctx: Context): List[Statement] - def PackageDef_symbol(self: PackageDef)(implicit ctx: Context): PackageDefSymbol + def PackageDef_owner(self: PackageDef) given (ctx: Context): PackageDef + def PackageDef_members(self: PackageDef) given (ctx: Context): List[Statement] + def PackageDef_symbol(self: PackageDef) given (ctx: Context): PackageDefSymbol /** Tree representing a class definition. This includes annonymus class definitions and the class of a module object */ type ClassDef <: Definition - def matchClassDef(tree: Tree)(implicit ctx: Context): Option[ClassDef] + def matchClassDef(tree: Tree) given (ctx: Context): Option[ClassDef] - def ClassDef_constructor(self: ClassDef)(implicit ctx: Context): DefDef - def ClassDef_parents(self: ClassDef)(implicit ctx: Context): List[Tree/* Term | TypeTree */] - def ClassDef_derived(self: ClassDef)(implicit ctx: Context): List[TypeTree] - def ClassDef_self(self: ClassDef)(implicit ctx: Context): Option[ValDef] - def ClassDef_body(self: ClassDef)(implicit ctx: Context): List[Statement] - def ClassDef_symbol(self: ClassDef)(implicit ctx: Context): ClassDefSymbol + def ClassDef_constructor(self: ClassDef) given (ctx: Context): DefDef + def ClassDef_parents(self: ClassDef) given (ctx: Context): List[Tree/* Term | TypeTree */] + def ClassDef_derived(self: ClassDef) given (ctx: Context): List[TypeTree] + def ClassDef_self(self: ClassDef) given (ctx: Context): Option[ValDef] + def ClassDef_body(self: ClassDef) given (ctx: Context): List[Statement] + def ClassDef_symbol(self: ClassDef) given (ctx: Context): ClassDefSymbol - def ClassDef_copy(original: ClassDef)(name: String, constr: DefDef, parents: List[Tree/* Term | TypeTree */], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement])(implicit ctx: Context): ClassDef + def ClassDef_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 /** Tree representing a type (paramter or member) definition in the source code */ type TypeDef <: Definition - def matchTypeDef(tree: Tree)(implicit ctx: Context): Option[TypeDef] + def matchTypeDef(tree: Tree) given (ctx: Context): Option[TypeDef] - def TypeDef_rhs(self: TypeDef)(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ - def TypeDef_symbol(self: TypeDef)(implicit ctx: Context): TypeDefSymbol + def TypeDef_rhs(self: TypeDef) given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ + def TypeDef_symbol(self: TypeDef) given (ctx: Context): TypeDefSymbol - def TypeDef_apply(symbol: TypeDefSymbol)(implicit ctx: Context): TypeDef - def TypeDef_copy(original: TypeDef)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): TypeDef + def TypeDef_apply(symbol: TypeDefSymbol) given (ctx: Context): TypeDef + def TypeDef_copy(original: TypeDef)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): TypeDef /** Tree representing a method definition in the source code */ type DefDef <: Definition - def matchDefDef(tree: Tree)(implicit ctx: Context): Option[DefDef] + def matchDefDef(tree: Tree) given (ctx: Context): Option[DefDef] - def DefDef_typeParams(self: DefDef)(implicit ctx: Context): List[TypeDef] - def DefDef_paramss(self: DefDef)(implicit ctx: Context): List[List[ValDef]] - def DefDef_returnTpt(self: DefDef)(implicit ctx: Context): TypeTree - def DefDef_rhs(self: DefDef)(implicit ctx: Context): Option[Term] - def DefDef_symbol(self: DefDef)(implicit ctx: Context): DefDefSymbol + def DefDef_typeParams(self: DefDef) given (ctx: Context): List[TypeDef] + def DefDef_paramss(self: DefDef) given (ctx: Context): List[List[ValDef]] + def DefDef_returnTpt(self: DefDef) given (ctx: Context): TypeTree + def DefDef_rhs(self: DefDef) given (ctx: Context): Option[Term] + def DefDef_symbol(self: DefDef) given (ctx: Context): DefDefSymbol - def DefDef_apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(implicit ctx: Context): DefDef - def DefDef_copy(original: DefDef)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term])(implicit ctx: Context): DefDef + def DefDef_apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term]) given (ctx: Context): DefDef + def DefDef_copy(original: DefDef)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): DefDef /** Tree representing a value definition in the source code This inclues `val`, `lazy val`, `var`, `object` and parameter definitions. */ type ValDef <: Definition - def matchValDef(tree: Tree)(implicit ctx: Context): Option[ValDef] + def matchValDef(tree: Tree) given (ctx: Context): Option[ValDef] - def ValDef_tpt(self: ValDef)(implicit ctx: Context): TypeTree - def ValDef_rhs(self: ValDef)(implicit ctx: Context): Option[Term] - def ValDef_symbol(self: ValDef)(implicit ctx: Context): ValDefSymbol + def ValDef_tpt(self: ValDef) given (ctx: Context): TypeTree + def ValDef_rhs(self: ValDef) given (ctx: Context): Option[Term] + def ValDef_symbol(self: ValDef) given (ctx: Context): ValDefSymbol - def ValDef_apply(symbol: ValDefSymbol, rhs: Option[Term])(implicit ctx: Context): ValDef - def ValDef_copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term])(implicit ctx: Context): ValDef + def ValDef_apply(symbol: ValDefSymbol, rhs: Option[Term]) given (ctx: Context): ValDef + def ValDef_copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): ValDef /** Tree representing an expression in the source code */ type Term <: Statement - def matchTerm(tree: Tree)(implicit ctx: Context): Option[Term] + def matchTerm(tree: Tree) given (ctx: Context): Option[Term] - def Term_pos(self: Term)(implicit ctx: Context): Position - def Term_tpe(self: Term)(implicit ctx: Context): Type - def Term_underlyingArgument(self: Term)(implicit ctx: Context): Term - def Term_underlying(self: Term)(implicit ctx: Context): Term + def Term_pos(self: Term) given (ctx: Context): Position + def Term_tpe(self: Term) given (ctx: Context): Type + def Term_underlyingArgument(self: Term) given (ctx: Context): Term + def Term_underlying(self: Term) given (ctx: Context): Term /** Tree representing a reference to definition */ type Ref <: Term - def matchRef(tree: Tree)(implicit ctx: Context): Option[Ref] + def matchRef(tree: Tree) given (ctx: Context): Option[Ref] - def Ref_apply(sym: Symbol)(implicit ctx: Context): Ref + def Ref_apply(sym: Symbol) given (ctx: Context): Ref /** Tree representing a reference to definition with a given name */ type Ident <: Ref - def matchIdent(tree: Tree)(implicit ctx: Context): Option[Ident] + def matchIdent(tree: Tree) given (ctx: Context): Option[Ident] - def Ident_name(self: Ident)(implicit ctx: Context): String + def Ident_name(self: Ident) given (ctx: Context): String - def Ident_apply(tmref: TermRef)(implicit ctx: Context): Term - def Ident_copy(original: Tree)(name: String)(implicit ctx: Context): Ident + def Ident_apply(tmref: TermRef) given (ctx: Context): Term + def Ident_copy(original: Tree)(name: String) given (ctx: Context): Ident /** Tree representing a selection of definition with a given name on a given prefix */ type Select <: Ref - def matchSelect(tree: Tree)(implicit ctx: Context): Option[Select] + def matchSelect(tree: Tree) given (ctx: Context): Option[Select] - def Select_qualifier(self: Select)(implicit ctx: Context): Term - def Select_name(self: Select)(implicit ctx: Context): String - def Select_signature(self: Select)(implicit ctx: Context): Option[Signature] + def Select_qualifier(self: Select) given (ctx: Context): Term + def Select_name(self: Select) given (ctx: Context): String + def Select_signature(self: Select) given (ctx: Context): Option[Signature] - def Select_apply(qualifier: Term, symbol: Symbol)(implicit ctx: Context): Select - def Select_unique(qualifier: Term, name: String)(implicit ctx: Context): Select + def Select_apply(qualifier: Term, symbol: Symbol) given (ctx: Context): Select + def Select_unique(qualifier: Term, name: String) given (ctx: Context): Select // TODO rename, this returns an Apply and not a Select - def Select_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term])(implicit ctx: Context): Apply - def Select_copy(original: Tree)(qualifier: Term, name: String)(implicit ctx: Context): Select + def Select_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term]) given (ctx: Context): Apply + def Select_copy(original: Tree)(qualifier: Term, name: String) given (ctx: Context): Select /** Tree representing a literal value in the source code */ type Literal <: Term - def matchLiteral(tree: Tree)(implicit ctx: Context): Option[Literal] + def matchLiteral(tree: Tree) given (ctx: Context): Option[Literal] - def Literal_constant(self: Literal)(implicit ctx: Context): Constant + def Literal_constant(self: Literal) given (ctx: Context): Constant - def Literal_apply(constant: Constant)(implicit ctx: Context): Literal - def Literal_copy(original: Tree)(constant: Constant)(implicit ctx: Context): Literal + def Literal_apply(constant: Constant) given (ctx: Context): Literal + def Literal_copy(original: Tree)(constant: Constant) given (ctx: Context): Literal /** Tree representing `this` in the source code */ type This <: Term - def matchThis(tree: Tree)(implicit ctx: Context): Option[This] + def matchThis(tree: Tree) given (ctx: Context): Option[This] - def This_id(self: This)(implicit ctx: Context): Option[Id] + def This_id(self: This) given (ctx: Context): Option[Id] - def This_apply(cls: ClassDefSymbol)(implicit ctx: Context): This - def This_copy(original: Tree)(qual: Option[Id])(implicit ctx: Context): This + def This_apply(cls: ClassDefSymbol) given (ctx: Context): This + def This_copy(original: Tree)(qual: Option[Id]) given (ctx: Context): This /** Tree representing `new` in the source code */ type New <: Term - def matchNew(tree: Tree)(implicit ctx: Context): Option[New] + def matchNew(tree: Tree) given (ctx: Context): Option[New] - def New_tpt(self: New)(implicit ctx: Context): TypeTree + def New_tpt(self: New) given (ctx: Context): TypeTree - def New_apply(tpt: TypeTree)(implicit ctx: Context): New - def New_copy(original: Tree)(tpt: TypeTree)(implicit ctx: Context): New + def New_apply(tpt: TypeTree) given (ctx: Context): New + def New_copy(original: Tree)(tpt: TypeTree) given (ctx: Context): New /** Tree representing an argument passed with an explicit name. Such as `arg1 = x` in `foo(arg1 = x)` */ type NamedArg <: Term - def matchNamedArg(tree: Tree)(implicit ctx: Context): Option[NamedArg] + def matchNamedArg(tree: Tree) given (ctx: Context): Option[NamedArg] - def NamedArg_name(self: NamedArg)(implicit ctx: Context): String - def NamedArg_value(self: NamedArg)(implicit ctx: Context): Term + def NamedArg_name(self: NamedArg) given (ctx: Context): String + def NamedArg_value(self: NamedArg) given (ctx: Context): Term - def NamedArg_apply(name: String, arg: Term)(implicit ctx: Context): NamedArg - def NamedArg_copy(tree: NamedArg)(name: String, arg: Term)(implicit ctx: Context): NamedArg + def NamedArg_apply(name: String, arg: Term) given (ctx: Context): NamedArg + def NamedArg_copy(tree: NamedArg)(name: String, arg: Term) given (ctx: Context): NamedArg /** Tree an application of arguments. It represents a single list of arguments, multiple argument lists will have nested `Apply`s */ type Apply <: Term - def matchApply(tree: Tree)(implicit ctx: Context): Option[Apply] + def matchApply(tree: Tree) given (ctx: Context): Option[Apply] - def Apply_fun(self: Apply)(implicit ctx: Context): Term - def Apply_args(self: Apply)(implicit ctx: Context): List[Term] + def Apply_fun(self: Apply) given (ctx: Context): Term + def Apply_args(self: Apply) given (ctx: Context): List[Term] - def Apply_apply(fn: Term, args: List[Term])(implicit ctx: Context): Apply - def Apply_copy(original: Tree)(fun: Term, args: List[Term])(implicit ctx: Context): Apply + def Apply_apply(fn: Term, args: List[Term]) given (ctx: Context): Apply + def Apply_copy(original: Tree)(fun: Term, args: List[Term]) given (ctx: Context): Apply /** Tree an application of type arguments */ type TypeApply <: Term - def matchTypeApply(tree: Tree)(implicit ctx: Context): Option[TypeApply] + def matchTypeApply(tree: Tree) given (ctx: Context): Option[TypeApply] - def TypeApply_fun(self: TypeApply)(implicit ctx: Context): Term - def TypeApply_args(self: TypeApply)(implicit ctx: Context): List[TypeTree] + def TypeApply_fun(self: TypeApply) given (ctx: Context): Term + def TypeApply_args(self: TypeApply) given (ctx: Context): List[TypeTree] - def TypeApply_apply(fn: Term, args: List[TypeTree])(implicit ctx: Context): TypeApply - def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree])(implicit ctx: Context): TypeApply + def TypeApply_apply(fn: Term, args: List[TypeTree]) given (ctx: Context): TypeApply + def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree]) given (ctx: Context): TypeApply /** Tree representing `super` in the source code */ type Super <: Term - def matchSuper(tree: Tree)(implicit ctx: Context): Option[Super] + def matchSuper(tree: Tree) given (ctx: Context): Option[Super] - def Super_qualifier(self: Super)(implicit ctx: Context): Term - def Super_id(self: Super)(implicit ctx: Context): Option[Id] + def Super_qualifier(self: Super) given (ctx: Context): Term + def Super_id(self: Super) given (ctx: Context): Option[Id] - def Super_apply(qual: Term, mix: Option[Id])(implicit ctx: Context): Super - def Super_copy(original: Tree)(qual: Term, mix: Option[Id])(implicit ctx: Context): Super + def Super_apply(qual: Term, mix: Option[Id]) given (ctx: Context): Super + def Super_copy(original: Tree)(qual: Term, mix: Option[Id]) given (ctx: Context): Super /** Tree representing a type ascription `x: T` in the source code */ type Typed <: Term - def matchTyped(tree: Tree)(implicit ctx: Context): Option[Typed] + def matchTyped(tree: Tree) given (ctx: Context): Option[Typed] - def Typed_expr(self: Typed)(implicit ctx: Context): Term - def Typed_tpt(self: Typed)(implicit ctx: Context): TypeTree + def Typed_expr(self: Typed) given (ctx: Context): Term + def Typed_tpt(self: Typed) given (ctx: Context): TypeTree - def Typed_apply(expr: Term, tpt: TypeTree)(implicit ctx: Context): Typed - def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree)(implicit ctx: Context): Typed + def Typed_apply(expr: Term, tpt: TypeTree) given (ctx: Context): Typed + def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree) given (ctx: Context): Typed /** Tree representing an assignment `x = y` in the source code */ type Assign <: Term - def matchAssign(tree: Tree)(implicit ctx: Context): Option[Assign] + def matchAssign(tree: Tree) given (ctx: Context): Option[Assign] - def Assign_lhs(self: Assign)(implicit ctx: Context): Term - def Assign_rhs(self: Assign)(implicit ctx: Context): Term + def Assign_lhs(self: Assign) given (ctx: Context): Term + def Assign_rhs(self: Assign) given (ctx: Context): Term - def Assign_apply(lhs: Term, rhs: Term)(implicit ctx: Context): Assign - def Assign_copy(original: Tree)(lhs: Term, rhs: Term)(implicit ctx: Context): Assign + def Assign_apply(lhs: Term, rhs: Term) given (ctx: Context): Assign + def Assign_copy(original: Tree)(lhs: Term, rhs: Term) given (ctx: Context): Assign /** Tree representing a block `{ ... }` in the source code */ type Block <: Term - def matchBlock(tree: Tree)(implicit ctx: Context): Option[Block] + def matchBlock(tree: Tree) given (ctx: Context): Option[Block] - def Block_statements(self: Block)(implicit ctx: Context): List[Statement] - def Block_expr(self: Block)(implicit ctx: Context): Term + def Block_statements(self: Block) given (ctx: Context): List[Statement] + def Block_expr(self: Block) given (ctx: Context): Term - def Block_apply(stats: List[Statement], expr: Term)(implicit ctx: Context): Block - def Block_copy(original: Tree)(stats: List[Statement], expr: Term)(implicit ctx: Context): Block + def Block_apply(stats: List[Statement], expr: Term) given (ctx: Context): Block + def Block_copy(original: Tree)(stats: List[Statement], expr: Term) given (ctx: Context): Block /** A lambda `(...) => ...` in the source code is represented as * a local method and a closure: @@ -449,265 +449,265 @@ trait Kernel { */ type Closure <: Term - def matchClosure(tree: Tree)(implicit ctx: Context): Option[Closure] + def matchClosure(tree: Tree) given (ctx: Context): Option[Closure] - def Closure_meth(self: Closure)(implicit ctx: Context): Term - def Closure_tpeOpt(self: Closure)(implicit ctx: Context): Option[Type] + def Closure_meth(self: Closure) given (ctx: Context): Term + def Closure_tpeOpt(self: Closure) given (ctx: Context): Option[Type] - def Closure_apply(meth: Term, tpe: Option[Type])(implicit ctx: Context): Closure - def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type])(implicit ctx: Context): Closure + def Closure_apply(meth: Term, tpe: Option[Type]) given (ctx: Context): Closure + def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type]) given (ctx: Context): Closure /** Tree representing an if/then/else `if (...) ... else ...` in the source code */ type If <: Term - def matchIf(tree: Tree)(implicit ctx: Context): Option[If] + def matchIf(tree: Tree) given (ctx: Context): Option[If] - def If_cond(self: If)(implicit ctx: Context): Term - def If_thenp(self: If)(implicit ctx: Context): Term - def If_elsep(self: If)(implicit ctx: Context): Term + def If_cond(self: If) given (ctx: Context): Term + def If_thenp(self: If) given (ctx: Context): Term + def If_elsep(self: If) given (ctx: Context): Term - def If_apply(cond: Term, thenp: Term, elsep: Term)(implicit ctx: Context): If - def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(implicit ctx: Context): If + def If_apply(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If + def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If /** Tree representing a pattern match `x match { ... }` in the source code */ type Match <: Term - def matchMatch(tree: Tree)(implicit ctx: Context): Option[Match] + def matchMatch(tree: Tree) given (ctx: Context): Option[Match] - def Match_scrutinee(self: Match)(implicit ctx: Context): Term - def Match_cases(self: Match)(implicit ctx: Context): List[CaseDef] + def Match_scrutinee(self: Match) given (ctx: Context): Term + def Match_cases(self: Match) given (ctx: Context): List[CaseDef] - def Match_apply(selector: Term, cases: List[CaseDef])(implicit ctx: Context): Match - def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef])(implicit ctx: Context): Match + def Match_apply(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match + def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match /** Tree representing a pattern match `delegate match { ... }` in the source code */ type ImpliedMatch <: Term - def matchImplicitMatch(tree: Tree)(implicit ctx: Context): Option[ImpliedMatch] + def matchImplicitMatch(tree: Tree) given (ctx: Context): Option[ImpliedMatch] - def ImplicitMatch_cases(self: ImpliedMatch)(implicit ctx: Context): List[CaseDef] + def ImplicitMatch_cases(self: ImpliedMatch) given (ctx: Context): List[CaseDef] - def ImplicitMatch_apply(cases: List[CaseDef])(implicit ctx: Context): ImpliedMatch - def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef])(implicit ctx: Context): ImpliedMatch + def ImplicitMatch_apply(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch + def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch /** Tree representing a tyr catch `try x catch { ... } finally { ... }` in the source code */ type Try <: Term - def matchTry(tree: Tree)(implicit ctx: Context): Option[Try] + def matchTry(tree: Tree) given (ctx: Context): Option[Try] - def Try_body(self: Try)(implicit ctx: Context): Term - def Try_cases(self: Try)(implicit ctx: Context): List[CaseDef] - def Try_finalizer(self: Try)(implicit ctx: Context): Option[Term] + def Try_body(self: Try) given (ctx: Context): Term + def Try_cases(self: Try) given (ctx: Context): List[CaseDef] + def Try_finalizer(self: Try) given (ctx: Context): Option[Term] - def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(implicit ctx: Context): Try - def Try_copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(implicit ctx: Context): Try + def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try + def Try_copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try /** Tree representing a `return` in the source code */ type Return <: Term - def matchReturn(tree: Tree)(implicit ctx: Context): Option[Return] + def matchReturn(tree: Tree) given (ctx: Context): Option[Return] - def Return_expr(self: Return)(implicit ctx: Context): Term + def Return_expr(self: Return) given (ctx: Context): Term - def Return_apply(expr: Term)(implicit ctx: Context): Return - def Return_copy(original: Tree)(expr: Term)(implicit ctx: Context): Return + def Return_apply(expr: Term) given (ctx: Context): Return + def Return_copy(original: Tree)(expr: Term) given (ctx: Context): Return /** Tree representing a variable argument list in the source code */ type Repeated <: Term - def matchRepeated(tree: Tree)(implicit ctx: Context): Option[Repeated] + def matchRepeated(tree: Tree) given (ctx: Context): Option[Repeated] - def Repeated_elems(self: Repeated)(implicit ctx: Context): List[Term] - def Repeated_elemtpt(self: Repeated)(implicit ctx: Context): TypeTree + def Repeated_elems(self: Repeated) given (ctx: Context): List[Term] + def Repeated_elemtpt(self: Repeated) given (ctx: Context): TypeTree - def Repeated_apply(elems: List[Term], elemtpt: TypeTree)(implicit ctx: Context): Repeated - def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree)(implicit ctx: Context): Repeated + def Repeated_apply(elems: List[Term], elemtpt: TypeTree) given (ctx: Context): Repeated + def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree) given (ctx: Context): Repeated /** Tree representing the scope of an inlined tree */ type Inlined <: Term - def matchInlined(tree: Tree)(implicit ctx: Context): Option[Inlined] + def matchInlined(tree: Tree) given (ctx: Context): Option[Inlined] - def Inlined_call(self: Inlined)(implicit ctx: Context): Option[Tree/* Term | TypeTree */] - def Inlined_bindings(self: Inlined)(implicit ctx: Context): List[Definition] - def Inlined_body(self: Inlined)(implicit ctx: Context): Term + def Inlined_call(self: Inlined) given (ctx: Context): Option[Tree/* Term | TypeTree */] + def Inlined_bindings(self: Inlined) given (ctx: Context): List[Definition] + def Inlined_body(self: Inlined) given (ctx: Context): Term - def Inlined_apply(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined - def Inlined_copy(original: Tree)(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined + def Inlined_apply(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined + def Inlined_copy(original: Tree)(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term) given (ctx: Context): 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 <: Term - def matchSelectOuter(tree: Tree)(implicit ctx: Context): Option[SelectOuter] + def matchSelectOuter(tree: Tree) given (ctx: Context): Option[SelectOuter] - def SelectOuter_qualifier(self: SelectOuter)(implicit ctx: Context): Term - def SelectOuter_level(self: SelectOuter)(implicit ctx: Context): Int - def SelectOuter_tpe(self: SelectOuter)(implicit ctx: Context): Type + def SelectOuter_qualifier(self: SelectOuter) given (ctx: Context): Term + def SelectOuter_level(self: SelectOuter) given (ctx: Context): Int + def SelectOuter_tpe(self: SelectOuter) given (ctx: Context): Type - def SelectOuter_apply(qualifier: Term, name: String, levels: Int)(implicit ctx: Context): SelectOuter - def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int)(implicit ctx: Context): SelectOuter + def SelectOuter_apply(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter + def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter /** Tree representing a while loop */ type While <: Term - def matchWhile(tree: Tree)(implicit ctx: Context): Option[While] + def matchWhile(tree: Tree) given (ctx: Context): Option[While] - def While_cond(self: While)(implicit ctx: Context): Term - def While_body(self: While)(implicit ctx: Context): Term + def While_cond(self: While) given (ctx: Context): Term + def While_body(self: While) given (ctx: Context): Term - def While_apply(cond: Term, body: Term)(implicit ctx: Context): While - def While_copy(original: Tree)(cond: Term, body: Term)(implicit ctx: Context): While + def While_apply(cond: Term, body: Term) given (ctx: Context): While + def While_copy(original: Tree)(cond: Term, body: Term) given (ctx: Context): While /** Type tree representing a type written in the source */ type TypeTree <: Tree - def matchTypeTree(tree: Tree)(implicit ctx: Context): Option[TypeTree] + def matchTypeTree(tree: Tree) given (ctx: Context): Option[TypeTree] - def TypeTree_pos(self: TypeTree)(implicit ctx: Context): Position - def TypeTree_symbol(self: TypeTree)(implicit ctx: Context): Symbol - def TypeTree_tpe(self: TypeTree)(implicit ctx: Context): Type + def TypeTree_pos(self: TypeTree) given (ctx: Context): Position + def TypeTree_symbol(self: TypeTree) given (ctx: Context): Symbol + def TypeTree_tpe(self: TypeTree) given (ctx: Context): Type /** Type tree representing an inferred type */ type Inferred <: TypeTree - def matchInferred(tree: Tree)(implicit ctx: Context): Option[Inferred] + def matchInferred(tree: Tree) given (ctx: Context): Option[Inferred] - def Inferred_apply(tpe: Type)(implicit ctx: Context): Inferred + def Inferred_apply(tpe: Type) given (ctx: Context): Inferred /** Type tree representing a reference to definition with a given name */ type TypeIdent <: TypeTree - def matchTypeIdent(tree: Tree)(implicit ctx: Context): Option[TypeIdent] + def matchTypeIdent(tree: Tree) given (ctx: Context): Option[TypeIdent] - def TypeIdent_name(self: TypeIdent)(implicit ctx: Context): String + def TypeIdent_name(self: TypeIdent) given (ctx: Context): String - def TypeIdent_copy(original: TypeIdent)(name: String)(implicit ctx: Context): TypeIdent + def TypeIdent_copy(original: TypeIdent)(name: String) given (ctx: Context): TypeIdent /** Type tree representing a selection of definition with a given name on a given term prefix */ type TypeSelect <: TypeTree - def matchTypeSelect(tree: Tree)(implicit ctx: Context): Option[TypeSelect] + def matchTypeSelect(tree: Tree) given (ctx: Context): Option[TypeSelect] - def TypeSelect_qualifier(self: TypeSelect)(implicit ctx: Context): Term - def TypeSelect_name(self: TypeSelect)(implicit ctx: Context): String + def TypeSelect_qualifier(self: TypeSelect) given (ctx: Context): Term + def TypeSelect_name(self: TypeSelect) given (ctx: Context): String - def TypeSelect_apply(qualifier: Term, name: String)(implicit ctx: Context): TypeSelect - def TypeSelect_copy(original: TypeSelect)(qualifier: Term, name: String)(implicit ctx: Context): TypeSelect + def TypeSelect_apply(qualifier: Term, name: String) given (ctx: Context): TypeSelect + def TypeSelect_copy(original: TypeSelect)(qualifier: Term, name: String) given (ctx: Context): TypeSelect /** Type tree representing a selection of definition with a given name on a given type prefix */ type Projection <: TypeTree - def matchProjection(tree: Tree)(implicit ctx: Context): Option[Projection] + def matchProjection(tree: Tree) given (ctx: Context): Option[Projection] - def Projection_qualifier(self: Projection)(implicit ctx: Context): TypeTree - def Projection_name(self: Projection)(implicit ctx: Context): String + def Projection_qualifier(self: Projection) given (ctx: Context): TypeTree + def Projection_name(self: Projection) given (ctx: Context): String - def Projection_copy(original: Projection)(qualifier: TypeTree, name: String)(implicit ctx: Context): Projection + def Projection_copy(original: Projection)(qualifier: TypeTree, name: String) given (ctx: Context): Projection /** Type tree representing a singleton type */ type Singleton <: TypeTree - def matchSingleton(tree: Tree)(implicit ctx: Context): Option[Singleton] + def matchSingleton(tree: Tree) given (ctx: Context): Option[Singleton] - def Singleton_ref(self: Singleton)(implicit ctx: Context): Term + def Singleton_ref(self: Singleton) given (ctx: Context): Term - def Singleton_apply(ref: Term)(implicit ctx: Context): Singleton - def Singleton_copy(original: Singleton)(ref: Term)(implicit ctx: Context): Singleton + def Singleton_apply(ref: Term) given (ctx: Context): Singleton + def Singleton_copy(original: Singleton)(ref: Term) given (ctx: Context): Singleton /** Type tree representing a type refinement */ type Refined <: TypeTree - def matchRefined(tree: Tree)(implicit ctx: Context): Option[Refined] + def matchRefined(tree: Tree) given (ctx: Context): Option[Refined] - def Refined_tpt(self: Refined)(implicit ctx: Context): TypeTree - def Refined_refinements(self: Refined)(implicit ctx: Context): List[Definition] + def Refined_tpt(self: Refined) given (ctx: Context): TypeTree + def Refined_refinements(self: Refined) given (ctx: Context): List[Definition] - def Refined_copy(original: Refined)(tpt: TypeTree, refinements: List[Definition])(implicit ctx: Context): Refined + def Refined_copy(original: Refined)(tpt: TypeTree, refinements: List[Definition]) given (ctx: Context): Refined /** Type tree representing a type application */ type Applied <: TypeTree - def matchApplied(tree: Tree)(implicit ctx: Context): Option[Applied] + def matchApplied(tree: Tree) given (ctx: Context): Option[Applied] - def Applied_tpt(self: Applied)(implicit ctx: Context): TypeTree - def Applied_args(self: Applied)(implicit ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] + def Applied_tpt(self: Applied) given (ctx: Context): TypeTree + def Applied_args(self: Applied) given (ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] - def Applied_apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(implicit ctx: Context): Applied - def Applied_copy(original: Applied)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(implicit ctx: Context): Applied + def Applied_apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/]) given (ctx: Context): Applied + def Applied_copy(original: Applied)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/]) given (ctx: Context): Applied /** Type tree representing an annotated type */ type Annotated <: TypeTree - def matchAnnotated(tree: Tree)(implicit ctx: Context): Option[Annotated] + def matchAnnotated(tree: Tree) given (ctx: Context): Option[Annotated] - def Annotated_arg(self: Annotated)(implicit ctx: Context): TypeTree - def Annotated_annotation(self: Annotated)(implicit ctx: Context): Term + def Annotated_arg(self: Annotated) given (ctx: Context): TypeTree + def Annotated_annotation(self: Annotated) given (ctx: Context): Term - def Annotated_apply(arg: TypeTree, annotation: Term)(implicit ctx: Context): Annotated - def Annotated_copy(original: Annotated)(arg: TypeTree, annotation: Term)(implicit ctx: Context): Annotated + def Annotated_apply(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated + def Annotated_copy(original: Annotated)(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated /** Type tree representing a type match */ type MatchTypeTree <: TypeTree - def matchMatchTypeTree(tree: Tree)(implicit ctx: Context): Option[MatchTypeTree] + def matchMatchTypeTree(tree: Tree) given (ctx: Context): Option[MatchTypeTree] - def MatchTypeTree_bound(self: MatchTypeTree)(implicit ctx: Context): Option[TypeTree] - def MatchTypeTree_selector(self: MatchTypeTree)(implicit ctx: Context): TypeTree - def MatchTypeTree_cases(self: MatchTypeTree)(implicit ctx: Context): List[TypeCaseDef] + def MatchTypeTree_bound(self: MatchTypeTree) given (ctx: Context): Option[TypeTree] + def MatchTypeTree_selector(self: MatchTypeTree) given (ctx: Context): TypeTree + def MatchTypeTree_cases(self: MatchTypeTree) given (ctx: Context): List[TypeCaseDef] - def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(implicit ctx: Context): MatchTypeTree - def MatchTypeTree_copy(original: MatchTypeTree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(implicit ctx: Context): MatchTypeTree + def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree + def MatchTypeTree_copy(original: MatchTypeTree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree /** Type tree representing a by name parameter */ type ByName <: TypeTree - def ByName_result(self: ByName)(implicit ctx: Context): TypeTree + def ByName_result(self: ByName) given (ctx: Context): TypeTree - def matchByName(tree: Tree)(implicit ctx: Context): Option[ByName] + def matchByName(tree: Tree) given (ctx: Context): Option[ByName] - def ByName_apply(result: TypeTree)(implicit ctx: Context): ByName - def ByName_copy(original: ByName)(result: TypeTree)(implicit ctx: Context): ByName + def ByName_apply(result: TypeTree) given (ctx: Context): ByName + def ByName_copy(original: ByName)(result: TypeTree) given (ctx: Context): ByName /** Type tree representing a lambda abstraction type */ type LambdaTypeTree <: TypeTree - def matchLambdaTypeTree(tree: Tree)(implicit ctx: Context): Option[LambdaTypeTree] + def matchLambdaTypeTree(tree: Tree) given (ctx: Context): Option[LambdaTypeTree] - def Lambdatparams(self: LambdaTypeTree)(implicit ctx: Context): List[TypeDef] - def Lambdabody(self: LambdaTypeTree)(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ + def Lambdatparams(self: LambdaTypeTree) given (ctx: Context): List[TypeDef] + def Lambdabody(self: LambdaTypeTree) given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ - def Lambdaapply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): LambdaTypeTree - def Lambdacopy(original: LambdaTypeTree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): LambdaTypeTree + def Lambdaapply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): LambdaTypeTree + def Lambdacopy(original: LambdaTypeTree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): LambdaTypeTree /** Type tree representing a type binding */ type TypeBind <: TypeTree - def matchTypeBind(tree: Tree)(implicit ctx: Context): Option[TypeBind] + def matchTypeBind(tree: Tree) given (ctx: Context): Option[TypeBind] - def TypeBind_name(self: TypeBind)(implicit ctx: Context): String - def TypeBind_body(self: TypeBind)(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ + def TypeBind_name(self: TypeBind) given (ctx: Context): String + def TypeBind_body(self: TypeBind) given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ - def TypeBind_copy(original: TypeBind)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): TypeBind + def TypeBind_copy(original: TypeBind)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): TypeBind /** Type tree within a block with aliases `{ type U1 = ... ; T[U1, U2] }` */ type TypeBlock <: TypeTree - def matchTypeBlock(tree: Tree)(implicit ctx: Context): Option[TypeBlock] + def matchTypeBlock(tree: Tree) given (ctx: Context): Option[TypeBlock] - def TypeBlock_aliases(self: TypeBlock)(implicit ctx: Context): List[TypeDef] - def TypeBlock_tpt(self: TypeBlock)(implicit ctx: Context): TypeTree + def TypeBlock_aliases(self: TypeBlock) given (ctx: Context): List[TypeDef] + def TypeBlock_tpt(self: TypeBlock) given (ctx: Context): TypeTree - def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeBlock - def TypeBlock_copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeBlock + def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock + def TypeBlock_copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock /** Type tree representing a type bound written in the source */ type TypeBoundsTree <: Tree /*TypeTree | TypeBoundsTree*/ - def matchTypeBoundsTree(tree: Tree)(implicit ctx: Context): Option[TypeBoundsTree] + def matchTypeBoundsTree(tree: Tree) given (ctx: Context): Option[TypeBoundsTree] - def TypeBoundsTree_tpe(self: TypeBoundsTree)(implicit ctx: Context): TypeBounds - def TypeBoundsTree_low(self: TypeBoundsTree)(implicit ctx: Context): TypeTree - def TypeBoundsTree_hi(self: TypeBoundsTree)(implicit ctx: Context): TypeTree + def TypeBoundsTree_tpe(self: TypeBoundsTree) given (ctx: Context): TypeBounds + def TypeBoundsTree_low(self: TypeBoundsTree) given (ctx: Context): TypeTree + def TypeBoundsTree_hi(self: TypeBoundsTree) given (ctx: Context): TypeTree /** Type tree representing wildcard type bounds written in the source. * The wildcard type `_` (for example in in `List[_]`) will be a type tree that @@ -715,32 +715,32 @@ trait Kernel { */ type WildcardTypeTree <: Tree - def matchWildcardTypeTree(tree: Tree)(implicit ctx: Context): Option[WildcardTypeTree] + def matchWildcardTypeTree(tree: Tree) given (ctx: Context): Option[WildcardTypeTree] - def WildcardTypeTree_tpe(self: WildcardTypeTree)(implicit ctx: Context): TypeOrBounds + def WildcardTypeTree_tpe(self: WildcardTypeTree) given (ctx: Context): TypeOrBounds /** Branch of a pattern match or catch clause */ type CaseDef <: Tree - def matchCaseDef(tree: Tree)(implicit ctx: Context): Option[CaseDef] + def matchCaseDef(tree: Tree) given (ctx: Context): Option[CaseDef] - def CaseDef_pattern(self: CaseDef)(implicit ctx: Context): Pattern - def CaseDef_guard(self: CaseDef)(implicit ctx: Context): Option[Term] - def CaseDef_rhs(self: CaseDef)(implicit ctx: Context): Term + def CaseDef_pattern(self: CaseDef) given (ctx: Context): Pattern + def CaseDef_guard(self: CaseDef) given (ctx: Context): Option[Term] + def CaseDef_rhs(self: CaseDef) given (ctx: Context): Term - def CaseDef_module_apply(pattern: Pattern, guard: Option[Term], body: Term)(implicit ctx: Context): CaseDef - def CaseDef_module_copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], body: Term)(implicit ctx: Context): CaseDef + def CaseDef_module_apply(pattern: Pattern, guard: Option[Term], body: Term) given (ctx: Context): CaseDef + def CaseDef_module_copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], body: Term) given (ctx: Context): CaseDef /** Branch of a type pattern match */ type TypeCaseDef <: Tree - def matchTypeCaseDef(tree: Tree)(implicit ctx: Context): Option[TypeCaseDef] + def matchTypeCaseDef(tree: Tree) given (ctx: Context): Option[TypeCaseDef] - def TypeCaseDef_pattern(self: TypeCaseDef)(implicit ctx: Context): TypeTree - def TypeCaseDef_rhs(self: TypeCaseDef)(implicit ctx: Context): TypeTree + def TypeCaseDef_pattern(self: TypeCaseDef) given (ctx: Context): TypeTree + def TypeCaseDef_rhs(self: TypeCaseDef) given (ctx: Context): TypeTree - def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree)(implicit ctx: Context): TypeCaseDef - def TypeCaseDef_module_copy(original: TypeCaseDef)(pattern: TypeTree, body: TypeTree)(implicit ctx: Context): TypeCaseDef + def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree) given (ctx: Context): TypeCaseDef + def TypeCaseDef_module_copy(original: TypeCaseDef)(pattern: TypeTree, body: TypeTree) given (ctx: Context): TypeCaseDef // // PATTERNS @@ -749,70 +749,70 @@ trait Kernel { /** Pattern tree of the pattern part of a CaseDef */ type Pattern <: AnyRef - def Pattern_pos(self: Pattern)(implicit ctx: Context): Position - def Pattern_tpe(self: Pattern)(implicit ctx: Context): Type - def Pattern_symbol(self: Pattern)(implicit ctx: Context): Symbol + def Pattern_pos(self: Pattern) given (ctx: Context): Position + def Pattern_tpe(self: Pattern) given (ctx: Context): Type + def Pattern_symbol(self: Pattern) given (ctx: Context): Symbol /** Pattern representing a value. This includes `1`, ```x``` and `_` */ type Value <: Pattern def matchPattern_Value(pattern: Pattern): Option[Value] - def Pattern_Value_value(self: Value)(implicit ctx: Context): Term + def Pattern_Value_value(self: Value) given (ctx: Context): Term - def Pattern_Value_module_apply(term: Term)(implicit ctx: Context): Value - def Pattern_Value_module_copy(original: Value)(term: Term)(implicit ctx: Context): Value + def Pattern_Value_module_apply(term: Term) given (ctx: Context): Value + def Pattern_Value_module_copy(original: Value)(term: Term) given (ctx: Context): Value /** Pattern representing a `_ @ _` binding. */ type Bind <: Pattern - def matchPattern_Bind(x: Pattern)(implicit ctx: Context): Option[Bind] + def matchPattern_Bind(x: Pattern) given (ctx: Context): Option[Bind] - def Pattern_Bind_name(self: Bind)(implicit ctx: Context): String + def Pattern_Bind_name(self: Bind) given (ctx: Context): String - def Pattern_Bind_pattern(self: Bind)(implicit ctx: Context): Pattern + def Pattern_Bind_pattern(self: Bind) given (ctx: Context): Pattern - def Pattern_Bind_module_copy(original: Bind)(name: String, pattern: Pattern)(implicit ctx: Context): Bind + def Pattern_Bind_module_copy(original: Bind)(name: String, pattern: Pattern) given (ctx: Context): Bind /** Pattern representing a `Xyz(...)` unapply. */ type Unapply <: Pattern - def matchPattern_Unapply(pattern: Pattern)(implicit ctx: Context): Option[Unapply] + def matchPattern_Unapply(pattern: Pattern) given (ctx: Context): Option[Unapply] - def Pattern_Unapply_fun(self: Unapply)(implicit ctx: Context): Term + def Pattern_Unapply_fun(self: Unapply) given (ctx: Context): Term - def Pattern_Unapply_implicits(self: Unapply)(implicit ctx: Context): List[Term] + def Pattern_Unapply_implicits(self: Unapply) given (ctx: Context): List[Term] - def Pattern_Unapply_patterns(self: Unapply)(implicit ctx: Context): List[Pattern] + def Pattern_Unapply_patterns(self: Unapply) given (ctx: Context): List[Pattern] - def Pattern_Unapply_module_copy(original: Unapply)(fun: Term, implicits: List[Term], patterns: List[Pattern])(implicit ctx: Context): Unapply + def Pattern_Unapply_module_copy(original: Unapply)(fun: Term, implicits: List[Term], patterns: List[Pattern]) given (ctx: Context): Unapply /** Pattern representing `X | Y | ...` alternatives. */ type Alternatives <: Pattern - def matchPattern_Alternatives(pattern: Pattern)(implicit ctx: Context): Option[Alternatives] + def matchPattern_Alternatives(pattern: Pattern) given (ctx: Context): Option[Alternatives] - def Pattern_Alternatives_patterns(self: Alternatives)(implicit ctx: Context): List[Pattern] + def Pattern_Alternatives_patterns(self: Alternatives) given (ctx: Context): List[Pattern] - def Pattern_Alternatives_module_apply(patterns: List[Pattern])(implicit ctx: Context): Alternatives - def Pattern_Alternatives_module_copy(original: Alternatives)(patterns: List[Pattern])(implicit ctx: Context): Alternatives + def Pattern_Alternatives_module_apply(patterns: List[Pattern]) given (ctx: Context): Alternatives + def Pattern_Alternatives_module_copy(original: Alternatives)(patterns: List[Pattern]) given (ctx: Context): Alternatives /** Pattern representing a `x: Y` type test. */ type TypeTest <: Pattern - def matchPattern_TypeTest(pattern: Pattern)(implicit ctx: Context): Option[TypeTest] + def matchPattern_TypeTest(pattern: Pattern) given (ctx: Context): Option[TypeTest] - def Pattern_TypeTest_tpt(self: TypeTest)(implicit ctx: Context): TypeTree + def Pattern_TypeTest_tpt(self: TypeTest) given (ctx: Context): TypeTree - def Pattern_TypeTest_module_apply(tpt: TypeTree)(implicit ctx: Context): TypeTest - def Pattern_TypeTest_module_copy(original: TypeTest)(tpt: TypeTree)(implicit ctx: Context): TypeTest + def Pattern_TypeTest_module_apply(tpt: TypeTree) given (ctx: Context): TypeTest + def Pattern_TypeTest_module_copy(original: TypeTest)(tpt: TypeTree) given (ctx: Context): TypeTest /** Pattern representing a `_` pattern */ type WildcardPattern <: Pattern - def matchPattern_WildcardPattern(pattern: Pattern)(implicit ctx: Context): Option[WildcardPattern] + def matchPattern_WildcardPattern(pattern: Pattern) given (ctx: Context): Option[WildcardPattern] - def Pattern_WildcardPattern_module_apply(tpe: TypeOrBounds)(implicit ctx: Context): WildcardPattern + def Pattern_WildcardPattern_module_apply(tpe: TypeOrBounds) given (ctx: Context): WildcardPattern // // TYPES @@ -824,25 +824,25 @@ trait Kernel { /** NoPrefix for a type selection */ type NoPrefix <: TypeOrBounds - def matchNoPrefix(x: TypeOrBounds)(implicit ctx: Context): Option[NoPrefix] + def matchNoPrefix(x: TypeOrBounds) given (ctx: Context): Option[NoPrefix] /** Type bounds */ type TypeBounds <: TypeOrBounds - def matchTypeBounds(x: TypeOrBounds)(implicit ctx: Context): Option[TypeBounds] + def matchTypeBounds(x: TypeOrBounds) given (ctx: Context): Option[TypeBounds] - def TypeBounds_low(self: TypeBounds)(implicit ctx: Context): Type - def TypeBounds_hi(self: TypeBounds)(implicit ctx: Context): Type + def TypeBounds_low(self: TypeBounds) given (ctx: Context): Type + def TypeBounds_hi(self: TypeBounds) given (ctx: Context): Type /** A type */ type Type <: TypeOrBounds - def matchType(x: TypeOrBounds)(implicit ctx: Context): Option[Type] + def matchType(x: TypeOrBounds) given (ctx: Context): Option[Type] - def Type_apply(clazz: Class[_])(implicit ctx: Context): Type + def Type_apply(clazz: Class[_]) given (ctx: Context): Type - def `Type_=:=`(self: Type)(that: Type)(implicit ctx: Context): Boolean - def `Type_<:<`(self: Type)(that: Type)(implicit ctx: Context): Boolean + def `Type_=:=`(self: Type)(that: Type) given (ctx: Context): Boolean + def `Type_<:<`(self: Type)(that: Type) given (ctx: Context): Boolean /** Widen from singleton type to its underlying non-singleton * base type by applying one or more `underlying` dereferences, @@ -853,24 +853,24 @@ trait Kernel { * def o: Outer * .widen = o.C */ - def Type_widen(self: Type)(implicit ctx: Context): Type + def Type_widen(self: Type) given (ctx: Context): Type /** 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 Type_dealias(self: Type)(implicit ctx: Context): Type + def Type_dealias(self: Type) given (ctx: Context): Type - def Type_classSymbol(self: Type)(implicit ctx: Context): Option[ClassDefSymbol] + def Type_classSymbol(self: Type) given (ctx: Context): Option[ClassDefSymbol] - def Type_typeSymbol(self: Type)(implicit ctx: Context): Symbol + def Type_typeSymbol(self: Type) given (ctx: Context): Symbol - def Type_isSingleton(self: Type)(implicit ctx: Context): Boolean + def Type_isSingleton(self: Type) given (ctx: Context): Boolean - def Type_memberType(self: Type)(member: Symbol)(implicit ctx: Context): Type + def Type_memberType(self: Type)(member: Symbol) given (ctx: Context): Type /** Is this type an instance of a non-bottom subclass of the given class `cls`? */ - def Type_derivesFrom(self: Type)(cls: ClassDefSymbol)(implicit ctx: Context): Boolean + def Type_derivesFrom(self: Type)(cls: ClassDefSymbol) given (ctx: Context): Boolean /** Is this type a function type? * @@ -881,155 +881,155 @@ trait Kernel { * - returns true for `given Int => Int` and `erased Int => Int` * - returns false for `List[Int]`, despite that `List[Int] <:< Int => Int`. */ - def Type_isFunctionType(self: Type)(implicit ctx: Context): Boolean + def Type_isFunctionType(self: Type) given (ctx: Context): Boolean /** Is this type an implicit function type? * * @see `Type_isFunctionType` */ - def Type_isImplicitFunctionType(self: Type)(implicit ctx: Context): Boolean + def Type_isImplicitFunctionType(self: Type) given (ctx: Context): Boolean /** Is this type an erased function type? * * @see `Type_isFunctionType` */ - def Type_isErasedFunctionType(self: Type)(implicit ctx: Context): Boolean + def Type_isErasedFunctionType(self: Type) given (ctx: Context): Boolean /** Is this type a dependent function type? * * @see `Type_isFunctionType` */ - def Type_isDependentFunctionType(self: Type)(implicit ctx: Context): Boolean + def Type_isDependentFunctionType(self: Type) given (ctx: Context): Boolean /** A singleton type representing a known constant value */ type ConstantType <: Type - def matchConstantType(tpe: TypeOrBounds)(implicit ctx: Context): Option[ConstantType] + def matchConstantType(tpe: TypeOrBounds) given (ctx: Context): Option[ConstantType] - def ConstantType_constant(self: ConstantType)(implicit ctx: Context): Constant + def ConstantType_constant(self: ConstantType) given (ctx: Context): Constant /** Type of a reference to a symbol */ type SymRef <: Type - def matchSymRef(tpe: TypeOrBounds)(implicit ctx: Context): Option[SymRef] + def matchSymRef(tpe: TypeOrBounds) given (ctx: Context): Option[SymRef] // TODO remove this method. May require splitting SymRef into TypeSymRef and TermSymRef - def matchSymRef_unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[(Symbol, TypeOrBounds /* Type | NoPrefix */)] + def matchSymRef_unapply(tpe: TypeOrBounds) given (ctx: Context): Option[(Symbol, TypeOrBounds /* Type | NoPrefix */)] - def SymRef_qualifier(self: SymRef)(implicit ctx: Context): TypeOrBounds + def SymRef_qualifier(self: SymRef) given (ctx: Context): TypeOrBounds /** Type of a reference to a term */ type TermRef <: Type - def matchTermRef(tpe: TypeOrBounds)(implicit ctx: Context): Option[TermRef] + def matchTermRef(tpe: TypeOrBounds) given (ctx: Context): Option[TermRef] - def TermRef_name(self: TermRef)(implicit ctx: Context): String - def TermRef_qualifier(self: TermRef)(implicit ctx: Context): TypeOrBounds + def TermRef_name(self: TermRef) given (ctx: Context): String + def TermRef_qualifier(self: TermRef) given (ctx: Context): TypeOrBounds - def TermRef_apply(qual: TypeOrBounds, name: String)(implicit ctx: Context): TermRef + def TermRef_apply(qual: TypeOrBounds, name: String) given (ctx: Context): TermRef /** Type of a reference to a type */ type TypeRef <: Type - def matchTypeRef(tpe: TypeOrBounds)(implicit ctx: Context): Option[TypeRef] + def matchTypeRef(tpe: TypeOrBounds) given (ctx: Context): Option[TypeRef] - def TypeRef_name(self: TypeRef)(implicit ctx: Context): String - def TypeRef_qualifier(self: TypeRef)(implicit ctx: Context): TypeOrBounds + def TypeRef_name(self: TypeRef) given (ctx: Context): String + def TypeRef_qualifier(self: TypeRef) given (ctx: Context): TypeOrBounds /** Type of a `super` refernce */ type SuperType <: Type - def matchSuperType(tpe: TypeOrBounds)(implicit ctx: Context): Option[SuperType] + def matchSuperType(tpe: TypeOrBounds) given (ctx: Context): Option[SuperType] - def SuperType_thistpe(self: SuperType)(implicit ctx: Context): Type - def SuperType_supertpe(self: SuperType)(implicit ctx: Context): Type + def SuperType_thistpe(self: SuperType) given (ctx: Context): Type + def SuperType_supertpe(self: SuperType) given (ctx: Context): Type /** A type with a type refinement `T { type U }` */ type Refinement <: Type - def matchRefinement(tpe: TypeOrBounds)(implicit ctx: Context): Option[Refinement] + def matchRefinement(tpe: TypeOrBounds) given (ctx: Context): Option[Refinement] - def Refinement_parent(self: Refinement)(implicit ctx: Context): Type - def Refinement_name(self: Refinement)(implicit ctx: Context): String - def Refinement_info(self: Refinement)(implicit ctx: Context): TypeOrBounds + def Refinement_parent(self: Refinement) given (ctx: Context): Type + def Refinement_name(self: Refinement) given (ctx: Context): String + def Refinement_info(self: Refinement) given (ctx: Context): TypeOrBounds /** A higher kinded type applied to some types `T[U]` */ type AppliedType <: Type - def matchAppliedType(tpe: TypeOrBounds)(implicit ctx: Context): Option[AppliedType] + def matchAppliedType(tpe: TypeOrBounds) given (ctx: Context): Option[AppliedType] - def AppliedType_tycon(self: AppliedType)(implicit ctx: Context): Type - def AppliedType_args(self: AppliedType)(implicit ctx: Context): List[TypeOrBounds] + def AppliedType_tycon(self: AppliedType) given (ctx: Context): Type + def AppliedType_args(self: AppliedType) given (ctx: Context): List[TypeOrBounds] /** A type with an anottation `T @foo` */ type AnnotatedType <: Type - def matchAnnotatedType(tpe: TypeOrBounds)(implicit ctx: Context): Option[AnnotatedType] + def matchAnnotatedType(tpe: TypeOrBounds) given (ctx: Context): Option[AnnotatedType] - def AnnotatedType_underlying(self: AnnotatedType)(implicit ctx: Context): Type - def AnnotatedType_annot(self: AnnotatedType)(implicit ctx: Context): Term + def AnnotatedType_underlying(self: AnnotatedType) given (ctx: Context): Type + def AnnotatedType_annot(self: AnnotatedType) given (ctx: Context): Term /** Intersection type `T & U` */ type AndType <: Type - def matchAndType(tpe: TypeOrBounds)(implicit ctx: Context): Option[AndType] + def matchAndType(tpe: TypeOrBounds) given (ctx: Context): Option[AndType] - def AndType_left(self: AndType)(implicit ctx: Context): Type - def AndType_right(self: AndType)(implicit ctx: Context): Type + def AndType_left(self: AndType) given (ctx: Context): Type + def AndType_right(self: AndType) given (ctx: Context): Type /** Union type `T | U` */ type OrType <: Type - def matchOrType(tpe: TypeOrBounds)(implicit ctx: Context): Option[OrType] + def matchOrType(tpe: TypeOrBounds) given (ctx: Context): Option[OrType] - def OrType_left(self: OrType)(implicit ctx: Context): Type - def OrType_right(self: OrType)(implicit ctx: Context): Type + def OrType_left(self: OrType) given (ctx: Context): Type + def OrType_right(self: OrType) given (ctx: Context): Type /** Type match `T match { case U => ... }` */ type MatchType <: Type - def matchMatchType(tpe: TypeOrBounds)(implicit ctx: Context): Option[MatchType] + def matchMatchType(tpe: TypeOrBounds) given (ctx: Context): Option[MatchType] - def MatchType_bound(self: MatchType)(implicit ctx: Context): Type - def MatchType_scrutinee(self: MatchType)(implicit ctx: Context): Type - def MatchType_cases(self: MatchType)(implicit ctx: Context): List[Type] + def MatchType_bound(self: MatchType) given (ctx: Context): Type + def MatchType_scrutinee(self: MatchType) given (ctx: Context): Type + def MatchType_cases(self: MatchType) given (ctx: Context): List[Type] /** Type of a by by name parameter */ type ByNameType <: Type - def matchByNameType(tpe: TypeOrBounds)(implicit ctx: Context): Option[ByNameType] + def matchByNameType(tpe: TypeOrBounds) given (ctx: Context): Option[ByNameType] - def ByNameType_underlying(self: ByNameType)(implicit ctx: Context): Type + def ByNameType_underlying(self: ByNameType) given (ctx: Context): Type /** Type of a parameter reference */ type ParamRef <: Type - def matchParamRef(tpe: TypeOrBounds)(implicit ctx: Context): Option[ParamRef] + def matchParamRef(tpe: TypeOrBounds) given (ctx: Context): Option[ParamRef] - def ParamRef_binder(self: ParamRef)(implicit ctx: Context): LambdaType[TypeOrBounds] - def ParamRef_paramNum(self: ParamRef)(implicit ctx: Context): Int + def ParamRef_binder(self: ParamRef) given (ctx: Context): LambdaType[TypeOrBounds] + def ParamRef_paramNum(self: ParamRef) given (ctx: Context): Int /** Type of `this` */ type ThisType <: Type - def matchThisType(tpe: TypeOrBounds)(implicit ctx: Context): Option[ThisType] + def matchThisType(tpe: TypeOrBounds) given (ctx: Context): Option[ThisType] - def ThisType_tref(self: ThisType)(implicit ctx: Context): Type + def ThisType_tref(self: ThisType) given (ctx: Context): Type /** A type that is recursively defined `this` */ type RecursiveThis <: Type - def matchRecursiveThis(tpe: TypeOrBounds)(implicit ctx: Context): Option[RecursiveThis] + def matchRecursiveThis(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveThis] - def RecursiveThis_binder(self: RecursiveThis)(implicit ctx: Context): RecursiveType + def RecursiveThis_binder(self: RecursiveThis) given (ctx: Context): RecursiveType /** A type that is recursively defined */ type RecursiveType <: Type - def matchRecursiveType(tpe: TypeOrBounds)(implicit ctx: Context): Option[RecursiveType] + def matchRecursiveType(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveType] - def RecursiveType_underlying(self: RecursiveType)(implicit ctx: Context): Type + def RecursiveType_underlying(self: RecursiveType) given (ctx: Context): Type // TODO can we add the bound back without an cake? // TODO is LambdaType really needed? ParamRefExtractor could be split into more precise extractors @@ -1039,31 +1039,31 @@ trait Kernel { /** Type of the definition of a method taking a single list of parameters. It's return type may be a MethodType. */ type MethodType <: LambdaType[Type] - def matchMethodType(tpe: TypeOrBounds)(implicit ctx: Context): Option[MethodType] + def matchMethodType(tpe: TypeOrBounds) given (ctx: Context): Option[MethodType] def MethodType_isErased(self: MethodType): Boolean def MethodType_isImplicit(self: MethodType): Boolean - def MethodType_paramNames(self: MethodType)(implicit ctx: Context): List[String] - def MethodType_paramTypes(self: MethodType)(implicit ctx: Context): List[Type] - def MethodType_resType(self: MethodType)(implicit ctx: Context): Type + def MethodType_paramNames(self: MethodType) given (ctx: Context): List[String] + def MethodType_paramTypes(self: MethodType) given (ctx: Context): List[Type] + def MethodType_resType(self: MethodType) given (ctx: Context): Type /** Type of the definition of a method taking a list of type parameters. It's return type may be a MethodType. */ type PolyType <: LambdaType[TypeBounds] - def matchPolyType(tpe: TypeOrBounds)(implicit ctx: Context): Option[PolyType] + def matchPolyType(tpe: TypeOrBounds) given (ctx: Context): Option[PolyType] - def PolyType_paramNames(self: PolyType)(implicit ctx: Context): List[String] - def PolyType_paramBounds(self: PolyType)(implicit ctx: Context): List[TypeBounds] - def PolyType_resType(self: PolyType)(implicit ctx: Context): Type + def PolyType_paramNames(self: PolyType) given (ctx: Context): List[String] + def PolyType_paramBounds(self: PolyType) given (ctx: Context): List[TypeBounds] + def PolyType_resType(self: PolyType) given (ctx: Context): Type /** Type of the definition of a type lambda taking a list of type parameters. It's return type may be a TypeLambda. */ type TypeLambda <: LambdaType[TypeBounds] - def matchTypeLambda(tpe: TypeOrBounds)(implicit ctx: Context): Option[TypeLambda] + def matchTypeLambda(tpe: TypeOrBounds) given (ctx: Context): Option[TypeLambda] - def TypeLambda_paramNames(self: TypeLambda)(implicit ctx: Context): List[String] - def TypeLambda_paramBounds(self: TypeLambda)(implicit ctx: Context): List[TypeBounds] - def TypeLambda_resType(self: TypeLambda)(implicit ctx: Context): Type + def TypeLambda_paramNames(self: TypeLambda) given (ctx: Context): List[String] + def TypeLambda_paramBounds(self: TypeLambda) given (ctx: Context): List[TypeBounds] + def TypeLambda_resType(self: TypeLambda) given (ctx: Context): Type // // IMPORT SELECTORS @@ -1078,22 +1078,22 @@ trait Kernel { type SimpleSelector <: ImportSelector - def matchSimpleSelector(self: ImportSelector)(implicit ctx: Context): Option[SimpleSelector] + def matchSimpleSelector(self: ImportSelector) given (ctx: Context): Option[SimpleSelector] - def SimpleSelector_selection(self: SimpleSelector)(implicit ctx: Context): Id + def SimpleSelector_selection(self: SimpleSelector) given (ctx: Context): Id type RenameSelector <: ImportSelector - def matchRenameSelector(self: ImportSelector)(implicit ctx: Context): Option[RenameSelector] + def matchRenameSelector(self: ImportSelector) given (ctx: Context): Option[RenameSelector] - def RenameSelector_from(self: RenameSelector)(implicit ctx: Context): Id - def RenameSelector_to(self: RenameSelector)(implicit ctx: Context): Id + def RenameSelector_from(self: RenameSelector) given (ctx: Context): Id + def RenameSelector_to(self: RenameSelector) given (ctx: Context): Id type OmitSelector <: ImportSelector - def matchOmitSelector(self: ImportSelector)(implicit ctx: Context): Option[OmitSelector] + def matchOmitSelector(self: ImportSelector) given (ctx: Context): Option[OmitSelector] - def SimpleSelector_omited(self: OmitSelector)(implicit ctx: Context): Id + def SimpleSelector_omited(self: OmitSelector) given (ctx: Context): Id // // IDENTIFIERS @@ -1103,10 +1103,10 @@ trait Kernel { type Id <: AnyRef /** Position in the source code */ - def Id_pos(self: Id)(implicit ctx: Context): Position + def Id_pos(self: Id) given (ctx: Context): Position /** Name of the identifier */ - def Id_name(self: Id)(implicit ctx: Context): String + def Id_name(self: Id) given (ctx: Context): String // // SIGNATURES @@ -1204,159 +1204,159 @@ trait Kernel { type Symbol <: AnyRef /** Owner of this symbol. The owner is the symbol in which this symbol is defined. */ - def Symbol_owner(self: Symbol)(implicit ctx: Context): Symbol + def Symbol_owner(self: Symbol) given (ctx: Context): Symbol /** Flags of this symbol */ - def Symbol_flags(self: Symbol)(implicit ctx: Context): Flags + def Symbol_flags(self: Symbol) given (ctx: Context): Flags - def Symbol_isLocalDummy(self: Symbol)(implicit ctx: Context): Boolean + def Symbol_isLocalDummy(self: Symbol) given (ctx: Context): Boolean - def Symbol_isRefinementClass(self: Symbol)(implicit ctx: Context): Boolean + def Symbol_isRefinementClass(self: Symbol) given (ctx: Context): Boolean - def Symbol_isAliasType(self: Symbol)(implicit ctx: Context): Boolean + def Symbol_isAliasType(self: Symbol) given (ctx: Context): Boolean - def Symbol_isAnonymousClass(self: Symbol)(implicit ctx: Context): Boolean + def Symbol_isAnonymousClass(self: Symbol) given (ctx: Context): Boolean - def Symbol_isAnonymousFunction(self: Symbol)(implicit ctx: Context): Boolean + def Symbol_isAnonymousFunction(self: Symbol) given (ctx: Context): Boolean - def Symbol_isAbstractType(self: Symbol)(implicit ctx: Context): Boolean + def Symbol_isAbstractType(self: Symbol) given (ctx: Context): Boolean - def Symbol_isClassConstructor(self: Symbol)(implicit ctx: Context): Boolean + def Symbol_isClassConstructor(self: Symbol) given (ctx: Context): Boolean /** This symbol is private within the resulting type. */ - def Symbol_privateWithin(self: Symbol)(implicit ctx: Context): Option[Type] + def Symbol_privateWithin(self: Symbol) given (ctx: Context): Option[Type] /** This symbol is protected within the resulting type. */ - def Symbol_protectedWithin(self: Symbol)(implicit ctx: Context): Option[Type] + def Symbol_protectedWithin(self: Symbol) given (ctx: Context): Option[Type] /** The name of this symbol. */ - def Symbol_name(self: Symbol)(implicit ctx: Context): String + def Symbol_name(self: Symbol) given (ctx: Context): String /** The full name of this symbol up to the root package. */ - def Symbol_fullName(self: Symbol)(implicit ctx: Context): String + def Symbol_fullName(self: Symbol) given (ctx: Context): String /** The position of this symbol */ - def Symbol_pos(self: Symbol)(implicit ctx: Context): Position + def Symbol_pos(self: Symbol) given (ctx: Context): Position - def Symbol_localContext(self: Symbol)(implicit ctx: Context): Context + def Symbol_localContext(self: Symbol) given (ctx: Context): Context /** The comment of the symbol */ - def Symbol_comment(self: Symbol)(implicit ctx: Context): Option[Comment] + def Symbol_comment(self: Symbol) given (ctx: Context): Option[Comment] /** Annotations attached to this symbol */ - def Symbol_annots(self: Symbol)(implicit ctx: Context): List[Term] + def Symbol_annots(self: Symbol) given (ctx: Context): List[Term] - def Symbol_isDefinedInCurrentRun(self: Symbol)(implicit ctx: Context): Boolean + def Symbol_isDefinedInCurrentRun(self: Symbol) given (ctx: Context): Boolean /** Symbol of a package definition */ type PackageDefSymbol <: Symbol - def matchPackageDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[PackageDefSymbol] + def matchPackageDefSymbol(symbol: Symbol) given (ctx: Context): Option[PackageDefSymbol] - def PackageDefSymbol_tree(self: PackageDefSymbol)(implicit ctx: Context): PackageDef + def PackageDefSymbol_tree(self: PackageDefSymbol) given (ctx: Context): PackageDef type TypeSymbol <: Symbol - def matchTypeSymbol(symbol: Symbol)(implicit ctx: Context): Option[TypeSymbol] + def matchTypeSymbol(symbol: Symbol) given (ctx: Context): Option[TypeSymbol] /** Symbol of a class definition. This includes anonymous class definitions and the class of a module object. */ type ClassDefSymbol <: TypeSymbol - def matchClassDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[ClassDefSymbol] + def matchClassDefSymbol(symbol: Symbol) given (ctx: Context): Option[ClassDefSymbol] /** ClassDef tree of this definition */ - def ClassDefSymbol_tree(self: ClassDefSymbol)(implicit ctx: Context): ClassDef + def ClassDefSymbol_tree(self: ClassDefSymbol) given (ctx: Context): ClassDef /** Fields directly declared in the class */ - def ClassDefSymbol_fields(self: Symbol)(implicit ctx: Context): List[Symbol] + def ClassDefSymbol_fields(self: Symbol) given (ctx: Context): List[Symbol] /** Field with the given name directly declared in the class */ - def ClassDefSymbol_field(self: Symbol)(name: String)(implicit ctx: Context): Option[Symbol] + def ClassDefSymbol_field(self: Symbol)(name: String) given (ctx: Context): Option[Symbol] /** Get non-private named methods defined directly inside the class */ - def ClassDefSymbol_classMethod(self: Symbol)(name: String)(implicit ctx: Context): List[DefDefSymbol] + def ClassDefSymbol_classMethod(self: Symbol)(name: String) given (ctx: Context): List[DefDefSymbol] /** Get all non-private methods defined directly inside the class, excluding constructors */ - def ClassDefSymbol_classMethods(self: Symbol)(implicit ctx: Context): List[DefDefSymbol] + def ClassDefSymbol_classMethods(self: Symbol) given (ctx: Context): List[DefDefSymbol] /** Get named non-private methods declared or inherited */ - def ClassDefSymbol_method(self: Symbol)(name: String)(implicit ctx: Context): List[DefDefSymbol] + def ClassDefSymbol_method(self: Symbol)(name: String) given (ctx: Context): List[DefDefSymbol] /** Get all non-private methods declared or inherited */ - def ClassDefSymbol_methods(self: Symbol)(implicit ctx: Context): List[DefDefSymbol] + def ClassDefSymbol_methods(self: Symbol) given (ctx: Context): List[DefDefSymbol] /** Fields of a case class type -- only the ones declared in primary constructor */ - def ClassDefSymbol_caseFields(self: Symbol)(implicit ctx: Context): List[ValDefSymbol] + def ClassDefSymbol_caseFields(self: Symbol) given (ctx: Context): List[ValDefSymbol] /** The class symbol of the companion module class */ - def ClassDefSymbol_companionClass(self: Symbol)(implicit ctx: Context): Option[ClassDefSymbol] + def ClassDefSymbol_companionClass(self: Symbol) given (ctx: Context): Option[ClassDefSymbol] /** The symbol of the companion module */ - def ClassDefSymbol_companionModule(self: Symbol)(implicit ctx: Context): Option[ValDefSymbol] + def ClassDefSymbol_companionModule(self: Symbol) given (ctx: Context): Option[ValDefSymbol] /** The symbol of the class of the companion module */ - def ClassDefSymbol_moduleClass(self: Symbol)(implicit ctx: Context): Option[Symbol] + def ClassDefSymbol_moduleClass(self: Symbol) given (ctx: Context): Option[Symbol] - def ClassDefSymbol_of(fullName: String)(implicit ctx: Context): ClassDefSymbol + def ClassDefSymbol_of(fullName: String) given (ctx: Context): ClassDefSymbol /** Symbol of a type (parameter or member) definition. */ type TypeDefSymbol <: TypeSymbol - def matchTypeDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[TypeDefSymbol] + def matchTypeDefSymbol(symbol: Symbol) given (ctx: Context): Option[TypeDefSymbol] - def TypeDefSymbol_isTypeParam(self: TypeDefSymbol)(implicit ctx: Context): Boolean + def TypeDefSymbol_isTypeParam(self: TypeDefSymbol) given (ctx: Context): Boolean /** TypeDef tree of this definition */ - def TypeDefSymbol_tree(self: TypeDefSymbol)(implicit ctx: Context): TypeDef + def TypeDefSymbol_tree(self: TypeDefSymbol) given (ctx: Context): TypeDef /** Symbol representing a bind definition. */ type TypeBindSymbol <: TypeSymbol - def matchTypeBindSymbol(symbol: Symbol)(implicit ctx: Context): Option[TypeBindSymbol] + def matchTypeBindSymbol(symbol: Symbol) given (ctx: Context): Option[TypeBindSymbol] /** TypeBind pattern of this definition */ - def TypeBindSymbol_tree(self: TypeBindSymbol)(implicit ctx: Context): TypeBind + def TypeBindSymbol_tree(self: TypeBindSymbol) given (ctx: Context): TypeBind type TermSymbol <: Symbol - def matchTermSymbol(symbol: Symbol)(implicit ctx: Context): Option[TermSymbol] + def matchTermSymbol(symbol: Symbol) given (ctx: Context): Option[TermSymbol] /** Symbol representing a method definition. */ type DefDefSymbol <: TermSymbol - def matchDefDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[DefDefSymbol] + def matchDefDefSymbol(symbol: Symbol) given (ctx: Context): Option[DefDefSymbol] /** DefDef tree of this definition */ - def DefDefSymbol_tree(self: DefDefSymbol)(implicit ctx: Context): DefDef + def DefDefSymbol_tree(self: DefDefSymbol) given (ctx: Context): DefDef /** Signature of this definition */ - def DefDefSymbol_signature(self: DefDefSymbol)(implicit ctx: Context): Signature + def DefDefSymbol_signature(self: DefDefSymbol) given (ctx: Context): Signature /** Symbol representing a value definition. This includes `val`, `lazy val`, `var`, `object` and parameter definitions. */ type ValDefSymbol <: TermSymbol - def matchValDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[ValDefSymbol] + def matchValDefSymbol(symbol: Symbol) given (ctx: Context): Option[ValDefSymbol] /** ValDef tree of this definition */ - def ValDefSymbol_tree(self: ValDefSymbol)(implicit ctx: Context): ValDef + def ValDefSymbol_tree(self: ValDefSymbol) given (ctx: Context): ValDef /** The class symbol of the companion module class */ - def ValDefSymbol_moduleClass(self: ValDefSymbol)(implicit ctx: Context): Option[ClassDefSymbol] + def ValDefSymbol_moduleClass(self: ValDefSymbol) given (ctx: Context): Option[ClassDefSymbol] - def ValDefSymbol_companionClass(self: ValDefSymbol)(implicit ctx: Context): Option[ClassDefSymbol] + def ValDefSymbol_companionClass(self: ValDefSymbol) given (ctx: Context): Option[ClassDefSymbol] /** Symbol representing a bind definition. */ type BindSymbol <: TermSymbol - def matchBindSymbol(symbol: Symbol)(implicit ctx: Context): Option[BindSymbol] + def matchBindSymbol(symbol: Symbol) given (ctx: Context): Option[BindSymbol] /** Bind pattern of this definition */ - def BindSymbol_tree(self: BindSymbol)(implicit ctx: Context): Bind + def BindSymbol_tree(self: BindSymbol) given (ctx: Context): Bind /** No symbol available. */ type NoSymbol <: Symbol - def matchNoSymbol(symbol: Symbol)(implicit ctx: Context): Boolean + def matchNoSymbol(symbol: Symbol) given (ctx: Context): Boolean // // FLAGS @@ -1416,20 +1416,20 @@ trait Kernel { // /** View this expression `quoted.Expr[_]` as a `Term` */ - def QuotedExpr_unseal(self: scala.quoted.Expr[_])(implicit ctx: Context): Term + def QuotedExpr_unseal(self: scala.quoted.Expr[_]) given (ctx: Context): Term /** Checked cast to a `quoted.Expr[U]` */ - def QuotedExpr_cast[U](self: scala.quoted.Expr[_])(implicit tp: scala.quoted.Type[U], ctx: Context): scala.quoted.Expr[U] + def QuotedExpr_cast[U](self: scala.quoted.Expr[_]) given (tp: scala.quoted.Type[U], ctx: Context): scala.quoted.Expr[U] /** View this expression `quoted.Type[T]` as a `TypeTree` */ - def QuotedType_unseal(self: scala.quoted.Type[_])(implicit ctx: Context): TypeTree + def QuotedType_unseal(self: scala.quoted.Type[_]) given (ctx: Context): TypeTree /** Convert `Term` to an `quoted.Expr[Any]` */ - def QuotedExpr_seal(self: Term)(implicit ctx: Context): scala.quoted.Expr[Any] + def QuotedExpr_seal(self: Term) given (ctx: Context): scala.quoted.Expr[Any] /** Convert `Type` to an `quoted.Type[_]` */ - def QuotedType_seal(self: Type)(implicit ctx: Context): scala.quoted.Type[_] + def QuotedType_seal(self: Type) given (ctx: Context): scala.quoted.Type[_] // // DEFINITIONS @@ -1515,21 +1515,21 @@ trait Kernel { type ImplicitSearchResult <: AnyRef type ImplicitSearchSuccess <: ImplicitSearchResult - def matchImplicitSearchSuccess(isr: ImplicitSearchResult)(implicit ctx: Context): Option[ImplicitSearchSuccess] - def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess)(implicit ctx: Context): Term + def matchImplicitSearchSuccess(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchSuccess] + def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess) given (ctx: Context): Term type ImplicitSearchFailure <: ImplicitSearchResult - def matchImplicitSearchFailure(isr: ImplicitSearchResult)(implicit ctx: Context): Option[ImplicitSearchFailure] - def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure)(implicit ctx: Context): String + def matchImplicitSearchFailure(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchFailure] + def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure) given (ctx: Context): String type DivergingImplicit <: ImplicitSearchFailure - def matchDivergingImplicit(isr: ImplicitSearchResult)(implicit ctx: Context): Option[DivergingImplicit] + def matchDivergingImplicit(isr: ImplicitSearchResult) given (ctx: Context): Option[DivergingImplicit] type NoMatchingImplicits <: ImplicitSearchFailure - def matchNoMatchingImplicits(isr: ImplicitSearchResult)(implicit ctx: Context): Option[NoMatchingImplicits] + def matchNoMatchingImplicits(isr: ImplicitSearchResult) given (ctx: Context): Option[NoMatchingImplicits] type AmbiguousImplicits <: ImplicitSearchFailure - def matchAmbiguousImplicits(isr: ImplicitSearchResult)(implicit ctx: Context): Option[AmbiguousImplicits] + def matchAmbiguousImplicits(isr: ImplicitSearchResult) given (ctx: Context): Option[AmbiguousImplicits] /** Find an implicit of type `T` in the current scope given by `ctx`. * Return an `ImplicitSearchResult`. @@ -1537,6 +1537,6 @@ trait Kernel { * @param tpe type of the implicit parameter * @param ctx current context */ - def searchImplicit(tpe: Type)(implicit ctx: Context): ImplicitSearchResult + def searchImplicit(tpe: Type) given (ctx: Context): ImplicitSearchResult } diff --git a/library/src/scala/tasty/reflect/PatternOps.scala b/library/src/scala/tasty/reflect/PatternOps.scala index dd5eb335773f..6207fe514a8d 100644 --- a/library/src/scala/tasty/reflect/PatternOps.scala +++ b/library/src/scala/tasty/reflect/PatternOps.scala @@ -4,116 +4,116 @@ package reflect trait PatternOps extends Core { implicit class ValueAPI(value: Value) { - def value(implicit ctx: Context): Term = kernel.Pattern_Value_value(value) + def value given (ctx: Context): Term = kernel.Pattern_Value_value(value) } implicit class BindAPI(bind: Bind) { - def name(implicit ctx: Context): String = kernel.Pattern_Bind_name(bind) - def pattern(implicit ctx: Context): Pattern = kernel.Pattern_Bind_pattern(bind) + def name given (ctx: Context): String = kernel.Pattern_Bind_name(bind) + def pattern given (ctx: Context): Pattern = kernel.Pattern_Bind_pattern(bind) } implicit class UnapplyAPI(unapply: Unapply) { - def fun(implicit ctx: Context): Term = kernel.Pattern_Unapply_fun(unapply) - def implicits(implicit ctx: Context): List[Term] = kernel.Pattern_Unapply_implicits(unapply) - def patterns(implicit ctx: Context): List[Pattern] = kernel.Pattern_Unapply_patterns(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) } implicit class AlternativesAPI(alternatives: Alternatives) { - def patterns(implicit ctx: Context): List[Pattern] = kernel.Pattern_Alternatives_patterns(alternatives) + def patterns given (ctx: Context): List[Pattern] = kernel.Pattern_Alternatives_patterns(alternatives) } implicit class TypeTestAPI(typeTest: TypeTest) { - def tpt(implicit ctx: Context): TypeTree = kernel.Pattern_TypeTest_tpt(typeTest) + def tpt given (ctx: Context): TypeTree = kernel.Pattern_TypeTest_tpt(typeTest) } implicit class PatternAPI(self: Pattern) { /** Position in the source code */ - def pos(implicit ctx: Context): Position = kernel.Pattern_pos(self) + def pos given (ctx: Context): Position = kernel.Pattern_pos(self) - def tpe(implicit ctx: Context): Type = kernel.Pattern_tpe(self) + def tpe given (ctx: Context): Type = kernel.Pattern_tpe(self) - def symbol(implicit ctx: Context): Symbol = kernel.Pattern_symbol(self) + def symbol given (ctx: Context): Symbol = kernel.Pattern_symbol(self) } object Pattern { object IsValue { - def unapply(pattern: Pattern)(implicit ctx: Context): Option[Value] = + def unapply(pattern: Pattern) given (ctx: Context): Option[Value] = kernel.matchPattern_Value(pattern) } object Value { - def apply(tpt: Term)(implicit ctx: Context): Value = + def apply(tpt: Term) given (ctx: Context): Value = kernel.Pattern_Value_module_apply(tpt) - def copy(original: Value)(tpt: Term)(implicit ctx: Context): Value = + def copy(original: Value)(tpt: Term) given (ctx: Context): Value = kernel.Pattern_Value_module_copy(original)(tpt) - def unapply(pattern: Pattern)(implicit ctx: Context): Option[Term] = + def unapply(pattern: Pattern) given (ctx: Context): Option[Term] = kernel.matchPattern_Value(pattern).map(_.value) } object IsBind { - def unapply(pattern: Pattern)(implicit ctx: Context): Option[Bind] = + def unapply(pattern: Pattern) given (ctx: Context): Option[Bind] = kernel.matchPattern_Bind(pattern) } object Bind { - // TODO def apply(name: String, pattern: Pattern)(implicit ctx: Context): Bind - def copy(original: Bind)(name: String, pattern: Pattern)(implicit ctx: Context): 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) - def unapply(pattern: Pattern)(implicit ctx: Context): Option[(String, Pattern)] = + def unapply(pattern: Pattern) given (ctx: Context): Option[(String, Pattern)] = kernel.matchPattern_Bind(pattern).map(x => (x.name, x.pattern)) } object IsUnapply { - def unapply(pattern: Pattern)(implicit ctx: Context): Option[Unapply] = + def unapply(pattern: Pattern) given (ctx: Context): Option[Unapply] = kernel.matchPattern_Unapply(pattern) } object Unapply { - // TODO def apply(fun: Term, implicits: List[Term], patterns: List[Pattern])(implicit ctx: Context): Unapply - def copy(original: Unapply)(fun: Term, implicits: List[Term], patterns: List[Pattern])(implicit ctx: Context): 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) - def unapply(pattern: Pattern)(implicit ctx: Context): Option[(Term, List[Term], List[Pattern])] = + 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)) } object IsAlternatives { - def unapply(pattern: Pattern)(implicit ctx: Context): Option[Alternatives] = + def unapply(pattern: Pattern) given (ctx: Context): Option[Alternatives] = kernel.matchPattern_Alternatives(pattern) } object Alternatives { - def apply(patterns: List[Pattern])(implicit ctx: Context): Alternatives = + def apply(patterns: List[Pattern]) given (ctx: Context): Alternatives = kernel.Pattern_Alternatives_module_apply(patterns) - def copy(original: Alternatives)(patterns: List[Pattern])(implicit ctx: Context): Alternatives = + def copy(original: Alternatives)(patterns: List[Pattern]) given (ctx: Context): Alternatives = kernel.Pattern_Alternatives_module_copy(original)(patterns) - def unapply(pattern: Pattern)(implicit ctx: Context): Option[List[Pattern]] = + def unapply(pattern: Pattern) given (ctx: Context): Option[List[Pattern]] = kernel.matchPattern_Alternatives(pattern).map(_.patterns) } object IsTypeTest { - def unapply(pattern: Pattern)(implicit ctx: Context): Option[TypeTest] = + def unapply(pattern: Pattern) given (ctx: Context): Option[TypeTest] = kernel.matchPattern_TypeTest(pattern) } object TypeTest { - def apply(tpt: TypeTree)(implicit ctx: Context): TypeTest = + def apply(tpt: TypeTree) given (ctx: Context): TypeTest = kernel.Pattern_TypeTest_module_apply(tpt) - def copy(original: TypeTest)(tpt: TypeTree)(implicit ctx: Context): TypeTest = + def copy(original: TypeTest)(tpt: TypeTree) given (ctx: Context): TypeTest = kernel.Pattern_TypeTest_module_copy(original)(tpt) - def unapply(pattern: Pattern)(implicit ctx: Context): Option[TypeTree] = + def unapply(pattern: Pattern) given (ctx: Context): Option[TypeTree] = kernel.matchPattern_TypeTest(pattern).map(_.tpt) } object IsWildcardPattern { - def unapply(pattern: Pattern)(implicit ctx: Context): Option[WildcardPattern] = + def unapply(pattern: Pattern) given (ctx: Context): Option[WildcardPattern] = kernel.matchPattern_WildcardPattern(pattern) } object WildcardPattern { - def apply(tpe: TypeOrBounds)(implicit ctx: Context): WildcardPattern = + def apply(tpe: TypeOrBounds) given (ctx: Context): WildcardPattern = kernel.Pattern_WildcardPattern_module_apply(tpe) - def unapply(pattern: Pattern)(implicit ctx: Context): Boolean = + def unapply(pattern: Pattern) given (ctx: Context): Boolean = kernel.matchPattern_WildcardPattern(pattern).isDefined } diff --git a/library/src/scala/tasty/reflect/Printers.scala b/library/src/scala/tasty/reflect/Printers.scala index 6530eebc0bbf..539e98966ac2 100644 --- a/library/src/scala/tasty/reflect/Printers.scala +++ b/library/src/scala/tasty/reflect/Printers.scala @@ -21,116 +21,116 @@ trait Printers /** Adds `show` as an extension method of a `Tree` */ implicit class TreeShowDeco(tree: Tree) { /** Shows the tree as extractors */ - def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showTree(tree) + def showExtractors given (ctx: Context): String = new ExtractorsPrinter().showTree(tree) /** Shows the tree as fully typed source code */ - def show(implicit ctx: Context): String = show(SyntaxHighlight.plain) + def show given (ctx: Context): String = show(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def show(syntaxHighlight: SyntaxHighlight)(implicit ctx: Context): String = + def show(syntaxHighlight: SyntaxHighlight) given (ctx: Context): String = new SourceCodePrinter(syntaxHighlight).showTree(tree) } /** Adds `show` as an extension method of a `TypeOrBounds` */ implicit class TypeOrBoundsShowDeco(tpe: TypeOrBounds) { /** Shows the tree as extractors */ - def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showTypeOrBounds(tpe) + def showExtractors given (ctx: Context): String = new ExtractorsPrinter().showTypeOrBounds(tpe) /** Shows the tree as fully typed source code */ - def show(implicit ctx: Context): String = show(SyntaxHighlight.plain) + def show given (ctx: Context): String = show(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def show(syntaxHighlight: SyntaxHighlight)(implicit ctx: Context): String = + def show(syntaxHighlight: SyntaxHighlight) given (ctx: Context): String = new SourceCodePrinter(syntaxHighlight).showTypeOrBounds(tpe) } /** Adds `show` as an extension method of a `Pattern` */ implicit class PatternShowDeco(pattern: Pattern) { /** Shows the tree as extractors */ - def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showPattern(pattern) + def showExtractors given (ctx: Context): String = new ExtractorsPrinter().showPattern(pattern) /** Shows the tree as fully typed source code */ - def show(implicit ctx: Context): String = show(SyntaxHighlight.plain) + def show given (ctx: Context): String = show(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def show(syntaxHighlight: SyntaxHighlight)(implicit ctx: Context): String = + def show(syntaxHighlight: SyntaxHighlight) given (ctx: Context): String = new SourceCodePrinter(syntaxHighlight).showPattern(pattern) } /** Adds `show` as an extension method of a `Constant` */ implicit class ConstantShowDeco(const: Constant) { /** Shows the tree as extractors */ - def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showConstant(const) + def showExtractors given (ctx: Context): String = new ExtractorsPrinter().showConstant(const) /** Shows the tree as fully typed source code */ - def show(implicit ctx: Context): String = show(SyntaxHighlight.plain) + def show given (ctx: Context): String = show(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def show(syntaxHighlight: SyntaxHighlight)(implicit ctx: Context): String = + def show(syntaxHighlight: SyntaxHighlight) given (ctx: Context): String = new SourceCodePrinter(syntaxHighlight).showConstant(const) } /** Adds `show` as an extension method of a `Symbol` */ implicit class SymbolShowDeco(symbol: Symbol) { /** Shows the tree as extractors */ - def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showSymbol(symbol) + def showExtractors given (ctx: Context): String = new ExtractorsPrinter().showSymbol(symbol) /** Shows the tree as fully typed source code */ - def show(implicit ctx: Context): String = show(SyntaxHighlight.plain) + def show given (ctx: Context): String = show(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def show(syntaxHighlight: SyntaxHighlight)(implicit ctx: Context): String = + def show(syntaxHighlight: SyntaxHighlight) given (ctx: Context): String = new SourceCodePrinter(syntaxHighlight).showSymbol(symbol) } /** Adds `show` as an extension method of a `Flags` */ implicit class FlagsShowDeco(flags: Flags) { /** Shows the tree as extractors */ - def showExtractors(implicit ctx: Context): String = new ExtractorsPrinter().showFlags(flags) + def showExtractors given (ctx: Context): String = new ExtractorsPrinter().showFlags(flags) /** Shows the tree as fully typed source code */ - def show(implicit ctx: Context): String = show(SyntaxHighlight.plain) + def show given (ctx: Context): String = show(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def show(syntaxHighlight: SyntaxHighlight)(implicit ctx: Context): String = + def show(syntaxHighlight: SyntaxHighlight) given (ctx: Context): String = new SourceCodePrinter(syntaxHighlight).showFlags(flags) } abstract class Printer { - def showTree(tree: Tree)(implicit ctx: Context): String + def showTree(tree: Tree) given (ctx: Context): String - def showPattern(pattern: Pattern)(implicit ctx: Context): String + def showPattern(pattern: Pattern) given (ctx: Context): String - def showTypeOrBounds(tpe: TypeOrBounds)(implicit ctx: Context): String + def showTypeOrBounds(tpe: TypeOrBounds) given (ctx: Context): String - def showConstant(const: Constant)(implicit ctx: Context): String + def showConstant(const: Constant) given (ctx: Context): String - def showSymbol(symbol: Symbol)(implicit ctx: Context): String + def showSymbol(symbol: Symbol) given (ctx: Context): String - def showFlags(flags: Flags)(implicit ctx: Context): String + def showFlags(flags: Flags) given (ctx: Context): String } class ExtractorsPrinter extends Printer { - def showTree(tree: Tree)(implicit ctx: Context): String = + def showTree(tree: Tree) given (ctx: Context): String = new Buffer().visitTree(tree).result() - def showPattern(pattern: Pattern)(implicit ctx: Context): String = + def showPattern(pattern: Pattern) given (ctx: Context): String = new Buffer().visitPattern(pattern).result() - def showTypeOrBounds(tpe: TypeOrBounds)(implicit ctx: Context): String = + def showTypeOrBounds(tpe: TypeOrBounds) given (ctx: Context): String = new Buffer().visitType(tpe).result() - def showConstant(const: Constant)(implicit ctx: Context): String = + def showConstant(const: Constant) given (ctx: Context): String = new Buffer().visitConstant(const).result() - def showSymbol(symbol: Symbol)(implicit ctx: Context): String = + def showSymbol(symbol: Symbol) given (ctx: Context): String = new Buffer().visitSymbol(symbol).result() - def showFlags(flags: Flags)(implicit ctx: Context): String = { + def showFlags(flags: Flags) given (ctx: Context): String = { val flagList = List.newBuilder[String] if (flags.is(Flags.Private)) flagList += "Flags.Private" if (flags.is(Flags.Protected)) flagList += "Flags.Protected" @@ -168,7 +168,7 @@ trait Printers flagList.result().mkString(" | ") } - private class Buffer(implicit ctx: Context) { self => + private class Buffer given (ctx: Context) { self => private val sb: StringBuilder = new StringBuilder @@ -459,22 +459,22 @@ trait Printers class SourceCodePrinter(syntaxHighlight: SyntaxHighlight) extends Printer { import syntaxHighlight._ - def showTree(tree: Tree)(implicit ctx: Context): String = + def showTree(tree: Tree) given (ctx: Context): String = (new Buffer).printTree(tree).result() - def showPattern(pattern: Pattern)(implicit ctx: Context): String = + def showPattern(pattern: Pattern) given (ctx: Context): String = (new Buffer).printPattern(pattern).result() - def showTypeOrBounds(tpe: TypeOrBounds)(implicit ctx: Context): String = - (new Buffer).printTypeOrBound(tpe)(None).result() + def showTypeOrBounds(tpe: TypeOrBounds) given (ctx: Context): String = + ((new Buffer).printTypeOrBound(tpe) given None).result() - def showConstant(const: Constant)(implicit ctx: Context): String = + def showConstant(const: Constant) given (ctx: Context): String = (new Buffer).printConstant(const).result() - def showSymbol(symbol: Symbol)(implicit ctx: Context): String = + def showSymbol(symbol: Symbol) given (ctx: Context): String = symbol.fullName - def showFlags(flags: Flags)(implicit ctx: Context): String = { + def showFlags(flags: Flags) given (ctx: Context): String = { val flagList = List.newBuilder[String] if (flags.is(Flags.Private)) flagList += "private" if (flags.is(Flags.Protected)) flagList += "protected" @@ -512,7 +512,7 @@ trait Printers flagList.result().mkString("/*", " ", "*/") } - private class Buffer(implicit ctx: Context) { + private class Buffer given (ctx: Context) { private[this] val sb: StringBuilder = new StringBuilder @@ -549,7 +549,7 @@ trait Printers def lineBreak(): String = "\n" + (" " * indent) def doubleLineBreak(): String = "\n\n" + (" " * indent) - def printTree(tree: Tree)(implicit elideThis: Option[Symbol] = None): Buffer = tree match { + def printTree(tree: Tree) given (elideThis: Option[Symbol] = None): Buffer = tree match { case PackageObject(body)=> printTree(body) // Print package object @@ -615,19 +615,19 @@ trait Printers def printParent(parent: Tree /* Term | TypeTree */, needEmptyParens: Boolean = false): Unit = parent match { case IsTypeTree(parent) => - printTypeTree(parent)(Some(cdef.symbol)) + printTypeTree(parent) given Some(cdef.symbol) case IsTerm(TypeApply(fun, targs)) => printParent(fun) case IsTerm(Apply(fun@Apply(_,_), args)) => printParent(fun, true) if (!args.isEmpty || needEmptyParens) - inParens(printTrees(args, ", ")(Some(cdef.symbol))) + inParens(printTrees(args, ", ") given Some(cdef.symbol)) case IsTerm(Apply(fun, args)) => printParent(fun) if (!args.isEmpty || needEmptyParens) - inParens(printTrees(args, ", ")(Some(cdef.symbol))) + inParens(printTrees(args, ", ") given Some(cdef.symbol)) case IsTerm(Select(IsNew(newTree), _)) => - printType(newTree.tpe)(Some(cdef.symbol)) + printType(newTree.tpe) given Some(cdef.symbol) case IsTerm(parent) => throw new MatchError(parent.showExtractors) } @@ -679,7 +679,7 @@ trait Printers indented { val name1 = if (name == "_") "this" else name this += " " += highlightValDef(name1) += ": " - printTypeTree(tpt)(Some(cdef.symbol)) + printTypeTree(tpt) given Some(cdef.symbol) this += " =>" } } @@ -1012,7 +1012,7 @@ trait Printers (flatStats.result(), flatExpr) } - def printFlatBlock(stats: List[Statement], expr: Term)(implicit elideThis: Option[Symbol]): Buffer = { + def printFlatBlock(stats: List[Statement], expr: Term) given (elideThis: Option[Symbol]): Buffer = { val (stats1, expr1) = flatBlock(stats, expr) val stats2 = stats1.filter { case IsTypeDef(tree) => !tree.symbol.annots.exists(_.symbol.owner.fullName == "scala.internal.Quoted$.quoteTypeTag") @@ -1029,7 +1029,7 @@ trait Printers } } - def printStats(stats: List[Tree], expr: Tree)(implicit elideThis: Option[Symbol]): Unit = { + def printStats(stats: List[Tree], expr: Tree) given (elideThis: Option[Symbol]): Unit = { def printSeparator(next: Tree): Unit = { // Avoid accidental application of opening `{` on next line with a double break def rec(next: Tree): Unit = next match { @@ -1077,13 +1077,13 @@ trait Printers this } - def printTrees(trees: List[Tree], sep: String)(implicit elideThis: Option[Symbol]): Buffer = + def printTrees(trees: List[Tree], sep: String) given (elideThis: Option[Symbol]): Buffer = printList(trees, sep, (t: Tree) => printTree(t)) - def printTypeTrees(trees: List[TypeTree], sep: String)(implicit elideThis: Option[Symbol] = None): Buffer = + def printTypeTrees(trees: List[TypeTree], sep: String) given (elideThis: Option[Symbol] = None): Buffer = printList(trees, sep, (t: TypeTree) => printTypeTree(t)) - def printTypes(trees: List[Type], sep: String)(implicit elideThis: Option[Symbol]): Buffer = { + def printTypes(trees: List[Type], sep: String) given (elideThis: Option[Symbol]): Buffer = { def printSeparated(list: List[Type]): Unit = list match { case Nil => case x :: Nil => printType(x) @@ -1149,7 +1149,7 @@ trait Printers this } - def printTypesOrBounds(types: List[TypeOrBounds], sep: String)(implicit elideThis: Option[Symbol]): Buffer = { + def printTypesOrBounds(types: List[TypeOrBounds], sep: String) given (elideThis: Option[Symbol]): Buffer = { def printSeparated(list: List[TypeOrBounds]): Unit = list match { case Nil => case x :: Nil => printTypeOrBound(x) @@ -1162,7 +1162,7 @@ trait Printers this } - def printTargsDefs(targs: List[(TypeDef, TypeDef)], isDef:Boolean = true)(implicit elideThis: Option[Symbol]): Unit = { + def printTargsDefs(targs: List[(TypeDef, TypeDef)], isDef:Boolean = true) given (elideThis: Option[Symbol]): Unit = { if (!targs.isEmpty) { def printSeparated(list: List[(TypeDef, TypeDef)]): Unit = list match { case Nil => @@ -1177,7 +1177,7 @@ trait Printers } } - def printTargDef(arg: (TypeDef, TypeDef), isMember: Boolean = false, isDef:Boolean = true)(implicit elideThis: Option[Symbol]): Buffer = { + def printTargDef(arg: (TypeDef, TypeDef), isMember: Boolean = false, isDef:Boolean = true) given (elideThis: Option[Symbol]): Buffer = { val (argDef, argCons) = arg if (isDef) { @@ -1227,7 +1227,7 @@ trait Printers } } - def printArgsDefs(args: List[ValDef])(implicit elideThis: Option[Symbol]): Unit = { + def printArgsDefs(args: List[ValDef]) given (elideThis: Option[Symbol]): Unit = { val argFlags = args match { case Nil => Flags.EmptyFlags case arg :: _ => arg.symbol.flags @@ -1253,7 +1253,7 @@ trait Printers } } - def printAnnotations(trees: List[Term])(implicit elideThis: Option[Symbol]): Buffer = { + def printAnnotations(trees: List[Term]) given (elideThis: Option[Symbol]): Buffer = { def printSeparated(list: List[Term]): Unit = list match { case Nil => case x :: Nil => printAnnotation(x) @@ -1266,7 +1266,7 @@ trait Printers this } - def printParamDef(arg: ValDef)(implicit elideThis: Option[Symbol]): Unit = { + def printParamDef(arg: ValDef) given (elideThis: Option[Symbol]): Unit = { val name = arg.name arg.symbol.owner match { case IsDefDefSymbol(sym) if sym.name == "" => @@ -1304,7 +1304,7 @@ trait Printers indented { caseDef.rhs match { case Block(stats, expr) => - printStats(stats, expr)(None) + printStats(stats, expr) given None case body => this += lineBreak() printTree(body) @@ -1383,7 +1383,7 @@ trait Printers inSquare(printType(v)) } - def printTypeOrBoundsTree(tpt: Tree)(implicit elideThis: Option[Symbol] = None): Buffer = tpt match { + def printTypeOrBoundsTree(tpt: Tree) given (elideThis: Option[Symbol] = None): Buffer = tpt match { case TypeBoundsTree(lo, hi) => this += "_ >: " printTypeTree(lo) @@ -1403,7 +1403,7 @@ trait Printers * Self type annotation and types in parent list should elide current class * prefix `C.this` to avoid type checking errors. */ - def printTypeTree(tree: TypeTree)(implicit elideThis: Option[Symbol] = None): Buffer = tree match { + def printTypeTree(tree: TypeTree) given (elideThis: Option[Symbol] = None): Buffer = tree match { case Inferred() => // TODO try to move this logic into `printType` def printTypeAndAnnots(tpe: Type): Buffer = tpe match { @@ -1486,7 +1486,7 @@ trait Printers } - def printTypeOrBound(tpe: TypeOrBounds)(implicit elideThis: Option[Symbol]): Buffer = tpe match { + def printTypeOrBound(tpe: TypeOrBounds) given (elideThis: Option[Symbol]): Buffer = tpe match { case tpe@TypeBounds(lo, hi) => this += "_ >: " printType(lo) @@ -1503,7 +1503,7 @@ trait Printers * Self type annotation and types in parent list should elide current class * prefix `C.this` to avoid type checking errors. */ - def printType(tpe: Type)(implicit elideThis: Option[Symbol] = None): Buffer = tpe match { + def printType(tpe: Type) given (elideThis: Option[Symbol] = None): Buffer = tpe match { case Type.ConstantType(const) => printConstant(const) @@ -1677,7 +1677,7 @@ trait Printers case PackageDef(name, _) => this += highlightTypeDef(name) } - def printAnnotation(annot: Term)(implicit elideThis: Option[Symbol]): Buffer = { + def printAnnotation(annot: Term) given (elideThis: Option[Symbol]): Buffer = { val Annotation(ref, args) = annot this += "@" printTypeTree(ref) @@ -1687,7 +1687,7 @@ trait Printers inParens(printTrees(args, ", ")) } - def printDefAnnotations(definition: Definition)(implicit elideThis: Option[Symbol]): Buffer = { + def printDefAnnotations(definition: Definition) given (elideThis: Option[Symbol]): Buffer = { val annots = definition.symbol.annots.filter { case Annotation(annot, _) => annot.tpe match { @@ -1702,7 +1702,7 @@ trait Printers else this } - def printRefinement(tpe: Type)(implicit elideThis: Option[Symbol]): Buffer = { + def printRefinement(tpe: Type) given (elideThis: Option[Symbol]): Buffer = { def printMethodicType(tp: TypeOrBounds): Unit = tp match { case tp @ Type.MethodType(paramNames, params, res) => inParens(printMethodicTypeParams(paramNames, params)) @@ -1742,7 +1742,7 @@ trait Printers this += lineBreak() += "}" } - def printMethodicTypeParams(paramNames: List[String], params: List[TypeOrBounds])(implicit elideThis: Option[Symbol]): Unit = { + def printMethodicTypeParams(paramNames: List[String], params: List[TypeOrBounds]) given (elideThis: Option[Symbol]): Unit = { def printInfo(info: TypeOrBounds) = info match { case IsTypeBounds(info) => printBounds(info) case IsType(info) => @@ -1763,7 +1763,7 @@ trait Printers printSeparated(paramNames.zip(params)) } - def printBoundsTree(bounds: TypeBoundsTree)(implicit elideThis: Option[Symbol]): Buffer = { + def printBoundsTree(bounds: TypeBoundsTree) given (elideThis: Option[Symbol]): Buffer = { bounds.low match { case Inferred() => case low => @@ -1778,7 +1778,7 @@ trait Printers } } - def printBounds(bounds: TypeBounds)(implicit elideThis: Option[Symbol]): Buffer = { + def printBounds(bounds: TypeBounds) given (elideThis: Option[Symbol]): Buffer = { this += " >: " printType(bounds.low) this += " <: " @@ -1852,7 +1852,7 @@ trait Printers } private object SpecialOp { - def unapply(arg: Tree)(implicit ctx: Context): Option[(String, List[Term])] = arg match { + def unapply(arg: Tree) given (ctx: Context): Option[(String, List[Term])] = arg match { case IsTerm(arg @ Apply(fn, args)) => fn.tpe match { case Type.SymRef(IsDefDefSymbol(sym), Type.ThisType(Type.SymRef(sym2, _))) if sym2.name == "" => @@ -1864,7 +1864,7 @@ trait Printers } private object Annotation { - def unapply(arg: Tree)(implicit ctx: Context): Option[(TypeTree, List[Term])] = arg match { + def unapply(arg: Tree) given (ctx: Context): Option[(TypeTree, List[Term])] = arg match { case New(annot) => Some((annot, Nil)) case Apply(Select(New(annot), ""), args) => Some((annot, args)) case Apply(TypeApply(Select(New(annot), ""), targs), args) => Some((annot, args)) @@ -1876,49 +1876,49 @@ trait Printers private object Types { object JavaLangObject { - def unapply(tpe: Type)(implicit ctx: Context): Boolean = tpe match { + def unapply(tpe: Type) given (ctx: Context): Boolean = tpe match { case Type.TypeRef("Object", Type.SymRef(sym, _)) if sym.fullName == "java.lang" => true case _ => false } } object Sequence { - def unapply(tpe: Type)(implicit ctx: Context): Option[Type] = tpe match { + def unapply(tpe: Type) given (ctx: Context): Option[Type] = tpe match { case Type.AppliedType(Type.TypeRef("Seq", Type.SymRef(sym, _)), IsType(tp) :: Nil) if sym.fullName == "scala.collection" => Some(tp) case _ => None } } object RepeatedAnnotation { - def unapply(tpe: Type)(implicit ctx: Context): Boolean = tpe match { + def unapply(tpe: Type) given (ctx: Context): Boolean = tpe match { case Type.TypeRef("Repeated", Type.SymRef(sym, _)) if sym.fullName == "scala.annotation.internal" => true case _ => false } } object Repeated { - def unapply(tpe: Type)(implicit ctx: Context): Option[Type] = tpe match { + def unapply(tpe: Type) given (ctx: Context): Option[Type] = tpe match { case Type.AppliedType(Type.TypeRef("", ScalaPackage()), IsType(tp) :: Nil) => Some(tp) case _ => None } } object ScalaPackage { - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Boolean = tpe match { + def unapply(tpe: TypeOrBounds) given (ctx: Context): Boolean = tpe match { case Type.SymRef(sym, _) => sym == definitions.ScalaPackage case _ => false } } object RootPackage { - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Boolean = tpe match { + def unapply(tpe: TypeOrBounds) given (ctx: Context): Boolean = tpe match { case Type.SymRef(sym, _) => sym.fullName == "" // TODO use Symbol.== case _ => false } } object EmptyPackage { - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Boolean = tpe match { + def unapply(tpe: TypeOrBounds) given (ctx: Context): Boolean = tpe match { case Type.SymRef(sym, _) => sym.fullName == "" case _ => false } @@ -1927,7 +1927,7 @@ trait Printers } object PackageObject { - def unapply(tree: Tree)(implicit ctx: Context): Option[Tree] = tree match { + def unapply(tree: Tree) given (ctx: Context): Option[Tree] = tree match { case PackageClause(_, ValDef("package", _, _) :: body :: Nil) => Some(body) case _ => None } diff --git a/library/src/scala/tasty/reflect/QuotedOps.scala b/library/src/scala/tasty/reflect/QuotedOps.scala index 6ef2b8b5fc90..72b372a5043e 100644 --- a/library/src/scala/tasty/reflect/QuotedOps.scala +++ b/library/src/scala/tasty/reflect/QuotedOps.scala @@ -5,29 +5,29 @@ 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(implicit ctx: Context): Term = + def unseal given (ctx: Context): Term = kernel.QuotedExpr_unseal(expr) /** Checked cast to a `quoted.Expr[U]` */ - def cast[U: scala.quoted.Type](implicit ctx: Context): scala.quoted.Expr[U] = + def cast[U: scala.quoted.Type] given (ctx: Context): scala.quoted.Expr[U] = kernel.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(implicit ctx: Context): TypeTree = + def unseal given (ctx: Context): TypeTree = kernel.QuotedType_unseal(tpe) } implicit class TermToQuotedAPI(term: Term) { /** Convert `Term` to an `quoted.Expr[Any]` */ - def seal(implicit ctx: Context): scala.quoted.Expr[Any] = + def seal given (ctx: Context): scala.quoted.Expr[Any] = kernel.QuotedExpr_seal(term) } implicit class TypeToQuotedAPI(tpe: Type) { /** Convert `Type` to an `quoted.Type[_]` */ - def seal(implicit ctx: Context): scala.quoted.Type[_] = + def seal given (ctx: Context): scala.quoted.Type[_] = kernel.QuotedType_seal(tpe) } } diff --git a/library/src/scala/tasty/reflect/ReportingOps.scala b/library/src/scala/tasty/reflect/ReportingOps.scala index a2c43fad2020..780c135f8aba 100644 --- a/library/src/scala/tasty/reflect/ReportingOps.scala +++ b/library/src/scala/tasty/reflect/ReportingOps.scala @@ -2,15 +2,15 @@ package scala.tasty.reflect trait ReportingOps extends Core { - def error(msg: => String, pos: Position)(implicit ctx: Context): Unit = + def error(msg: => String, pos: Position) given (ctx: Context): Unit = kernel.error(msg, pos) - def error(msg: => String, source: SourceFile, start: Int, end: Int)(implicit ctx: Context): Unit = + def error(msg: => String, source: SourceFile, start: Int, end: Int) given (ctx: Context): Unit = kernel.error(msg, source, start, end) - def warning(msg: => String, pos: Position)(implicit ctx: Context): Unit = + def warning(msg: => String, pos: Position) given (ctx: Context): Unit = kernel.warning(msg, pos) - def warning(msg: => String, source: SourceFile, start: Int, end: Int)(implicit ctx: Context): Unit = + def warning(msg: => String, source: SourceFile, start: Int, end: Int) given (ctx: Context): Unit = kernel.warning(msg, source, start, end) } diff --git a/library/src/scala/tasty/reflect/SignatureOps.scala b/library/src/scala/tasty/reflect/SignatureOps.scala index 7620b2bd6a2a..d0e68ad1059f 100644 --- a/library/src/scala/tasty/reflect/SignatureOps.scala +++ b/library/src/scala/tasty/reflect/SignatureOps.scala @@ -5,7 +5,7 @@ trait SignatureOps extends Core { /** Erased (JVM) signatures. */ object Signature { /** Matches the erased (JVM) signature and returns its parameters and result type. */ - def unapply(sig: Signature)(implicit ctx: Context): Option[(List[String], String)] = + def unapply(sig: Signature) given (ctx: Context): Option[(List[String], String)] = Some((sig.paramSigs, sig.resultSig)) } diff --git a/library/src/scala/tasty/reflect/SymbolOps.scala b/library/src/scala/tasty/reflect/SymbolOps.scala index 902104640c3b..e6e7d848e329 100644 --- a/library/src/scala/tasty/reflect/SymbolOps.scala +++ b/library/src/scala/tasty/reflect/SymbolOps.scala @@ -9,252 +9,252 @@ 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(implicit ctx: Context): Symbol = kernel.Symbol_owner(self) + def owner given (ctx: Context): Symbol = kernel.Symbol_owner(self) /** Flags of this symbol */ - def flags(implicit ctx: Context): Flags = kernel.Symbol_flags(self) + def flags given (ctx: Context): Flags = kernel.Symbol_flags(self) /** This symbol is private within the resulting type */ - def privateWithin(implicit ctx: Context): Option[Type] = kernel.Symbol_privateWithin(self) + def privateWithin given (ctx: Context): Option[Type] = kernel.Symbol_privateWithin(self) /** This symbol is protected within the resulting type */ - def protectedWithin(implicit ctx: Context): Option[Type] = kernel.Symbol_protectedWithin(self) + def protectedWithin given (ctx: Context): Option[Type] = kernel.Symbol_protectedWithin(self) /** The name of this symbol */ - def name(implicit ctx: Context): String = kernel.Symbol_name(self) + def name given (ctx: Context): String = kernel.Symbol_name(self) /** The full name of this symbol up to the root package */ - def fullName(implicit ctx: Context): String = kernel.Symbol_fullName(self) + def fullName given (ctx: Context): String = kernel.Symbol_fullName(self) /** The position of this symbol */ - def pos(implicit ctx: Context): Position = kernel.Symbol_pos(self) + def pos given (ctx: Context): Position = kernel.Symbol_pos(self) - def localContext(implicit ctx: Context): Context = kernel.Symbol_localContext(self) + def localContext given (ctx: Context): Context = kernel.Symbol_localContext(self) /** The comment for this symbol, if any */ - def comment(implicit ctx: Context): Option[Comment] = kernel.Symbol_comment(self) + def comment given (ctx: Context): Option[Comment] = kernel.Symbol_comment(self) /** Unsafe cast as to PackageSymbol. Use IsPackageSymbol to safely check and cast to PackageSymbol */ - def asPackageDef(implicit ctx: Context): PackageDefSymbol = self match { + def asPackageDef given (ctx: Context): PackageDefSymbol = self match { case IsPackageDefSymbol(self) => self case _ => throw new Exception("not a PackageDefSymbol") } /** Unsafe cast as to ClassSymbol. Use IsClassDefSymbol to safely check and cast to ClassSymbol */ - def asClassDef(implicit ctx: Context): ClassDefSymbol = self match { + def asClassDef given (ctx: Context): ClassDefSymbol = self match { case IsClassDefSymbol(self) => self case _ => throw new Exception("not a ClassDefSymbol") } /** Unsafe cast as to DefSymbol. Use IsDefDefSymbol to safely check and cast to DefSymbol */ - def asDefDef(implicit ctx: Context): DefDefSymbol = self match { + def asDefDef given (ctx: Context): DefDefSymbol = self match { case IsDefDefSymbol(self) => self case _ => throw new Exception("not a DefDefSymbol") } /** Unsafe cast as to ValSymbol. Use IsValDefSymbol to safely check and cast to ValSymbol */ - def asValDef(implicit ctx: Context): ValDefSymbol = self match { + def asValDef given (ctx: Context): ValDefSymbol = self match { case IsValDefSymbol(self) => self case _ => throw new Exception("not a ValDefSymbol") } /** Unsafe cast as to TypeSymbol. Use IsTypeDefSymbol to safely check and cast to TypeSymbol */ - def asTypeDef(implicit ctx: Context): TypeDefSymbol = self match { + def asTypeDef given (ctx: Context): TypeDefSymbol = self match { case IsTypeDefSymbol(self) => self case _ => throw new Exception("not a TypeDefSymbol") } /** Unsafe cast as to BindSymbol. Use IsBindSymbol to safely check and cast to BindSymbol */ - def asBindDef(implicit ctx: Context): BindSymbol = self match { + def asBindDef given (ctx: Context): BindSymbol = self match { case IsBindSymbol(self) => self case _ => throw new Exception("not a BindSymbol") } /** Annotations attached to this symbol */ - def annots(implicit ctx: Context): List[Term] = kernel.Symbol_annots(self) + def annots given (ctx: Context): List[Term] = kernel.Symbol_annots(self) - def isDefinedInCurrentRun(implicit ctx: Context): Boolean = kernel.Symbol_isDefinedInCurrentRun(self) + def isDefinedInCurrentRun given (ctx: Context): Boolean = kernel.Symbol_isDefinedInCurrentRun(self) - def isLocalDummy(implicit ctx: Context): Boolean = kernel.Symbol_isLocalDummy(self) - def isRefinementClass(implicit ctx: Context): Boolean = kernel.Symbol_isRefinementClass(self) - def isAliasType(implicit ctx: Context): Boolean = kernel.Symbol_isAliasType(self) - def isAnonymousClass(implicit ctx: Context): Boolean = kernel.Symbol_isAnonymousClass(self) - def isAnonymousFunction(implicit ctx: Context): Boolean = kernel.Symbol_isAnonymousFunction(self) - def isAbstractType(implicit ctx: Context): Boolean = kernel.Symbol_isAbstractType(self) - def isClassConstructor(implicit ctx: Context): Boolean = kernel.Symbol_isClassConstructor(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 isType(implicit ctx: Context): Boolean = kernel.matchTypeSymbol(self).isDefined - def isTerm(implicit ctx: Context): Boolean = kernel.matchTermSymbol(self).isDefined + def isType given (ctx: Context): Boolean = kernel.matchTypeSymbol(self).isDefined + def isTerm given (ctx: Context): Boolean = kernel.matchTermSymbol(self).isDefined } // PackageSymbol object IsPackageDefSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[PackageDefSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[PackageDefSymbol] = kernel.matchPackageDefSymbol(symbol) } implicit class PackageDefSymbolAPI(self: PackageDefSymbol) { - def tree(implicit ctx: Context): PackageDef = + def tree given (ctx: Context): PackageDef = kernel.PackageDefSymbol_tree(self) } // TypeSymbol object IsTypeSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[TypeSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[TypeSymbol] = kernel.matchTypeSymbol(symbol) } // ClassSymbol object IsClassDefSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[ClassDefSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[ClassDefSymbol] = kernel.matchClassDefSymbol(symbol) } object ClassDefSymbol { /** The ClassSymbol of a global class definition */ - def of(fullName: String)(implicit ctx: Context): ClassDefSymbol = + def of(fullName: String) given (ctx: Context): ClassDefSymbol = kernel.ClassDefSymbol_of(fullName) } implicit class ClassDefSymbolAPI(self: ClassDefSymbol) { /** ClassDef tree of this defintion */ - def tree(implicit ctx: Context): ClassDef = + def tree given (ctx: Context): ClassDef = kernel.ClassDefSymbol_tree(self) /** Fields directly declared in the class */ - def fields(implicit ctx: Context): List[Symbol] = + def fields given (ctx: Context): List[Symbol] = kernel.ClassDefSymbol_fields(self) /** Field with the given name directly declared in the class */ - def field(name: String)(implicit ctx: Context): Option[Symbol] = + def field(name: String) given (ctx: Context): Option[Symbol] = kernel.ClassDefSymbol_field(self)(name) /** Get non-private named methods defined directly inside the class */ - def classMethod(name: String)(implicit ctx: Context): List[DefDefSymbol] = + def classMethod(name: String) given (ctx: Context): List[DefDefSymbol] = kernel.ClassDefSymbol_classMethod(self)(name) /** Get all non-private methods defined directly inside the class, exluding constructors */ - def classMethods(implicit ctx: Context): List[DefDefSymbol] = + def classMethods given (ctx: Context): List[DefDefSymbol] = kernel.ClassDefSymbol_classMethods(self) /** Get named non-private methods declared or inherited */ - def method(name: String)(implicit ctx: Context): List[DefDefSymbol] = + def method(name: String) given (ctx: Context): List[DefDefSymbol] = kernel.ClassDefSymbol_method(self)(name) /** Get all non-private methods declared or inherited */ - def methods(implicit ctx: Context): List[DefDefSymbol] = + def methods given (ctx: Context): List[DefDefSymbol] = kernel.ClassDefSymbol_methods(self) /** Fields of a case class type -- only the ones declared in primary constructor */ - def caseFields(implicit ctx: Context): List[ValDefSymbol] = + def caseFields given (ctx: Context): List[ValDefSymbol] = kernel.ClassDefSymbol_caseFields(self) /** The class symbol of the companion module class */ - def companionClass(implicit ctx: Context): Option[ClassDefSymbol] = + def companionClass given (ctx: Context): Option[ClassDefSymbol] = kernel.ClassDefSymbol_companionClass(self) /** The symbol of the companion module */ - def companionModule(implicit ctx: Context): Option[ValDefSymbol] = + def companionModule given (ctx: Context): Option[ValDefSymbol] = kernel.ClassDefSymbol_companionModule(self) /** The symbol of the class of the companion module */ - def moduleClass(implicit ctx: Context): Option[Symbol] = + def moduleClass given (ctx: Context): Option[Symbol] = kernel.ClassDefSymbol_moduleClass(self) } // TypeSymbol object IsTypeDefSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[TypeDefSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[TypeDefSymbol] = kernel.matchTypeDefSymbol(symbol) } implicit class TypeDefSymbolAPI(self: TypeDefSymbol) { /** TypeDef tree of this definition */ - def tree(implicit ctx: Context): TypeDef = + def tree given (ctx: Context): TypeDef = kernel.TypeDefSymbol_tree(self) - def isTypeParam(implicit ctx: Context): Boolean = + def isTypeParam given (ctx: Context): Boolean = kernel.TypeDefSymbol_isTypeParam(self) } // TypeBindSymbol object IsTypeBindSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[TypeBindSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[TypeBindSymbol] = kernel.matchTypeBindSymbol(symbol) } implicit class TypeBindSymbolAPI(self: TypeBindSymbol) { /** TypeBind pattern of this definition */ - def tree(implicit ctx: Context): TypeBind = + def tree given (ctx: Context): TypeBind = kernel.TypeBindSymbol_tree(self) } // TermSymbol object IsTermSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[TermSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[TermSymbol] = kernel.matchTermSymbol(symbol) } // DefSymbol object IsDefDefSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[DefDefSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[DefDefSymbol] = kernel.matchDefDefSymbol(symbol) } implicit class DefDefSymbolAPI(self: DefDefSymbol) { /** DefDef tree of this defintion */ - def tree(implicit ctx: Context): DefDef = + def tree given (ctx: Context): DefDef = kernel.DefDefSymbol_tree(self) /** Signature of this defintion */ - def signature(implicit ctx: Context): Signature = + def signature given (ctx: Context): Signature = kernel.DefDefSymbol_signature(self) } // ValSymbol object IsValDefSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[ValDefSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[ValDefSymbol] = kernel.matchValDefSymbol(symbol) } implicit class ValDefSymbolAPI(self: ValDefSymbol) { /** ValDef tree of this defintion */ - def tree(implicit ctx: Context): ValDef = + def tree given (ctx: Context): ValDef = kernel.ValDefSymbol_tree(self) /** The class symbol of the companion module class */ - def moduleClass(implicit ctx: Context): Option[ClassDefSymbol] = + def moduleClass given (ctx: Context): Option[ClassDefSymbol] = kernel.ValDefSymbol_moduleClass(self) - def companionClass(implicit ctx: Context): Option[ClassDefSymbol] = + def companionClass given (ctx: Context): Option[ClassDefSymbol] = kernel.ValDefSymbol_companionClass(self) } // BindSymbol object IsBindSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Option[BindSymbol] = + def unapply(symbol: Symbol) given (ctx: Context): Option[BindSymbol] = kernel.matchBindSymbol(symbol) } implicit class BindSymbolAPI(self: BindSymbol) { /** Bind pattern of this definition */ - def tree(implicit ctx: Context): Bind = + def tree given (ctx: Context): Bind = kernel.BindSymbol_tree(self) } // NoSymbol object NoSymbol { - def unapply(symbol: Symbol)(implicit ctx: Context): Boolean = + def unapply(symbol: Symbol) given (ctx: Context): Boolean = kernel.matchNoSymbol(symbol) } } diff --git a/library/src/scala/tasty/reflect/TreeOps.scala b/library/src/scala/tasty/reflect/TreeOps.scala index 1fce02ece91e..d8cea289541b 100644 --- a/library/src/scala/tasty/reflect/TreeOps.scala +++ b/library/src/scala/tasty/reflect/TreeOps.scala @@ -7,269 +7,269 @@ trait TreeOps extends Core { implicit class TreeAPI(self: Tree) { /** Position in the source code */ - def pos(implicit ctx: Context): Position = kernel.Tree_pos(self) + def pos given (ctx: Context): Position = kernel.Tree_pos(self) - def symbol(implicit ctx: Context): Symbol = kernel.Tree_symbol(self) + def symbol given (ctx: Context): Symbol = kernel.Tree_symbol(self) } object IsPackageClause { - def unapply(tree: Tree)(implicit ctx: Context): Option[PackageClause] = + def unapply(tree: Tree) given (ctx: Context): Option[PackageClause] = kernel.matchPackageClause(tree) } object PackageClause { - def apply(pid: Ref, stats: List[Tree])(implicit ctx: Context): PackageClause = + def apply(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = kernel.PackageClause_apply(pid, stats) - def copy(original: PackageClause)(pid: Ref, stats: List[Tree])(implicit ctx: Context): PackageClause = + def copy(original: PackageClause)(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = kernel.PackageClause_copy(original)(pid, stats) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Ref, List[Tree])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Ref, List[Tree])] = kernel.matchPackageClause(tree).map(x => (x.pid, x.stats)) } implicit class PackageClauseAPI(self: PackageClause) { - def pid(implicit ctx: Context): Ref = kernel.PackageClause_pid(self) - def stats(implicit ctx: Context): List[Tree] = kernel.PackageClause_stats(self) + def pid given (ctx: Context): Ref = kernel.PackageClause_pid(self) + def stats given (ctx: Context): List[Tree] = kernel.PackageClause_stats(self) } object IsImport { - def unapply(tree: Tree)(implicit ctx: Context): Option[Import] = + def unapply(tree: Tree) given (ctx: Context): Option[Import] = kernel.matchImport(tree) } object Import { - def apply(importImplied: Boolean, expr: Term, selectors: List[ImportSelector])(implicit ctx: Context): Import = + def apply(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import = kernel.Import_apply(importImplied, expr, selectors) - def copy(original: Import)(importImplied: Boolean, expr: Term, selectors: List[ImportSelector])(implicit ctx: Context): Import = + def copy(original: Import)(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import = kernel.Import_copy(original)(importImplied, expr, selectors) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Boolean, Term, List[ImportSelector])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Boolean, Term, List[ImportSelector])] = kernel.matchImport(tree).map(x => (x.importImplied, x.expr, x.selectors)) } implicit class ImportAPI(self: Import) { def importImplied: Boolean = kernel.Import_implied(self) - def expr(implicit ctx: Context): Term = kernel.Import_expr(self) - def selectors(implicit ctx: Context): List[ImportSelector] = + def expr given (ctx: Context): Term = kernel.Import_expr(self) + def selectors given (ctx: Context): List[ImportSelector] = kernel.Import_selectors(self) } object IsStatement { /** Matches any Statement and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Statement] = kernel.matchStatement(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Statement] = kernel.matchStatement(tree) } // ----- Definitions ---------------------------------------------- object IsDefinition { - def unapply(tree: Tree)(implicit ctx: Context): Option[Definition] = kernel.matchDefinition(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Definition] = kernel.matchDefinition(tree) } implicit class DefinitionAPI(self: Definition) { - def name(implicit ctx: Context): String = kernel.Definition_name(self) + def name given (ctx: Context): String = kernel.Definition_name(self) } // ClassDef object IsClassDef { - def unapply(tree: Tree)(implicit ctx: Context): Option[ClassDef] = kernel.matchClassDef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[ClassDef] = kernel.matchClassDef(tree) } object ClassDef { - // TODO def apply(name: String, constr: DefDef, parents: List[TermOrTypeTree], selfOpt: Option[ValDef], body: List[Statement])(implicit 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])(implicit ctx: Context): 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) - def unapply(tree: Tree)(implicit ctx: Context): Option[(String, DefDef, List[Tree /* Term | TypeTree */], List[TypeTree], Option[ValDef], List[Statement])] = + 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)) } implicit class ClassDefAPI(self: ClassDef) { - def constructor(implicit ctx: Context): DefDef = kernel.ClassDef_constructor(self) - def parents(implicit ctx: Context): List[Tree /* Term | TypeTree */] = kernel.ClassDef_parents(self) - def derived(implicit ctx: Context): List[TypeTree] = kernel.ClassDef_derived(self) - def self(implicit ctx: Context): Option[ValDef] = kernel.ClassDef_self(self) - def body(implicit ctx: Context): List[Statement] = kernel.ClassDef_body(self) - def symbol(implicit ctx: Context): ClassDefSymbol = kernel.ClassDef_symbol(self) + 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) } // DefDef object IsDefDef { - def unapply(tree: Tree)(implicit ctx: Context): Option[DefDef] = kernel.matchDefDef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[DefDef] = kernel.matchDefDef(tree) } object DefDef { - def apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(implicit ctx: Context): DefDef = + def apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term]) given (ctx: Context): DefDef = kernel.DefDef_apply(symbol, rhsFn) - def copy(original: DefDef)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term])(implicit ctx: Context): DefDef = + 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) - def unapply(tree: Tree)(implicit ctx: Context): Option[(String, List[TypeDef], List[List[ValDef]], TypeTree, Option[Term])] = + 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)) } implicit class DefDefAPI(self: DefDef) { - def typeParams(implicit ctx: Context): List[TypeDef] = kernel.DefDef_typeParams(self) - def paramss(implicit ctx: Context): List[List[ValDef]] = kernel.DefDef_paramss(self) - def returnTpt(implicit ctx: Context): TypeTree = kernel.DefDef_returnTpt(self) // TODO rename to tpt - def rhs(implicit ctx: Context): Option[Term] = kernel.DefDef_rhs(self) - def symbol(implicit ctx: Context): DefDefSymbol = kernel.DefDef_symbol(self) + 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) } // ValDef object IsValDef { - def unapply(tree: Tree)(implicit ctx: Context): Option[ValDef] = kernel.matchValDef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[ValDef] = kernel.matchValDef(tree) } object ValDef { - def apply(symbol: ValDefSymbol, rhs: Option[Term])(implicit ctx: Context): ValDef = + def apply(symbol: ValDefSymbol, rhs: Option[Term]) given (ctx: Context): ValDef = kernel.ValDef_apply(symbol, rhs) - def copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term])(implicit ctx: Context): ValDef = + def copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): ValDef = kernel.ValDef_copy(original)(name, tpt, rhs) - def unapply(tree: Tree)(implicit ctx: Context): Option[(String, TypeTree, Option[Term])] = + def unapply(tree: Tree) given (ctx: Context): Option[(String, TypeTree, Option[Term])] = kernel.matchValDef(tree).map(x => (x.name, x.tpt, x.rhs)) } implicit class ValDefAPI(self: ValDef) { - def tpt(implicit ctx: Context): TypeTree = kernel.ValDef_tpt(self) - def rhs(implicit ctx: Context): Option[Term] = kernel.ValDef_rhs(self) - def symbol(implicit ctx: Context): ValDefSymbol = kernel.ValDef_symbol(self) + 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) } // TypeDef object IsTypeDef { - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeDef] = kernel.matchTypeDef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[TypeDef] = kernel.matchTypeDef(tree) } object TypeDef { - def apply(symbol: TypeDefSymbol)(implicit ctx: Context): TypeDef = + def apply(symbol: TypeDefSymbol) given (ctx: Context): TypeDef = kernel.TypeDef_apply(symbol) - def copy(original: TypeDef)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): TypeDef = + def copy(original: TypeDef)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): TypeDef = kernel.TypeDef_copy(original)(name, rhs) - def unapply(tree: Tree)(implicit ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/ /* TypeTree | TypeBoundsTree */)] = + def unapply(tree: Tree) given (ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/ /* TypeTree | TypeBoundsTree */)] = kernel.matchTypeDef(tree).map(x => (x.name, x.rhs)) } implicit class TypeDefAPI(self: TypeDef) { - def rhs(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.TypeDef_rhs(self) - def symbol(implicit ctx: Context): TypeDefSymbol = kernel.TypeDef_symbol(self) + def rhs given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.TypeDef_rhs(self) + def symbol given (ctx: Context): TypeDefSymbol = kernel.TypeDef_symbol(self) } // PackageDef object IsPackageDef { - def unapply(tree: Tree)(implicit ctx: Context): Option[PackageDef] = + def unapply(tree: Tree) given (ctx: Context): Option[PackageDef] = kernel.matchPackageDef(tree) } implicit class PackageDefAPI(self: PackageDef) { - def owner(implicit ctx: Context): PackageDef = kernel.PackageDef_owner(self) - def members(implicit ctx: Context): List[Statement] = kernel.PackageDef_members(self) - def symbol(implicit ctx: Context): PackageDefSymbol = kernel.PackageDef_symbol(self) + 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) } object PackageDef { - def unapply(tree: Tree)(implicit ctx: Context): Option[(String, PackageDef)] = + def unapply(tree: Tree) given (ctx: Context): Option[(String, PackageDef)] = kernel.matchPackageDef(tree).map(x => (x.name, x.owner)) } // ----- Terms ---------------------------------------------------- implicit class TermAPI(self: Term) { - def tpe(implicit ctx: Context): Type = kernel.Term_tpe(self) - def pos(implicit ctx: Context): Position = kernel.Term_pos(self) - def underlyingArgument(implicit ctx: Context): Term = kernel.Term_underlyingArgument(self) - def underlying(implicit ctx: Context): Term = kernel.Term_underlying(self) + 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) /** A unary apply node with given argument: `tree(arg)` */ - def appliedTo(arg: Term)(implicit ctx: Context): Term = + def appliedTo(arg: Term) given (ctx: Context): Term = appliedToArgs(arg :: Nil) /** An apply node with given arguments: `tree(arg, args0, ..., argsN)` */ - def appliedTo(arg: Term, args: Term*)(implicit ctx: Context): Term = + def appliedTo(arg: Term, args: Term*) given (ctx: Context): Term = appliedToArgs(arg :: args.toList) /** An apply node with given argument list `tree(args(0), ..., args(args.length - 1))` */ - def appliedToArgs(args: List[Term])(implicit ctx: Context): Apply = + def appliedToArgs(args: List[Term]) given (ctx: Context): Apply = Apply(self, args) /** The current tree applied to given argument lists: * `tree (argss(0)) ... (argss(argss.length -1))` */ - def appliedToArgss(argss: List[List[Term]])(implicit ctx: Context): Term = + def appliedToArgss(argss: List[List[Term]]) given (ctx: Context): Term = ((self: Term) /: argss)(Apply(_, _)) /** The current tree applied to (): `tree()` */ - def appliedToNone(implicit ctx: Context): Apply = appliedToArgs(Nil) + def appliedToNone given (ctx: Context): Apply = appliedToArgs(Nil) /** The current tree applied to given type argument: `tree[targ]` */ - def appliedToType(targ: Type)(implicit ctx: Context): Term = + def appliedToType(targ: Type) given (ctx: Context): Term = appliedToTypes(targ :: Nil) /** The current tree applied to given type arguments: `tree[targ0, ..., targN]` */ - def appliedToTypes(targs: List[Type])(implicit ctx: Context): Term = + def appliedToTypes(targs: List[Type]) given (ctx: Context): Term = appliedToTypeTrees(targs map (Inferred(_))) /** The current tree applied to given type argument list: `tree[targs(0), ..., targs(targs.length - 1)]` */ - def appliedToTypeTrees(targs: List[TypeTree])(implicit ctx: Context): Term = + def appliedToTypeTrees(targs: List[TypeTree]) given (ctx: Context): Term = if (targs.isEmpty) self else TypeApply(self, targs) /** A select node that selects the given symbol. */ - def select(sym: Symbol)(implicit ctx: Context): Select = Select(self, sym) + def select(sym: Symbol) given (ctx: Context): Select = Select(self, sym) } object IsTerm { /** Matches any term */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Term] = + def unapply(tree: Tree) given (ctx: Context): Option[Term] = kernel.matchTerm(tree) } object IsRef { /** Matches any Ref and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Ref] = kernel.matchRef(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Ref] = kernel.matchRef(tree) } object Ref { /** Create a reference tree */ - def apply(sym: Symbol)(implicit ctx: Context): Ref = + def apply(sym: Symbol) given (ctx: Context): Ref = kernel.Ref_apply(sym) - // TODO def copy(original: Tree)(name: String)(implicit ctx: Context): Ref + // TODO def copy(original: Tree)(name: String) given (ctx: Context): Ref } object IsIdent { /** Matches any Ident and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Ident] = kernel.matchIdent(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Ident] = kernel.matchIdent(tree) } implicit class IdentAPI(self: Ident) { - def name(implicit ctx: Context): String = kernel.Ident_name(self) + def name given (ctx: Context): String = kernel.Ident_name(self) } /** Scala term identifier */ object Ident { - def apply(tmref: TermRef)(implicit ctx: Context): Term = + def apply(tmref: TermRef) given (ctx: Context): Term = kernel.Ident_apply(tmref) - def copy(original: Tree)(name: String)(implicit ctx: Context): Ident = + def copy(original: Tree)(name: String) given (ctx: Context): Ident = kernel.Ident_copy(original)(name) /** Matches a term identifier and returns its name */ - def unapply(tree: Tree)(implicit ctx: Context): Option[String] = + def unapply(tree: Tree) given (ctx: Context): Option[String] = kernel.matchIdent(tree).map(_.name) } object IsSelect { /** Matches any Select and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Select] = kernel.matchSelect(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Select] = kernel.matchSelect(tree) } /** Scala term selection */ object Select { /** Select a term member by symbol */ - def apply(qualifier: Term, symbol: Symbol)(implicit ctx: Context): Select = + def apply(qualifier: Term, symbol: Symbol) given (ctx: Context): Select = kernel.Select_apply(qualifier, symbol) /** Select a field or a non-overloaded method by name @@ -278,155 +278,155 @@ trait TreeOps extends Core { * method is overloaded. The method `overloaded` should be used * in that case. */ - def unique(qualifier: Term, name: String)(implicit ctx: Context): Select = + def unique(qualifier: Term, name: String) given (ctx: Context): Select = kernel.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])(implicit ctx: Context): Apply = + def overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term]) given (ctx: Context): Apply = kernel.Select_overloaded(qualifier, name, targs, args) - def copy(original: Tree)(qualifier: Term, name: String)(implicit ctx: Context): Select = + def copy(original: Tree)(qualifier: Term, name: String) given (ctx: Context): Select = kernel.Select_copy(original)(qualifier, name) /** Matches `.` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, String)] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, String)] = kernel.matchSelect(tree).map(x => (x.qualifier, x.name)) } implicit class SelectAPI(self: Select) { - def qualifier(implicit ctx: Context): Term = kernel.Select_qualifier(self) - def name(implicit ctx: Context): String = kernel.Select_name(self) - def signature(implicit ctx: Context): Option[Signature] = kernel.Select_signature(self) + 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) } object IsLiteral { /** Matches any Literal and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Literal] = kernel.matchLiteral(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Literal] = kernel.matchLiteral(tree) } /** Scala literal constant */ object Literal { /** Create a literal constant */ - def apply(constant: Constant)(implicit ctx: Context): Literal = + def apply(constant: Constant) given (ctx: Context): Literal = kernel.Literal_apply(constant) - def copy(original: Tree)(constant: Constant)(implicit ctx: Context): Literal = + def copy(original: Tree)(constant: Constant) given (ctx: Context): Literal = kernel.Literal_copy(original)(constant) /** Matches a literal constant */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Constant] = + def unapply(tree: Tree) given (ctx: Context): Option[Constant] = kernel.matchLiteral(tree).map(_.constant) } implicit class LiteralAPI(self: Literal) { - def constant(implicit ctx: Context): Constant = kernel.Literal_constant(self) + def constant given (ctx: Context): Constant = kernel.Literal_constant(self) } object IsThis { /** Matches any This and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[This] = kernel.matchThis(tree) + def unapply(tree: Tree) given (ctx: Context): Option[This] = kernel.matchThis(tree) } /** Scala `this` or `this[id]` */ object This { /** Create a `this[` */ - def apply(cls: ClassDefSymbol)(implicit ctx: Context): This = + def apply(cls: ClassDefSymbol) given (ctx: Context): This = kernel.This_apply(cls) - def copy(original: Tree)(qual: Option[Id])(implicit ctx: Context): This = + def copy(original: Tree)(qual: Option[Id]) given (ctx: Context): This = kernel.This_copy(original)(qual) /** Matches `this[` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Option[Id]] = + def unapply(tree: Tree) given (ctx: Context): Option[Option[Id]] = kernel.matchThis(tree).map(_.id) } implicit class ThisAPI(self: This) { - def id(implicit ctx: Context): Option[Id] = kernel.This_id(self) + def id given (ctx: Context): Option[Id] = kernel.This_id(self) } object IsNew { /** Matches any New and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[New] = kernel.matchNew(tree) + def unapply(tree: Tree) given (ctx: Context): Option[New] = kernel.matchNew(tree) } /** Scala `new` */ object New { /** Create a `new ` */ - def apply(tpt: TypeTree)(implicit ctx: Context): New = + def apply(tpt: TypeTree) given (ctx: Context): New = kernel.New_apply(tpt) - def copy(original: Tree)(tpt: TypeTree)(implicit ctx: Context): New = + def copy(original: Tree)(tpt: TypeTree) given (ctx: Context): New = kernel.New_copy(original)(tpt) /** Matches a `new ` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeTree] = + def unapply(tree: Tree) given (ctx: Context): Option[TypeTree] = kernel.matchNew(tree).map(_.tpt) } implicit class NewAPI(self: New) { - def tpt(implicit ctx: Context): TypeTree = kernel.New_tpt(self) + def tpt given (ctx: Context): TypeTree = kernel.New_tpt(self) } object IsNamedArg { /** Matches any NamedArg and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[NamedArg] = kernel.matchNamedArg(tree) + def unapply(tree: Tree) given (ctx: Context): Option[NamedArg] = kernel.matchNamedArg(tree) } /** Scala named argument `x = y` in argument position */ object NamedArg { /** Create a named argument ` = ` */ - def apply(name: String, arg: Term)(implicit ctx: Context): NamedArg = + def apply(name: String, arg: Term) given (ctx: Context): NamedArg = kernel.NamedArg_apply(name, arg) - def copy(original: NamedArg)(name: String, arg: Term)(implicit ctx: Context): NamedArg = + def copy(original: NamedArg)(name: String, arg: Term) given (ctx: Context): NamedArg = kernel.NamedArg_copy(original)(name, arg) /** Matches a named argument ` = ` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(String, Term)] = + def unapply(tree: Tree) given (ctx: Context): Option[(String, Term)] = kernel.matchNamedArg(tree).map(x => (x.name, x.value)) } implicit class NamedArgAPI(self: NamedArg) { - def name(implicit ctx: Context): String = kernel.NamedArg_name(self) - def value(implicit ctx: Context): Term = kernel.NamedArg_value(self) + def name given (ctx: Context): String = kernel.NamedArg_name(self) + def value given (ctx: Context): Term = kernel.NamedArg_value(self) } object IsApply { /** Matches any Apply and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Apply] = kernel.matchApply(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Apply] = kernel.matchApply(tree) } /** Scala parameter application */ object Apply { /** Create a function application `()` */ - def apply(fun: Term, args: List[Term])(implicit ctx: Context): Apply = + def apply(fun: Term, args: List[Term]) given (ctx: Context): Apply = kernel.Apply_apply(fun, args) - def copy(original: Tree)(fun: Term, args: List[Term])(implicit ctx: Context): Apply = + def copy(original: Tree)(fun: Term, args: List[Term]) given (ctx: Context): Apply = kernel.Apply_copy(original)(fun, args) /** Matches a function application `()` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, List[Term])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, List[Term])] = kernel.matchApply(tree).map(x => (x.fun, x.args)) } implicit class ApplyAPI(self: Apply) { - def fun(implicit ctx: Context): Term = kernel.Apply_fun(self) - def args(implicit ctx: Context): List[Term] = kernel.Apply_args(self) + def fun given (ctx: Context): Term = kernel.Apply_fun(self) + def args given (ctx: Context): List[Term] = kernel.Apply_args(self) } object IsTypeApply { /** Matches any TypeApply and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeApply] = + def unapply(tree: Tree) given (ctx: Context): Option[TypeApply] = kernel.matchTypeApply(tree) } @@ -434,144 +434,144 @@ trait TreeOps extends Core { object TypeApply { /** Create a function type application `[]` */ - def apply(fun: Term, args: List[TypeTree])(implicit ctx: Context): TypeApply = + def apply(fun: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = kernel.TypeApply_apply(fun, args) - def copy(original: Tree)(fun: Term, args: List[TypeTree])(implicit ctx: Context): TypeApply = + def copy(original: Tree)(fun: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = kernel.TypeApply_copy(original)(fun, args) /** Matches a function type application `[]` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, List[TypeTree])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, List[TypeTree])] = kernel.matchTypeApply(tree).map(x => (x.fun, x.args)) } implicit class TypeApplyAPI(self: TypeApply) { - def fun(implicit ctx: Context): Term = kernel.TypeApply_fun(self) - def args(implicit ctx: Context): List[TypeTree] = kernel.TypeApply_args(self) + def fun given (ctx: Context): Term = kernel.TypeApply_fun(self) + def args given (ctx: Context): List[TypeTree] = kernel.TypeApply_args(self) } object IsSuper { /** Matches any Super and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Super] = kernel.matchSuper(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Super] = kernel.matchSuper(tree) } /** Scala `x.super` or `x.super[id]` */ object Super { /** Creates a `.super[` */ - def apply(qual: Term, mix: Option[Id])(implicit ctx: Context): Super = + def apply(qual: Term, mix: Option[Id]) given (ctx: Context): Super = kernel.Super_apply(qual, mix) - def copy(original: Tree)(qual: Term, mix: Option[Id])(implicit ctx: Context): Super = + def copy(original: Tree)(qual: Term, mix: Option[Id]) given (ctx: Context): Super = kernel.Super_copy(original)(qual, mix) /** Matches a `.super[` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, Option[Id])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, Option[Id])] = kernel.matchSuper(tree).map(x => (x.qualifier, x.id)) } implicit class SuperAPI(self: Super) { - def qualifier(implicit ctx: Context): Term = kernel.Super_qualifier(self) - def id(implicit ctx: Context): Option[Id] = kernel.Super_id(self) + def qualifier given (ctx: Context): Term = kernel.Super_qualifier(self) + def id given (ctx: Context): Option[Id] = kernel.Super_id(self) } object IsTyped { /** Matches any Typed and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Typed] = kernel.matchTyped(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Typed] = kernel.matchTyped(tree) } /** Scala ascription `x: T` */ object Typed { /** Create a type ascription `: ` */ - def apply(expr: Term, tpt: TypeTree)(implicit ctx: Context): Typed = + def apply(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = kernel.Typed_apply(expr, tpt) - def copy(original: Tree)(expr: Term, tpt: TypeTree)(implicit ctx: Context): Typed = + def copy(original: Tree)(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = kernel.Typed_copy(original)(expr, tpt) /** Matches `: ` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, TypeTree)] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, TypeTree)] = kernel.matchTyped(tree).map(x => (x.expr, x.tpt)) } implicit class TypedAPI(self: Typed) { - def expr(implicit ctx: Context): Term = kernel.Typed_expr(self) - def tpt(implicit ctx: Context): TypeTree = kernel.Typed_tpt(self) + def expr given (ctx: Context): Term = kernel.Typed_expr(self) + def tpt given (ctx: Context): TypeTree = kernel.Typed_tpt(self) } object IsAssign { /** Matches any Assign and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Assign] = kernel.matchAssign(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Assign] = kernel.matchAssign(tree) } /** Scala assign `x = y` */ object Assign { /** Create an assignment ` = ` */ - def apply(lhs: Term, rhs: Term)(implicit ctx: Context): Assign = + def apply(lhs: Term, rhs: Term) given (ctx: Context): Assign = kernel.Assign_apply(lhs, rhs) - def copy(original: Tree)(lhs: Term, rhs: Term)(implicit ctx: Context): Assign = + def copy(original: Tree)(lhs: Term, rhs: Term) given (ctx: Context): Assign = kernel.Assign_copy(original)(lhs, rhs) /** Matches an assignment ` = ` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, Term)] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, Term)] = kernel.matchAssign(tree).map(x => (x.lhs, x.rhs)) } implicit class AssignAPI(self: Assign) { - def lhs(implicit ctx: Context): Term = kernel.Assign_lhs(self) - def rhs(implicit ctx: Context): Term = kernel.Assign_rhs(self) + def lhs given (ctx: Context): Term = kernel.Assign_lhs(self) + def rhs given (ctx: Context): Term = kernel.Assign_rhs(self) } object IsBlock { /** Matches any Block and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Block] = kernel.matchBlock(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Block] = kernel.matchBlock(tree) } /** Scala code block `{ stat0; ...; statN; expr }` term */ object Block { /** Creates a block `{ ; }` */ - def apply(stats: List[Statement], expr: Term)(implicit ctx: Context): Block = + def apply(stats: List[Statement], expr: Term) given (ctx: Context): Block = kernel.Block_apply(stats, expr) - def copy(original: Tree)(stats: List[Statement], expr: Term)(implicit ctx: Context): Block = + def copy(original: Tree)(stats: List[Statement], expr: Term) given (ctx: Context): Block = kernel.Block_copy(original)(stats, expr) /** Matches a block `{ ; }` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(List[Statement], Term)] = + def unapply(tree: Tree) given (ctx: Context): Option[(List[Statement], Term)] = kernel.matchBlock(tree).map(x => (x.statements, x.expr)) } implicit class BlockAPI(self: Block) { - def statements(implicit ctx: Context): List[Statement] = kernel.Block_statements(self) - def expr(implicit ctx: Context): Term = kernel.Block_expr(self) + def statements given (ctx: Context): List[Statement] = kernel.Block_statements(self) + def expr given (ctx: Context): Term = kernel.Block_expr(self) } object IsClosure { /** Matches any Closure and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Closure] = kernel.matchClosure(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Closure] = kernel.matchClosure(tree) } object Closure { - def apply(meth: Term, tpt: Option[Type])(implicit ctx: Context): Closure = + def apply(meth: Term, tpt: Option[Type]) given (ctx: Context): Closure = kernel.Closure_apply(meth, tpt) - def copy(original: Tree)(meth: Tree, tpt: Option[Type])(implicit ctx: Context): Closure = + def copy(original: Tree)(meth: Tree, tpt: Option[Type]) given (ctx: Context): Closure = kernel.Closure_copy(original)(meth, tpt) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, Option[Type])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, Option[Type])] = kernel.matchClosure(tree).map(x => (x.meth, x.tpeOpt)) } implicit class ClosureAPI(self: Closure) { - def meth(implicit ctx: Context): Term = kernel.Closure_meth(self) - def tpeOpt(implicit ctx: Context): Option[Type] = kernel.Closure_tpeOpt(self) + def meth given (ctx: Context): Term = kernel.Closure_meth(self) + def tpeOpt given (ctx: Context): Option[Type] = kernel.Closure_tpeOpt(self) } /** A lambda `(...) => ...` in the source code is represented as @@ -587,7 +587,7 @@ trait TreeOps extends Core { * of `Lambda`. */ object Lambda { - def unapply(tree: Tree)(implicit ctx: Context): Option[(List[ValDef], Term)] = tree match { + def unapply(tree: Tree) given (ctx: Context): Option[(List[ValDef], Term)] = tree match { case Block((ddef @ DefDef(_, _, params :: Nil, _, Some(body))) :: Nil, Closure(meth, _)) if ddef.symbol == meth.symbol => Some(params, body) @@ -598,573 +598,573 @@ trait TreeOps extends Core { object IsIf { /** Matches any If and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[If] = kernel.matchIf(tree) + def unapply(tree: Tree) given (ctx: Context): Option[If] = kernel.matchIf(tree) } /** Scala `if`/`else` term */ object If { /** Create an if/then/else `if () else ` */ - def apply(cond: Term, thenp: Term, elsep: Term)(implicit ctx: Context): If = + def apply(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = kernel.If_apply(cond, thenp, elsep) - def copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(implicit ctx: Context): If = + def copy(original: Tree)(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = kernel.If_copy(original)(cond, thenp, elsep) /** Matches an if/then/else `if () else ` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, Term, Term)] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, Term, Term)] = kernel.matchIf(tree).map(x => (x.cond, x.thenp, x.elsep)) } implicit class IfAPI(self: If) { - def cond(implicit ctx: Context): Term = kernel.If_cond(self) - def thenp(implicit ctx: Context): Term = kernel.If_thenp(self) - def elsep(implicit ctx: Context): Term = kernel.If_elsep(self) + 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) } object IsMatch { /** Matches any Match and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Match] = kernel.matchMatch(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Match] = kernel.matchMatch(tree) } /** Scala `match` term */ object Match { /** Creates a pattern match ` match { }` */ - def apply(selector: Term, cases: List[CaseDef])(implicit ctx: Context): Match = + def apply(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = kernel.Match_apply(selector, cases) - def copy(original: Tree)(selector: Term, cases: List[CaseDef])(implicit ctx: Context): Match = + def copy(original: Tree)(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = kernel.Match_copy(original)(selector, cases) /** Matches a pattern match ` match { }` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, List[CaseDef])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, List[CaseDef])] = kernel.matchMatch(tree).map(x => (x.scrutinee, x.cases)) } implicit class MatchAPI(self: Match) { - def scrutinee(implicit ctx: Context): Term = kernel.Match_scrutinee(self) - def cases(implicit ctx: Context): List[CaseDef] = kernel.Match_cases(self) + def scrutinee given (ctx: Context): Term = kernel.Match_scrutinee(self) + def cases given (ctx: Context): List[CaseDef] = kernel.Match_cases(self) } object IsImplicitMatch { /** Matches any ImpliedMatch and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[ImpliedMatch] = kernel.matchImplicitMatch(tree) + def unapply(tree: Tree) given (ctx: Context): Option[ImpliedMatch] = kernel.matchImplicitMatch(tree) } /** Scala implicit `match` term */ object ImpliedMatch { /** Creates a pattern match `delegate match { }` */ - def apply(cases: List[CaseDef])(implicit ctx: Context): ImpliedMatch = + def apply(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = kernel.ImplicitMatch_apply(cases) - def copy(original: Tree)(cases: List[CaseDef])(implicit ctx: Context): ImpliedMatch = + def copy(original: Tree)(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = kernel.ImplicitMatch_copy(original)(cases) /** Matches a pattern match `delegate match { }` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[List[CaseDef]] = + def unapply(tree: Tree) given (ctx: Context): Option[List[CaseDef]] = kernel.matchImplicitMatch(tree).map(_.cases) } implicit class ImplicitMatchAPI(self: ImpliedMatch) { - def cases(implicit ctx: Context): List[CaseDef] = kernel.ImplicitMatch_cases(self) + def cases given (ctx: Context): List[CaseDef] = kernel.ImplicitMatch_cases(self) } object IsTry { /** Matches any Try and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Try] = kernel.matchTry(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Try] = kernel.matchTry(tree) } /** Scala `try`/`catch`/`finally` term */ object Try { /** Create a try/catch `try catch { } finally ` */ - def apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(implicit ctx: Context): Try = + def apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try = kernel.Try_apply(expr, cases, finalizer) - def copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(implicit ctx: Context): Try = + def copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try = kernel.Try_copy(original)(expr, cases, finalizer) /** Matches a try/catch `try catch { } finally ` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, List[CaseDef], Option[Term])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, List[CaseDef], Option[Term])] = kernel.matchTry(tree).map(x => (x.body, x.cases, x.finalizer)) } implicit class TryAPI(self: Try) { - def body(implicit ctx: Context): Term = kernel.Try_body(self) - def cases(implicit ctx: Context): List[CaseDef] = kernel.Try_cases(self) - def finalizer(implicit ctx: Context): Option[Term] = kernel.Try_finalizer(self) + 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) } object IsReturn { /** Matches any Return and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Return] = kernel.matchReturn(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Return] = kernel.matchReturn(tree) } /** Scala local `return` */ object Return { /** Creates `return ` */ - def apply(expr: Term)(implicit ctx: Context): Return = + def apply(expr: Term) given (ctx: Context): Return = kernel.Return_apply(expr) - def copy(original: Tree)(expr: Term)(implicit ctx: Context): Return = + def copy(original: Tree)(expr: Term) given (ctx: Context): Return = kernel.Return_copy(original)(expr) /** Matches `return ` */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Term] = + def unapply(tree: Tree) given (ctx: Context): Option[Term] = kernel.matchReturn(tree).map(_.expr) } implicit class ReturnAPI(self: Return) { - def expr(implicit ctx: Context): Term = kernel.Return_expr(self) + def expr given (ctx: Context): Term = kernel.Return_expr(self) } object IsRepeated { /** Matches any Repeated and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Repeated] = kernel.matchRepeated(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Repeated] = kernel.matchRepeated(tree) } object Repeated { - def apply(elems: List[Term], tpt: TypeTree)(implicit ctx: Context): Repeated = + def apply(elems: List[Term], tpt: TypeTree) given (ctx: Context): Repeated = kernel.Repeated_apply(elems, tpt) - def copy(original: Tree)(elems: List[Term], tpt: TypeTree)(implicit ctx: Context): Repeated = + def copy(original: Tree)(elems: List[Term], tpt: TypeTree) given (ctx: Context): Repeated = kernel.Repeated_copy(original)(elems, tpt) - def unapply(tree: Tree)(implicit ctx: Context): Option[(List[Term], TypeTree)] = + def unapply(tree: Tree) given (ctx: Context): Option[(List[Term], TypeTree)] = kernel.matchRepeated(tree).map(x => (x.elems, x.elemtpt)) } implicit class RepeatedAPI(self: Repeated) { - def elems(implicit ctx: Context): List[Term] = kernel.Repeated_elems(self) - def elemtpt(implicit ctx: Context): TypeTree = kernel.Repeated_elemtpt(self) + def elems given (ctx: Context): List[Term] = kernel.Repeated_elems(self) + def elemtpt given (ctx: Context): TypeTree = kernel.Repeated_elemtpt(self) } object IsInlined { /** Matches any Inlined and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Inlined] = kernel.matchInlined(tree) + def unapply(tree: Tree) given (ctx: Context): Option[Inlined] = kernel.matchInlined(tree) } object Inlined { - def apply(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined = + def apply(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = kernel.Inlined_apply(call, bindings, expansion) - def copy(original: Tree)(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined = + 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) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Option[Tree /* Term | TypeTree */], List[Definition], Term)] = + 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)) } implicit class InlinedAPI(self: Inlined) { - def call(implicit ctx: Context): Option[Tree /* Term | TypeTree */] = kernel.Inlined_call(self) - def bindings(implicit ctx: Context): List[Definition] = kernel.Inlined_bindings(self) - def body(implicit ctx: Context): Term = kernel.Inlined_body(self) + 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) } object IsSelectOuter { /** Matches any SelectOuter and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[SelectOuter] = kernel.matchSelectOuter(tree) + def unapply(tree: Tree) given (ctx: Context): Option[SelectOuter] = kernel.matchSelectOuter(tree) } object SelectOuter { - def apply(qualifier: Term, name: String, levels: Int)(implicit ctx: Context): SelectOuter = + def apply(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = kernel.SelectOuter_apply(qualifier, name, levels) - def copy(original: Tree)(qualifier: Term, name: String, levels: Int)(implicit ctx: Context): SelectOuter = + def copy(original: Tree)(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = kernel.SelectOuter_copy(original)(qualifier, name, levels) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, Int, Type)] = // TODO homogenize order of parameters + 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)) } implicit class SelectOuterAPI(self: SelectOuter) { - def qualifier(implicit ctx: Context): Term = kernel.SelectOuter_qualifier(self) - def level(implicit ctx: Context): Int = kernel.SelectOuter_level(self) - def tpe(implicit ctx: Context): Type = kernel.SelectOuter_tpe(self) + 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) } object IsWhile { /** Matches any While and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[While] = kernel.matchWhile(tree) + def unapply(tree: Tree) given (ctx: Context): Option[While] = kernel.matchWhile(tree) } object While { /** Creates a while loop `while () ` and returns (, ) */ - def apply(cond: Term, body: Term)(implicit ctx: Context): While = + def apply(cond: Term, body: Term) given (ctx: Context): While = kernel.While_apply(cond, body) - def copy(original: Tree)(cond: Term, body: Term)(implicit ctx: Context): While = + def copy(original: Tree)(cond: Term, body: Term) given (ctx: Context): While = kernel.While_copy(original)(cond, body) /** Extractor for while loops. Matches `while () ` and returns (, ) */ - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, Term)] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, Term)] = kernel.matchWhile(tree).map(x => (x.cond, x.body)) } implicit class WhileAPI(self: While) { - def cond(implicit ctx: Context): Term = kernel.While_cond(self) - def body(implicit ctx: Context): Term = kernel.While_body(self) + def cond given (ctx: Context): Term = kernel.While_cond(self) + def body given (ctx: Context): Term = kernel.While_body(self) } // ----- TypeTrees ------------------------------------------------ implicit class TypeTreeAPI(self: TypeTree) { /** Position in the source code */ - def pos(implicit ctx: Context): Position = kernel.TypeTree_pos(self) + def pos given (ctx: Context): Position = kernel.TypeTree_pos(self) /** Type of this type tree */ - def tpe(implicit ctx: Context): Type = kernel.TypeTree_tpe(self) + def tpe given (ctx: Context): Type = kernel.TypeTree_tpe(self) /** Symbol of this type tree */ - def symbol(implicit ctx: Context): Symbol = kernel.TypeTree_symbol(self) + def symbol given (ctx: Context): Symbol = kernel.TypeTree_symbol(self) } object IsTypeTree { - def unapply(tpt: Tree)(implicit ctx: Context): Option[TypeTree] = + def unapply(tpt: Tree) given (ctx: Context): Option[TypeTree] = kernel.matchTypeTree(tpt) } object IsInferred { /** Matches any Inferred and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Inferred] = + def unapply(tree: Tree) given (ctx: Context): Option[Inferred] = kernel.matchInferred(tree) } /** TypeTree containing an inferred type */ object Inferred { - def apply(tpe: Type)(implicit ctx: Context): Inferred = + def apply(tpe: Type) given (ctx: Context): Inferred = kernel.Inferred_apply(tpe) /** Matches a TypeTree containing an inferred type */ - def unapply(tree: Tree)(implicit ctx: Context): Boolean = + def unapply(tree: Tree) given (ctx: Context): Boolean = kernel.matchInferred(tree).isDefined } object IsTypeIdent { /** Matches any TypeIdent and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeIdent] = + def unapply(tree: Tree) given (ctx: Context): Option[TypeIdent] = kernel.matchTypeIdent(tree) } implicit class TypeIdentAPI(self: TypeIdent) { - def name(implicit ctx: Context): String = kernel.TypeIdent_name(self) + def name given (ctx: Context): String = kernel.TypeIdent_name(self) } object TypeIdent { - // TODO def apply(name: String)(implicit ctx: Context): TypeIdent - def copy(original: TypeIdent)(name: String)(implicit ctx: Context): 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) - def unapply(tree: Tree)(implicit ctx: Context): Option[String] = + def unapply(tree: Tree) given (ctx: Context): Option[String] = kernel.matchTypeIdent(tree).map(_.name) } object IsTypeSelect { /** Matches any TypeSelect and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeSelect] = + def unapply(tree: Tree) given (ctx: Context): Option[TypeSelect] = kernel.matchTypeSelect(tree) } object TypeSelect { - def apply(qualifier: Term, name: String)(implicit ctx: Context): TypeSelect = + def apply(qualifier: Term, name: String) given (ctx: Context): TypeSelect = kernel.TypeSelect_apply(qualifier, name) - def copy(original: TypeSelect)(qualifier: Term, name: String)(implicit ctx: Context): TypeSelect = + def copy(original: TypeSelect)(qualifier: Term, name: String) given (ctx: Context): TypeSelect = kernel.TypeSelect_copy(original)(qualifier, name) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Term, String)] = + def unapply(tree: Tree) given (ctx: Context): Option[(Term, String)] = kernel.matchTypeSelect(tree).map(x => (x.qualifier, x.name)) } implicit class TypeSelectAPI(self: TypeSelect) { - def qualifier(implicit ctx: Context): Term = kernel.TypeSelect_qualifier(self) - def name(implicit ctx: Context): String = kernel.TypeSelect_name(self) + def qualifier given (ctx: Context): Term = kernel.TypeSelect_qualifier(self) + def name given (ctx: Context): String = kernel.TypeSelect_name(self) } object IsProjection { /** Matches any Projection and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Projection] = + def unapply(tree: Tree) given (ctx: Context): Option[Projection] = kernel.matchProjection(tree) } object Projection { - // TODO def apply(qualifier: TypeTree, name: String)(implicit ctx: Context): Project - def copy(original: Projection)(qualifier: TypeTree, name: String)(implicit ctx: Context): 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) - def unapply(tree: Tree)(implicit ctx: Context): Option[(TypeTree, String)] = + def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, String)] = kernel.matchProjection(tree).map(x => (x.qualifier, x.name)) } implicit class ProjectionAPI(self: Projection) { - def qualifier(implicit ctx: Context): TypeTree = kernel.Projection_qualifier(self) - def name(implicit ctx: Context): String = kernel.Projection_name(self) + def qualifier given (ctx: Context): TypeTree = kernel.Projection_qualifier(self) + def name given (ctx: Context): String = kernel.Projection_name(self) } object IsSingleton { /** Matches any Singleton and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Singleton] = + def unapply(tree: Tree) given (ctx: Context): Option[Singleton] = kernel.matchSingleton(tree) } object Singleton { - def apply(ref: Term)(implicit ctx: Context): Singleton = + def apply(ref: Term) given (ctx: Context): Singleton = kernel.Singleton_apply(ref) - def copy(original: Singleton)(ref: Term)(implicit ctx: Context): Singleton = + def copy(original: Singleton)(ref: Term) given (ctx: Context): Singleton = kernel.Singleton_copy(original)(ref) - def unapply(tree: Tree)(implicit ctx: Context): Option[Term] = + def unapply(tree: Tree) given (ctx: Context): Option[Term] = kernel.matchSingleton(tree).map(_.ref) } implicit class SingletonAPI(self: Singleton) { - def ref(implicit ctx: Context): Term = kernel.Singleton_ref(self) + def ref given (ctx: Context): Term = kernel.Singleton_ref(self) } object IsRefined { /** Matches any Refined and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Refined] = + def unapply(tree: Tree) given (ctx: Context): Option[Refined] = kernel.matchRefined(tree) } object Refined { - // TODO def apply(tpt: TypeTree, refinements: List[Definition])(implicit ctx: Context): Refined - def copy(original: Refined)(tpt: TypeTree, refinements: List[Definition])(implicit ctx: Context): 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) - def unapply(tree: Tree)(implicit ctx: Context): Option[(TypeTree, List[Definition])] = + def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, List[Definition])] = kernel.matchRefined(tree).map(x => (x.tpt, x.refinements)) } implicit class RefinedAPI(self: Refined) { - def tpt(implicit ctx: Context): TypeTree = kernel.Refined_tpt(self) - def refinements(implicit ctx: Context): List[Definition] = kernel.Refined_refinements(self) + def tpt given (ctx: Context): TypeTree = kernel.Refined_tpt(self) + def refinements given (ctx: Context): List[Definition] = kernel.Refined_refinements(self) } object IsApplied { /** Matches any Applied and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Applied] = + def unapply(tree: Tree) given (ctx: Context): Option[Applied] = kernel.matchApplied(tree) } object Applied { - def apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(implicit ctx: Context): Applied = + def apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/]) given (ctx: Context): Applied = kernel.Applied_apply(tpt, args) - def copy(original: Applied)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(implicit ctx: Context): Applied = + def copy(original: Applied)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/]) given (ctx: Context): Applied = kernel.Applied_copy(original)(tpt, args) - def unapply(tree: Tree)(implicit ctx: Context): Option[(TypeTree, List[Tree /*TypeTree | TypeBoundsTree*/])] = + def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, List[Tree /*TypeTree | TypeBoundsTree*/])] = kernel.matchApplied(tree).map(x => (x.tpt, x.args)) } implicit class AppliedAPI(self: Applied) { - def tpt(implicit ctx: Context): TypeTree = kernel.Applied_tpt(self) - def args(implicit ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] = kernel.Applied_args(self) + def tpt given (ctx: Context): TypeTree = kernel.Applied_tpt(self) + def args given (ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] = kernel.Applied_args(self) } object IsAnnotated { /** Matches any Annotated and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[Annotated] = + def unapply(tree: Tree) given (ctx: Context): Option[Annotated] = kernel.matchAnnotated(tree) } object Annotated { - def apply(arg: TypeTree, annotation: Term)(implicit ctx: Context): Annotated = + def apply(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = kernel.Annotated_apply(arg, annotation) - def copy(original: Annotated)(arg: TypeTree, annotation: Term)(implicit ctx: Context): Annotated = + def copy(original: Annotated)(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = kernel.Annotated_copy(original)(arg, annotation) - def unapply(tree: Tree)(implicit ctx: Context): Option[(TypeTree, Term)] = + def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, Term)] = kernel.matchAnnotated(tree).map(x => (x.arg, x.annotation)) } implicit class AnnotatedAPI(self: Annotated) { - def arg(implicit ctx: Context): TypeTree = kernel.Annotated_arg(self) - def annotation(implicit ctx: Context): Term = kernel.Annotated_annotation(self) + def arg given (ctx: Context): TypeTree = kernel.Annotated_arg(self) + def annotation given (ctx: Context): Term = kernel.Annotated_annotation(self) } object IsMatchTypeTree { /** Matches any MatchTypeTree and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[MatchTypeTree] = + def unapply(tree: Tree) given (ctx: Context): Option[MatchTypeTree] = kernel.matchMatchTypeTree(tree) } object MatchTypeTree { - def apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(implicit ctx: Context): MatchTypeTree = + def apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree = kernel.MatchTypeTree_apply(bound, selector, cases) - def copy(original: MatchTypeTree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(implicit ctx: Context): MatchTypeTree = + def copy(original: MatchTypeTree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree = kernel.MatchTypeTree_copy(original)(bound, selector, cases) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Option[TypeTree], TypeTree, List[TypeCaseDef])] = + def unapply(tree: Tree) given (ctx: Context): Option[(Option[TypeTree], TypeTree, List[TypeCaseDef])] = kernel.matchMatchTypeTree(tree).map(x => (x.bound, x.selector, x.cases)) } implicit class MatchTypeTreeAPI(self: MatchTypeTree) { - def bound(implicit ctx: Context): Option[TypeTree] = kernel.MatchTypeTree_bound(self) - def selector(implicit ctx: Context): TypeTree = kernel.MatchTypeTree_selector(self) - def cases(implicit ctx: Context): List[TypeCaseDef] = kernel.MatchTypeTree_cases(self) + 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) } object IsByName { /** Matches any ByName and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[ByName] = + def unapply(tree: Tree) given (ctx: Context): Option[ByName] = kernel.matchByName(tree) } object ByName { - def apply(result: TypeTree)(implicit ctx: Context): ByName = + def apply(result: TypeTree) given (ctx: Context): ByName = kernel.ByName_apply(result) - def copy(original: ByName)(result: TypeTree)(implicit ctx: Context): ByName = + def copy(original: ByName)(result: TypeTree) given (ctx: Context): ByName = kernel.ByName_copy(original)(result) - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeTree] = + def unapply(tree: Tree) given (ctx: Context): Option[TypeTree] = kernel.matchByName(tree).map(_.result) } implicit class ByNameAPI(self: ByName) { - def result(implicit ctx: Context): TypeTree = kernel.ByName_result(self) + def result given (ctx: Context): TypeTree = kernel.ByName_result(self) } object IsLambdaTypeTree { /** Matches any LambdaTypeTree and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[LambdaTypeTree] = + def unapply(tree: Tree) given (ctx: Context): Option[LambdaTypeTree] = kernel.matchLambdaTypeTree(tree) } object LambdaTypeTree { - def apply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): LambdaTypeTree = + def apply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): LambdaTypeTree = kernel.Lambdaapply(tparams, body) - def copy(original: LambdaTypeTree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): LambdaTypeTree = + def copy(original: LambdaTypeTree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/) given (ctx: Context): LambdaTypeTree = kernel.Lambdacopy(original)(tparams, body) - def unapply(tree: Tree)(implicit ctx: Context): Option[(List[TypeDef], Tree /*TypeTree | TypeBoundsTree*/)] = + def unapply(tree: Tree) given (ctx: Context): Option[(List[TypeDef], Tree /*TypeTree | TypeBoundsTree*/)] = kernel.matchLambdaTypeTree(tree).map(x => (x.tparams, x.body)) } implicit class LambdaTypeTreeAPI(self: LambdaTypeTree) { - def tparams(implicit ctx: Context): List[TypeDef] = kernel.Lambdatparams(self) - def body(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.Lambdabody(self) + def tparams given (ctx: Context): List[TypeDef] = kernel.Lambdatparams(self) + def body given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.Lambdabody(self) } object IsTypeBind { /** Matches any TypeBind and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeBind] = + def unapply(tree: Tree) given (ctx: Context): Option[TypeBind] = kernel.matchTypeBind(tree) } object TypeBind { - // TODO def apply(name: String, tree: Tree)(implicit ctx: Context): TypeBind - def copy(original: TypeBind)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/)(implicit ctx: Context): 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) - def unapply(tree: Tree)(implicit ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/)] = + def unapply(tree: Tree) given (ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/)] = kernel.matchTypeBind(tree).map(x => (x.name, x.body)) } implicit class TypeBindAPI(self: TypeBind) { - def name(implicit ctx: Context): String = kernel.TypeBind_name(self) - def body(implicit ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.TypeBind_body(self) + def name given (ctx: Context): String = kernel.TypeBind_name(self) + def body given (ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = kernel.TypeBind_body(self) } object IsTypeBlock { /** Matches any TypeBlock and returns it */ - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeBlock] = + def unapply(tree: Tree) given (ctx: Context): Option[TypeBlock] = kernel.matchTypeBlock(tree) } object TypeBlock { - def apply(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeBlock = + def apply(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = kernel.TypeBlock_apply(aliases, tpt) - def copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeBlock = + def copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = kernel.TypeBlock_copy(original)(aliases, tpt) - def unapply(tree: Tree)(implicit ctx: Context): Option[(List[TypeDef], TypeTree)] = + def unapply(tree: Tree) given (ctx: Context): Option[(List[TypeDef], TypeTree)] = kernel.matchTypeBlock(tree).map(x => (x.aliases, x.tpt)) } implicit class TypeBlockAPI(self: TypeBlock) { - def aliases(implicit ctx: Context): List[TypeDef] = kernel.TypeBlock_aliases(self) - def tpt(implicit ctx: Context): TypeTree = kernel.TypeBlock_tpt(self) + def aliases given (ctx: Context): List[TypeDef] = kernel.TypeBlock_aliases(self) + def tpt given (ctx: Context): TypeTree = kernel.TypeBlock_tpt(self) } // ----- TypeBoundsTrees ------------------------------------------------ implicit class TypeBoundsTreeAPI(self: TypeBoundsTree) { - def tpe(implicit ctx: Context): TypeBounds = kernel.TypeBoundsTree_tpe(self) - def low(implicit ctx: Context): TypeTree = kernel.TypeBoundsTree_low(self) - def hi(implicit ctx: Context): TypeTree = kernel.TypeBoundsTree_hi(self) + 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) } object IsTypeBoundsTree { - def unapply(tree: Tree)(implicit ctx: Context): Option[TypeBoundsTree] = + def unapply(tree: Tree) given (ctx: Context): Option[TypeBoundsTree] = kernel.matchTypeBoundsTree(tree) } object TypeBoundsTree { - def unapply(tree: Tree)(implicit ctx: Context): Option[(TypeTree, TypeTree)] = + def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, TypeTree)] = kernel.matchTypeBoundsTree(tree).map(x => (x.low, x.hi)) } implicit class WildcardTypeTreeAPI(self: WildcardTypeTree) { - def tpe(implicit ctx: Context): TypeOrBounds = kernel.WildcardTypeTree_tpe(self) + def tpe given (ctx: Context): TypeOrBounds = kernel.WildcardTypeTree_tpe(self) } object IsWildcardTypeTree { - def unapply(tree: Tree)(implicit ctx: Context): Option[WildcardTypeTree] = + def unapply(tree: Tree) given (ctx: Context): Option[WildcardTypeTree] = kernel.matchWildcardTypeTree(tree) } /** TypeBoundsTree containing wildcard type bounds */ object WildcardTypeTree { /** Matches a TypeBoundsTree containing wildcard type bounds */ - def unapply(tree: Tree)(implicit ctx: Context): Boolean = + def unapply(tree: Tree) given (ctx: Context): Boolean = kernel.matchWildcardTypeTree(tree).isDefined } // ----- CaseDefs ------------------------------------------------ implicit class CaseDefAPI(caseDef: CaseDef) { - def pattern(implicit ctx: Context): Pattern = kernel.CaseDef_pattern(caseDef) - def guard(implicit ctx: Context): Option[Term] = kernel.CaseDef_guard(caseDef) - def rhs(implicit ctx: Context): Term = kernel.CaseDef_rhs(caseDef) + 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) } object IsCaseDef { - def unapply(self: Tree)(implicit ctx: Context): Option[CaseDef] = + def unapply(self: Tree) given (ctx: Context): Option[CaseDef] = kernel.matchCaseDef(self) } object CaseDef { - def apply(pattern: Pattern, guard: Option[Term], rhs: Term)(implicit ctx: Context): CaseDef = + def apply(pattern: Pattern, guard: Option[Term], rhs: Term) given (ctx: Context): CaseDef = kernel.CaseDef_module_apply(pattern, guard, rhs) - def copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], rhs: Term)(implicit ctx: Context): CaseDef = + def copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], rhs: Term) given (ctx: Context): CaseDef = kernel.CaseDef_module_copy(original)(pattern, guard, rhs) - def unapply(tree: Tree)(implicit ctx: Context): Option[(Pattern, Option[Term], Term)] = + def unapply(tree: Tree) given (ctx: Context): Option[(Pattern, Option[Term], Term)] = kernel.matchCaseDef(tree).map( x => (x.pattern, x.guard, x.rhs)) } implicit class TypeCaseDefAPI(caseDef: TypeCaseDef) { - def pattern(implicit ctx: Context): TypeTree = kernel.TypeCaseDef_pattern(caseDef) - def rhs(implicit ctx: Context): TypeTree = kernel.TypeCaseDef_rhs(caseDef) + def pattern given (ctx: Context): TypeTree = kernel.TypeCaseDef_pattern(caseDef) + def rhs given (ctx: Context): TypeTree = kernel.TypeCaseDef_rhs(caseDef) } object IsTypeCaseDef { - def unapply(self: Tree)(implicit ctx: Context): Option[TypeCaseDef] = + def unapply(self: Tree) given (ctx: Context): Option[TypeCaseDef] = kernel.matchTypeCaseDef(self) } object TypeCaseDef { - def apply(pattern: TypeTree, rhs: TypeTree)(implicit ctx: Context): TypeCaseDef = + def apply(pattern: TypeTree, rhs: TypeTree) given (ctx: Context): TypeCaseDef = kernel.TypeCaseDef_module_apply(pattern, rhs) - def copy(original: TypeCaseDef)(pattern: TypeTree, rhs: TypeTree)(implicit ctx: Context): TypeCaseDef = + def copy(original: TypeCaseDef)(pattern: TypeTree, rhs: TypeTree) given (ctx: Context): TypeCaseDef = kernel.TypeCaseDef_module_copy(original)(pattern, rhs) - def unapply(tree: Tree)(implicit ctx: Context): Option[(TypeTree, TypeTree)] = + def unapply(tree: Tree) given (ctx: Context): Option[(TypeTree, TypeTree)] = kernel.matchTypeCaseDef(tree).map( x => (x.pattern, x.rhs)) } } diff --git a/library/src/scala/tasty/reflect/TreeUtils.scala b/library/src/scala/tasty/reflect/TreeUtils.scala index 8f7f88235586..21bfb65add45 100644 --- a/library/src/scala/tasty/reflect/TreeUtils.scala +++ b/library/src/scala/tasty/reflect/TreeUtils.scala @@ -11,13 +11,13 @@ trait TreeUtils abstract class TreeAccumulator[X] { // Ties the knot of the traversal: call `foldOver(x, tree))` to dive in the `tree` node. - def foldTree(x: X, tree: Tree)(implicit ctx: Context): X - def foldPattern(x: X, tree: Pattern)(implicit ctx: Context): X + def foldTree(x: X, tree: Tree) given (ctx: Context): X + def foldPattern(x: X, tree: Pattern) given (ctx: Context): X - def foldTrees(x: X, trees: Iterable[Tree])(implicit ctx: Context): X = (x /: trees)(foldTree) - def foldPatterns(x: X, trees: Iterable[Pattern])(implicit ctx: Context): X = (x /: trees)(foldPattern) + def foldTrees(x: X, trees: Iterable[Tree]) given (ctx: Context): X = (x /: trees)(foldTree) + def foldPatterns(x: X, trees: Iterable[Pattern]) given (ctx: Context): X = (x /: trees)(foldPattern) - def foldOverTree(x: X, tree: Tree)(implicit ctx: Context): X = { + def foldOverTree(x: X, tree: Tree) given (ctx: Context): X = { def localCtx(definition: Definition): Context = definition.symbol.localContext tree match { case Ident(_) => @@ -75,7 +75,7 @@ trait TreeUtils case Import(_, expr, _) => foldTree(x, expr) case IsPackageClause(clause @ PackageClause(pid, stats)) => - foldTrees(foldTree(x, pid), stats)(clause.symbol.localContext) + foldTrees(foldTree(x, pid), stats) given clause.symbol.localContext case Inferred() => x case TypeIdent(_) => x case TypeSelect(qualifier, _) => foldTree(x, qualifier) @@ -97,7 +97,7 @@ trait TreeUtils } } - def foldOverPattern(x: X, tree: Pattern)(implicit ctx: Context): X = tree match { + def foldOverPattern(x: X, tree: Pattern) given (ctx: Context): X = tree match { case Pattern.Value(v) => foldTree(x, v) case Pattern.Bind(_, body) => foldPattern(x, body) case Pattern.Unapply(fun, implicits, patterns) => foldPatterns(foldTrees(foldTree(x, fun), implicits), patterns) @@ -110,23 +110,23 @@ trait TreeUtils abstract class TreeTraverser extends TreeAccumulator[Unit] { - def traverseTree(tree: Tree)(implicit ctx: Context): Unit = traverseTreeChildren(tree) - def traversePattern(tree: Pattern)(implicit ctx: Context): Unit = traversePatternChildren(tree) + def traverseTree(tree: Tree) given (ctx: Context): Unit = traverseTreeChildren(tree) + def traversePattern(tree: Pattern) given (ctx: Context): Unit = traversePatternChildren(tree) - def foldTree(x: Unit, tree: Tree)(implicit ctx: Context): Unit = traverseTree(tree) - def foldPattern(x: Unit, tree: Pattern)(implicit ctx: Context) = traversePattern(tree) + def foldTree(x: Unit, tree: Tree) given (ctx: Context): Unit = traverseTree(tree) + def foldPattern(x: Unit, tree: Pattern) given (ctx: Context) = traversePattern(tree) - protected def traverseTreeChildren(tree: Tree)(implicit ctx: Context): Unit = foldOverTree((), tree) - protected def traversePatternChildren(tree: Pattern)(implicit ctx: Context): Unit = foldOverPattern((), tree) + protected def traverseTreeChildren(tree: Tree) given (ctx: Context): Unit = foldOverTree((), tree) + protected def traversePatternChildren(tree: Pattern) given (ctx: Context): Unit = foldOverPattern((), tree) } abstract class TreeMap { self => - def transformTree(tree: Tree)(implicit ctx: Context): Tree = { + def transformTree(tree: Tree) given (ctx: Context): Tree = { tree match { case IsPackageClause(tree) => - PackageClause.copy(tree)(transformTerm(tree.pid).asInstanceOf[Ref], transformTrees(tree.stats)(tree.symbol.localContext)) + PackageClause.copy(tree)(transformTerm(tree.pid).asInstanceOf[Ref], transformTrees(tree.stats) given tree.symbol.localContext) case IsImport(tree) => Import.copy(tree)(tree.importImplied, transformTerm(tree.expr), tree.selectors) case IsStatement(tree) => @@ -141,7 +141,7 @@ trait TreeUtils } } - def transformStatement(tree: Statement)(implicit ctx: Context): Statement = { + def transformStatement(tree: Statement) given (ctx: Context): Statement = { def localCtx(definition: Definition): Context = definition.symbol.localContext tree match { case IsTerm(tree) => @@ -164,7 +164,7 @@ trait TreeUtils } } - def transformTerm(tree: Term)(implicit ctx: Context): Term = { + def transformTerm(tree: Term) given (ctx: Context): Term = { tree match { case Ident(name) => tree @@ -209,7 +209,7 @@ trait TreeUtils } } - def transformTypeTree(tree: TypeTree)(implicit ctx: Context): TypeTree = tree match { + def transformTypeTree(tree: TypeTree) given (ctx: Context): TypeTree = tree match { case Inferred() => tree case IsTypeIdent(tree) => tree case IsTypeSelect(tree) => @@ -229,22 +229,22 @@ trait TreeUtils case IsByName(tree) => ByName.copy(tree)(transformTypeTree(tree.result)) case IsLambdaTypeTree(tree) => - LambdaTypeTree.copy(tree)(transformSubTrees(tree.tparams), transformTree(tree.body))(tree.symbol.localContext) + LambdaTypeTree.copy(tree)(transformSubTrees(tree.tparams), transformTree(tree.body)) given tree.symbol.localContext case IsTypeBind(tree) => TypeBind.copy(tree)(tree.name, tree.body) case IsTypeBlock(tree) => TypeBlock.copy(tree)(tree.aliases, tree.tpt) } - def transformCaseDef(tree: CaseDef)(implicit ctx: Context): CaseDef = { + def transformCaseDef(tree: CaseDef) given (ctx: Context): CaseDef = { CaseDef.copy(tree)(transformPattern(tree.pattern), tree.guard.map(transformTerm), transformTerm(tree.rhs)) } - def transformTypeCaseDef(tree: TypeCaseDef)(implicit ctx: Context): TypeCaseDef = { + def transformTypeCaseDef(tree: TypeCaseDef) given (ctx: Context): TypeCaseDef = { TypeCaseDef.copy(tree)(transformTypeTree(tree.pattern), transformTypeTree(tree.rhs)) } - def transformPattern(pattern: Pattern)(implicit ctx: Context): Pattern = pattern match { + def transformPattern(pattern: Pattern) given (ctx: Context): Pattern = pattern match { case Pattern.Value(_) | Pattern.WildcardPattern() => pattern case Pattern.IsTypeTest(pattern) => @@ -257,28 +257,28 @@ trait TreeUtils Pattern.Bind.copy(pattern)(pattern.name, transformPattern(pattern.pattern)) } - def transformStats(trees: List[Statement])(implicit ctx: Context): List[Statement] = + def transformStats(trees: List[Statement]) given (ctx: Context): List[Statement] = trees mapConserve (transformStatement(_)) - def transformTrees(trees: List[Tree])(implicit ctx: Context): List[Tree] = + def transformTrees(trees: List[Tree]) given (ctx: Context): List[Tree] = trees mapConserve (transformTree(_)) - def transformTerms(trees: List[Term])(implicit ctx: Context): List[Term] = + def transformTerms(trees: List[Term]) given (ctx: Context): List[Term] = trees mapConserve (transformTerm(_)) - def transformTypeTrees(trees: List[TypeTree])(implicit ctx: Context): List[TypeTree] = + def transformTypeTrees(trees: List[TypeTree]) given (ctx: Context): List[TypeTree] = trees mapConserve (transformTypeTree(_)) - def transformCaseDefs(trees: List[CaseDef])(implicit ctx: Context): List[CaseDef] = + def transformCaseDefs(trees: List[CaseDef]) given (ctx: Context): List[CaseDef] = trees mapConserve (transformCaseDef(_)) - def transformTypeCaseDefs(trees: List[TypeCaseDef])(implicit ctx: Context): List[TypeCaseDef] = + def transformTypeCaseDefs(trees: List[TypeCaseDef]) given (ctx: Context): List[TypeCaseDef] = trees mapConserve (transformTypeCaseDef(_)) - def transformPatterns(trees: List[Pattern])(implicit ctx: Context): List[Pattern] = + def transformPatterns(trees: List[Pattern]) given (ctx: Context): List[Pattern] = trees mapConserve (transformPattern(_)) - def transformSubTrees[Tr <: Tree](trees: List[Tr])(implicit ctx: Context): List[Tr] = + def transformSubTrees[Tr <: Tree](trees: List[Tr]) given (ctx: Context): List[Tr] = transformTrees(trees).asInstanceOf[List[Tr]] } diff --git a/library/src/scala/tasty/reflect/TypeOrBoundsOps.scala b/library/src/scala/tasty/reflect/TypeOrBoundsOps.scala index f095d52e29dc..2c7b6eb09a89 100644 --- a/library/src/scala/tasty/reflect/TypeOrBoundsOps.scala +++ b/library/src/scala/tasty/reflect/TypeOrBoundsOps.scala @@ -8,23 +8,23 @@ trait TypeOrBoundsOps extends Core { def typeOf[T: scala.quoted.Type]: Type implicit class TypeAPI(self: Type) { - def =:=(that: Type)(implicit ctx: Context): Boolean = kernel.`Type_=:=`(self)(that) - def <:<(that: Type)(implicit ctx: Context): Boolean = kernel.`Type_<:<`(self)(that) - def widen(implicit ctx: Context): Type = kernel.Type_widen(self) + 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) /** 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(implicit ctx: Context): Type = kernel.Type_dealias(self) + def dealias given (ctx: Context): Type = kernel.Type_dealias(self) - def classSymbol(implicit ctx: Context): Option[ClassDefSymbol] = kernel.Type_classSymbol(self) - def typeSymbol(implicit ctx: Context): Symbol = kernel.Type_typeSymbol(self) - def isSingleton(implicit ctx: Context): Boolean = kernel.Type_isSingleton(self) - def memberType(member: Symbol)(implicit ctx: Context): Type = kernel.Type_memberType(self)(member) + 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) /** Is this type an instance of a non-bottom subclass of the given class `cls`? */ - def derivesFrom(cls: ClassDefSymbol)(implicit ctx: Context): Boolean = + def derivesFrom(cls: ClassDefSymbol) given (ctx: Context): Boolean = kernel.Type_derivesFrom(self)(cls) /** Is this type a function type? @@ -36,367 +36,367 @@ 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(implicit ctx: Context): Boolean = kernel.Type_isFunctionType(self) + def isFunctionType given (ctx: Context): Boolean = kernel.Type_isFunctionType(self) /** Is this type an implicit function type? * * @see `isFunctionType` */ - def isImplicitFunctionType(implicit ctx: Context): Boolean = kernel.Type_isImplicitFunctionType(self) + def isImplicitFunctionType given (ctx: Context): Boolean = kernel.Type_isImplicitFunctionType(self) /** Is this type an erased function type? * * @see `isFunctionType` */ - def isErasedFunctionType(implicit ctx: Context): Boolean = kernel.Type_isErasedFunctionType(self) + def isErasedFunctionType given (ctx: Context): Boolean = kernel.Type_isErasedFunctionType(self) /** Is this type a dependent function type? * * @see `isFunctionType` */ - def isDependentFunctionType(implicit ctx: Context): Boolean = kernel.Type_isDependentFunctionType(self) + def isDependentFunctionType given (ctx: Context): Boolean = kernel.Type_isDependentFunctionType(self) } object IsType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[Type] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Type] = kernel.matchType(typeOrBounds) } object Type { - def apply(clazz: Class[_])(implicit ctx: Context): Type = kernel.Type_apply(clazz) + def apply(clazz: Class[_]) given (ctx: Context): Type = kernel.Type_apply(clazz) object IsConstantType { /** Matches any ConstantType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[ConstantType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[ConstantType] = kernel.matchConstantType(tpe) } object ConstantType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[Constant] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Constant] = kernel.matchConstantType(typeOrBounds).map(_.constant) } object IsSymRef { /** Matches any SymRef and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[SymRef] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[SymRef] = kernel.matchSymRef(tpe) } object SymRef { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Symbol, TypeOrBounds /* Type | NoPrefix */)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Symbol, TypeOrBounds /* Type | NoPrefix */)] = kernel.matchSymRef_unapply(typeOrBounds) } object IsTermRef { /** Matches any TermRef and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[TermRef] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[TermRef] = kernel.matchTermRef(tpe) } object TermRef { // TODO should qual be a Type? - def apply(qual: TypeOrBounds, name: String)(implicit ctx: Context): TermRef = + def apply(qual: TypeOrBounds, name: String) given (ctx: Context): TermRef = kernel.TermRef_apply(qual, name) - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(String, TypeOrBounds /* Type | NoPrefix */)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(String, TypeOrBounds /* Type | NoPrefix */)] = kernel.matchTermRef(typeOrBounds).map(x => (x.name, x.qualifier)) } object IsTypeRef { /** Matches any TypeRef and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[TypeRef] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[TypeRef] = kernel.matchTypeRef(tpe) } object TypeRef { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(String, TypeOrBounds /* Type | NoPrefix */)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(String, TypeOrBounds /* Type | NoPrefix */)] = kernel.matchTypeRef(typeOrBounds).map(x => (x.name, x.qualifier)) } object IsSuperType { /** Matches any SuperType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[SuperType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[SuperType] = kernel.matchSuperType(tpe) } object SuperType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Type, Type)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type)] = kernel.matchSuperType(typeOrBounds).map(x => (x.thistpe, x.supertpe)) } object IsRefinement { /** Matches any Refinement and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[Refinement] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[Refinement] = kernel.matchRefinement(tpe) } object Refinement { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Type, String, TypeOrBounds /* Type | TypeBounds */)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, String, TypeOrBounds /* Type | TypeBounds */)] = kernel.matchRefinement(typeOrBounds).map(x => (x.parent, x.name, x.info)) } object IsAppliedType { /** Matches any AppliedType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[AppliedType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[AppliedType] = kernel.matchAppliedType(tpe) } object AppliedType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Type, List[TypeOrBounds /* Type | TypeBounds */])] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, List[TypeOrBounds /* Type | TypeBounds */])] = kernel.matchAppliedType(typeOrBounds).map(x => (x.tycon, x.args)) } object IsAnnotatedType { /** Matches any AnnotatedType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[AnnotatedType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[AnnotatedType] = kernel.matchAnnotatedType(tpe) } object AnnotatedType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Type, Term)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Term)] = kernel.matchAnnotatedType(typeOrBounds).map(x => (x.underlying, x.annot)) } object IsAndType { /** Matches any AndType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[AndType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[AndType] = kernel.matchAndType(tpe) } object AndType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Type, Type)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type)] = kernel.matchAndType(typeOrBounds).map(x => (x.left, x.right)) } object IsOrType { /** Matches any OrType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[OrType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[OrType] = kernel.matchOrType(tpe) } object OrType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Type, Type)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type)] = kernel.matchOrType(typeOrBounds).map(x => (x.left, x.right)) } object IsMatchType { /** Matches any MatchType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[MatchType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[MatchType] = kernel.matchMatchType(tpe) } object MatchType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Type, Type, List[Type])] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type, List[Type])] = kernel.matchMatchType(typeOrBounds).map(x => (x.bound, x.scrutinee, x.cases)) } object IsByNameType { /** Matches any ByNameType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[ByNameType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[ByNameType] = kernel.matchByNameType(tpe) } object ByNameType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[Type] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Type] = kernel.matchByNameType(typeOrBounds).map(_.underlying) } object IsParamRef { /** Matches any ParamRef and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[ParamRef] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[ParamRef] = kernel.matchParamRef(tpe) } object ParamRef { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(LambdaType[TypeOrBounds], Int)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(LambdaType[TypeOrBounds], Int)] = kernel.matchParamRef(typeOrBounds).map(x => (x.binder, x.paramNum)) } object IsThisType { /** Matches any ThisType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[ThisType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[ThisType] = kernel.matchThisType(tpe) } object ThisType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[Type] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Type] = kernel.matchThisType(typeOrBounds).map(_.tref) } object IsRecursiveThis { /** Matches any RecursiveThis and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[RecursiveThis] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveThis] = kernel.matchRecursiveThis(tpe) } object RecursiveThis { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[RecursiveType] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[RecursiveType] = kernel.matchRecursiveThis(typeOrBounds).map(_.binder) } object IsRecursiveType { /** Matches any RecursiveType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[RecursiveType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveType] = kernel.matchRecursiveType(tpe) } object RecursiveType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[Type] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[Type] = kernel.matchRecursiveType(typeOrBounds).map(_.underlying) } object IsMethodType { /** Matches any MethodType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[MethodType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[MethodType] = kernel.matchMethodType(tpe) } object MethodType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(List[String], List[Type], Type)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(List[String], List[Type], Type)] = kernel.matchMethodType(typeOrBounds).map(x => (x.paramNames, x.paramTypes, x.resType)) } object IsPolyType { /** Matches any PolyType and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[PolyType] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[PolyType] = kernel.matchPolyType(tpe) } object PolyType { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(List[String], List[TypeBounds], Type)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(List[String], List[TypeBounds], Type)] = kernel.matchPolyType(typeOrBounds).map(x => (x.paramNames, x.paramBounds, x.resType)) } object IsTypeLambda { /** Matches any TypeLambda and returns it */ - def unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[TypeLambda] = + def unapply(tpe: TypeOrBounds) given (ctx: Context): Option[TypeLambda] = kernel.matchTypeLambda(tpe) } object TypeLambda { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(List[String], List[TypeBounds], Type)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(List[String], List[TypeBounds], Type)] = kernel.matchTypeLambda(typeOrBounds).map(x => (x.paramNames, x.paramBounds, x.resType)) } } implicit class Type_ConstantTypeAPI(self: ConstantType) { - def constant(implicit ctx: Context): Constant = kernel.ConstantType_constant(self) + def constant given (ctx: Context): Constant = kernel.ConstantType_constant(self) } implicit class Type_SymRefAPI(self: SymRef) { - def qualifier(implicit ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.SymRef_qualifier(self) + def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.SymRef_qualifier(self) } implicit class Type_TermRefAPI(self: TermRef) { - def name(implicit ctx: Context): String = kernel.TermRef_name(self) - def qualifier(implicit ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.TermRef_qualifier(self) + def name given (ctx: Context): String = kernel.TermRef_name(self) + def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.TermRef_qualifier(self) } implicit class Type_TypeRefAPI(self: TypeRef) { - def name(implicit ctx: Context): String = kernel.TypeRef_name(self) - def qualifier(implicit ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.TypeRef_qualifier(self) + def name given (ctx: Context): String = kernel.TypeRef_name(self) + def qualifier given (ctx: Context): TypeOrBounds /* Type | NoPrefix */ = kernel.TypeRef_qualifier(self) } implicit class Type_SuperTypeAPI(self: SuperType) { - def thistpe(implicit ctx: Context): Type = kernel.SuperType_thistpe(self) - def supertpe(implicit ctx: Context): Type = kernel.SuperType_supertpe(self) + def thistpe given (ctx: Context): Type = kernel.SuperType_thistpe(self) + def supertpe given (ctx: Context): Type = kernel.SuperType_supertpe(self) } implicit class Type_RefinementAPI(self: Refinement) { - def parent(implicit ctx: Context): Type = kernel.Refinement_parent(self) - def name(implicit ctx: Context): String = kernel.Refinement_name(self) - def info(implicit ctx: Context): TypeOrBounds = kernel.Refinement_info(self) + 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) } implicit class Type_AppliedTypeAPI(self: AppliedType) { - def tycon(implicit ctx: Context): Type = kernel.AppliedType_tycon(self) - def args(implicit ctx: Context): List[TypeOrBounds /* Type | TypeBounds */] = kernel.AppliedType_args(self) + def tycon given (ctx: Context): Type = kernel.AppliedType_tycon(self) + def args given (ctx: Context): List[TypeOrBounds /* Type | TypeBounds */] = kernel.AppliedType_args(self) } implicit class Type_AnnotatedTypeAPI(self: AnnotatedType) { - def underlying(implicit ctx: Context): Type = kernel.AnnotatedType_underlying(self) - def annot(implicit ctx: Context): Term = kernel.AnnotatedType_annot(self) + def underlying given (ctx: Context): Type = kernel.AnnotatedType_underlying(self) + def annot given (ctx: Context): Term = kernel.AnnotatedType_annot(self) } implicit class Type_AndTypeAPI(self: AndType) { - def left(implicit ctx: Context): Type = kernel.AndType_left(self) - def right(implicit ctx: Context): Type = kernel.AndType_right(self) + def left given (ctx: Context): Type = kernel.AndType_left(self) + def right given (ctx: Context): Type = kernel.AndType_right(self) } implicit class Type_OrTypeAPI(self: OrType) { - def left(implicit ctx: Context): Type = kernel.OrType_left(self) - def right(implicit ctx: Context): Type = kernel.OrType_right(self) + def left given (ctx: Context): Type = kernel.OrType_left(self) + def right given (ctx: Context): Type = kernel.OrType_right(self) } implicit class Type_MatchTypeAPI(self: MatchType) { - def bound(implicit ctx: Context): Type = kernel.MatchType_bound(self) - def scrutinee(implicit ctx: Context): Type = kernel.MatchType_scrutinee(self) - def cases(implicit ctx: Context): List[Type] = kernel.MatchType_cases(self) + 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) } implicit class Type_ByNameTypeAPI(self: ByNameType) { - def underlying(implicit ctx: Context): Type = kernel.ByNameType_underlying(self) + def underlying given (ctx: Context): Type = kernel.ByNameType_underlying(self) } implicit class Type_ParamRefAPI(self: ParamRef) { - def binder(implicit ctx: Context): LambdaType[TypeOrBounds] = kernel.ParamRef_binder(self) - def paramNum(implicit ctx: Context): Int = kernel.ParamRef_paramNum(self) + def binder given (ctx: Context): LambdaType[TypeOrBounds] = kernel.ParamRef_binder(self) + def paramNum given (ctx: Context): Int = kernel.ParamRef_paramNum(self) } implicit class Type_ThisTypeAPI(self: ThisType) { - def tref(implicit ctx: Context): Type = kernel.ThisType_tref(self) + def tref given (ctx: Context): Type = kernel.ThisType_tref(self) } implicit class Type_RecursiveThisAPI(self: RecursiveThis) { - def binder(implicit ctx: Context): RecursiveType = kernel.RecursiveThis_binder(self) + def binder given (ctx: Context): RecursiveType = kernel.RecursiveThis_binder(self) } implicit class Type_RecursiveTypeAPI(self: RecursiveType) { - def underlying(implicit ctx: Context): Type = kernel.RecursiveType_underlying(self) + def underlying given (ctx: Context): Type = kernel.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(implicit ctx: Context): List[String] = kernel.MethodType_paramNames(self) - def paramTypes(implicit ctx: Context): List[Type] = kernel.MethodType_paramTypes(self) - def resType(implicit ctx: Context): Type = kernel.MethodType_resType(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) } implicit class Type_PolyTypeAPI(self: PolyType) { - def paramNames(implicit ctx: Context): List[String] = kernel.PolyType_paramNames(self) - def paramBounds(implicit ctx: Context): List[TypeBounds] = kernel.PolyType_paramBounds(self) - def resType(implicit ctx: Context): Type = kernel.PolyType_resType(self) + 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) } implicit class Type_TypeLambdaAPI(self: TypeLambda) { - def paramNames(implicit ctx: Context): List[String] = kernel.TypeLambda_paramNames(self) - def paramBounds(implicit ctx: Context): List[TypeBounds] = kernel.TypeLambda_paramBounds(self) - def resType(implicit ctx: Context): Type = kernel.TypeLambda_resType(self) + 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) } // ----- TypeBounds ----------------------------------------------- object IsTypeBounds { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[TypeBounds] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[TypeBounds] = kernel.matchTypeBounds(typeOrBounds) } object TypeBounds { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Option[(Type, Type)] = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Option[(Type, Type)] = kernel.matchTypeBounds(typeOrBounds).map(x => (x.low, x.hi)) } implicit class TypeBoundsAPI(self: TypeBounds) { - def low(implicit ctx: Context): Type = kernel.TypeBounds_low(self) - def hi(implicit ctx: Context): Type = kernel.TypeBounds_hi(self) + def low given (ctx: Context): Type = kernel.TypeBounds_low(self) + def hi given (ctx: Context): Type = kernel.TypeBounds_hi(self) } // ----- NoPrefix ------------------------------------------------- object NoPrefix { - def unapply(typeOrBounds: TypeOrBounds)(implicit ctx: Context): Boolean = + def unapply(typeOrBounds: TypeOrBounds) given (ctx: Context): Boolean = kernel.matchNoPrefix(typeOrBounds).isDefined }