From 55d93d54bbf44ee2ae73fbc85d1157c6f75e544e Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Sun, 28 Jul 2019 11:21:14 +0200 Subject: [PATCH 1/3] Use given parameter syntax --- .../tools/dotc/tastyreflect/KernelImpl.scala | 850 +++++++++--------- 1 file changed, 425 insertions(+), 425 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala index da6a46f5019c..cb56108b3149 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala @@ -47,16 +47,16 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. // REPORTING // - def error(msg: => String, pos: Position)(implicit ctx: Context): Unit = + def error(msg: => String, pos: Position) given (ctx: Context): Unit = ctx.error(msg, pos) - def error(msg: => String, sourceFile: SourceFile, start: Int, end: Int)(implicit ctx: Context): Unit = + def error(msg: => String, sourceFile: SourceFile, start: Int, end: Int) given (ctx: Context): Unit = ctx.error(msg, util.SourcePosition(sourceFile, util.Spans.Span(start, end))) - def warning(msg: => String, pos: Position)(implicit ctx: Context): Unit = + def warning(msg: => String, pos: Position) given (ctx: Context): Unit = ctx.warning(msg, pos) - def warning(msg: => String, sourceFile: SourceFile, start: Int, end: Int)(implicit ctx: Context): Unit = + def warning(msg: => String, sourceFile: SourceFile, start: Int, end: Int) given (ctx: Context): Unit = ctx.error(msg, util.SourcePosition(sourceFile, util.Spans.Span(start, end))) // @@ -76,7 +76,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. * * 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 = { val ctx2 = ctx.fresh.setNewTyperState().setTyper(new Typer) val tree = new Parser(SourceFile.virtual("tasty-reflect", code))(ctx2).block() @@ -93,359 +93,359 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Tree = tpd.Tree - def Tree_pos(self: Tree)(implicit ctx: Context): Position = self.sourcePos - def Tree_symbol(self: Tree)(implicit ctx: Context): Symbol = self.symbol + def Tree_pos(self: Tree) given (ctx: Context): Position = self.sourcePos + def Tree_symbol(self: Tree) given (ctx: Context): Symbol = self.symbol type PackageClause = tpd.PackageDef - def matchPackageClause(tree: Tree)(implicit ctx: Context): Option[PackageClause] = tree match { + def matchPackageClause(tree: Tree) given (ctx: Context): Option[PackageClause] = tree match { case x: tpd.PackageDef => Some(x) case _ => None } - def PackageClause_pid(self: PackageClause)(implicit ctx: Context): Ref = self.pid - def PackageClause_stats(self: PackageClause)(implicit ctx: Context): List[Tree] = self.stats + def PackageClause_pid(self: PackageClause) given (ctx: Context): Ref = self.pid + def PackageClause_stats(self: PackageClause) given (ctx: Context): List[Tree] = self.stats - def PackageClause_apply(pid: Ref, stats: List[Tree])(implicit ctx: Context): PackageClause = + def PackageClause_apply(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = withDefaultPos(ctx => tpd.PackageDef(pid.asInstanceOf[tpd.RefTree], stats)(ctx)) - 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 = tpd.cpy.PackageDef(original)(pid, stats) type Statement = tpd.Tree - def matchStatement(tree: Tree)(implicit ctx: Context): Option[Statement] = tree match { + def matchStatement(tree: Tree) given (ctx: Context): Option[Statement] = tree match { case tree if tree.isTerm => Some(tree) case _ => matchDefinition(tree) } type Import = tpd.Import - def matchImport(tree: Tree)(implicit ctx: Context): Option[Import] = tree match { + def matchImport(tree: Tree) given (ctx: Context): Option[Import] = tree match { case tree: tpd.Import => Some(tree) case _ => None } def Import_implied(self: Import): Boolean = self.importGiven - def Import_expr(self: Import)(implicit ctx: Context): Tree = self.expr - def Import_selectors(self: Import)(implicit ctx: Context): List[ImportSelector] = self.selectors + def Import_expr(self: Import) given (ctx: Context): Tree = self.expr + def Import_selectors(self: Import) given (ctx: Context): List[ImportSelector] = self.selectors - 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 = withDefaultPos(ctx => tpd.Import(importImplied, expr, selectors)(ctx)) - 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 = tpd.cpy.Import(original)(importImplied, expr, selectors) type Definition = tpd.Tree - def matchDefinition(tree: Tree)(implicit ctx: Context): Option[Definition] = tree match { + def matchDefinition(tree: Tree) given (ctx: Context): Option[Definition] = tree match { case tree: tpd.MemberDef => Some(tree) case tree: PackageDefinition => Some(tree) case _ => None } - def Definition_name(self: Definition)(implicit ctx: Context): String = self match { + def Definition_name(self: Definition) given (ctx: Context): String = self match { case self: tpd.MemberDef => self.name.toString case self: PackageDefinition => self.symbol.name.toString // TODO make PackageDefinition a MemberDef or NameTree } type PackageDef = PackageDefinition - def matchPackageDef(tree: Tree)(implicit ctx: Context): Option[PackageDef] = tree match { + def matchPackageDef(tree: Tree) given (ctx: Context): Option[PackageDef] = tree match { case x: PackageDefinition => Some(x) case _ => None } - def PackageDef_owner(self: PackageDef)(implicit ctx: Context): PackageDef = packageDefFromSym(self.symbol.owner) + def PackageDef_owner(self: PackageDef) given (ctx: Context): PackageDef = packageDefFromSym(self.symbol.owner) - def PackageDef_members(self: PackageDef)(implicit ctx: Context): List[Statement] = { + def PackageDef_members(self: PackageDef) given (ctx: Context): List[Statement] = { if (self.symbol.is(core.Flags.JavaDefined)) Nil // FIXME should also support java packages else self.symbol.info.decls.iterator.map(definitionFromSym).toList } - def PackageDef_symbol(self: PackageDef)(implicit ctx: Context): PackageDefSymbol = self.symbol + def PackageDef_symbol(self: PackageDef) given (ctx: Context): PackageDefSymbol = self.symbol type ClassDef = tpd.TypeDef - def matchClassDef(tree: Tree)(implicit ctx: Context): Option[ClassDef] = tree match { + def matchClassDef(tree: Tree) given (ctx: Context): Option[ClassDef] = tree match { case x: tpd.TypeDef if x.isClassDef => Some(x) case _ => None } - def ClassDef_constructor(self: ClassDef)(implicit ctx: Context): DefDef = ClassDef_rhs(self).constr - def ClassDef_parents(self: ClassDef)(implicit ctx: Context): List[Term | TypeTree] = ClassDef_rhs(self).parents - def ClassDef_derived(self: ClassDef)(implicit ctx: Context): List[TypeTree] = ClassDef_rhs(self).derived.asInstanceOf[List[TypeTree]] - def ClassDef_self(self: ClassDef)(implicit ctx: Context): Option[ValDef] = optional(ClassDef_rhs(self).self) - def ClassDef_body(self: ClassDef)(implicit ctx: Context): List[Statement] = ClassDef_rhs(self).body - def ClassDef_symbol(self: ClassDef)(implicit ctx: Context): ClassDefSymbol = self.symbol.asClass + def ClassDef_constructor(self: ClassDef) given (ctx: Context): DefDef = ClassDef_rhs(self).constr + def ClassDef_parents(self: ClassDef) given (ctx: Context): List[Term | TypeTree] = ClassDef_rhs(self).parents + def ClassDef_derived(self: ClassDef) given (ctx: Context): List[TypeTree] = ClassDef_rhs(self).derived.asInstanceOf[List[TypeTree]] + def ClassDef_self(self: ClassDef) given (ctx: Context): Option[ValDef] = optional(ClassDef_rhs(self).self) + def ClassDef_body(self: ClassDef) given (ctx: Context): List[Statement] = ClassDef_rhs(self).body + def ClassDef_symbol(self: ClassDef) given (ctx: Context): ClassDefSymbol = self.symbol.asClass private def ClassDef_rhs(self: ClassDef) = self.rhs.asInstanceOf[tpd.Template] - def ClassDef_copy(original: ClassDef)(name: String, constr: DefDef, parents: List[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[Term | TypeTree], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement]) given (ctx: Context): ClassDef = { val Trees.TypeDef(_, originalImpl: tpd.Template) = original tpd.cpy.TypeDef(original)(name.toTypeName, tpd.cpy.Template(originalImpl)(constr, parents, derived, selfOpt.getOrElse(tpd.EmptyValDef), body)) } type TypeDef = tpd.TypeDef - def matchTypeDef(tree: Tree)(implicit ctx: Context): Option[TypeDef] = tree match { + def matchTypeDef(tree: Tree) given (ctx: Context): Option[TypeDef] = tree match { case x: tpd.TypeDef if !x.symbol.isClass => Some(x) case _ => None } - def TypeDef_rhs(self: TypeDef)(implicit ctx: Context): TypeTree | TypeBoundsTree = self.rhs - def TypeDef_symbol(self: TypeDef)(implicit ctx: Context): TypeDefSymbol = self.symbol.asType + def TypeDef_rhs(self: TypeDef) given (ctx: Context): TypeTree | TypeBoundsTree = self.rhs + def TypeDef_symbol(self: TypeDef) given (ctx: Context): TypeDefSymbol = self.symbol.asType - def TypeDef_apply(symbol: TypeDefSymbol)(implicit ctx: Context): TypeDef = withDefaultPos(ctx => tpd.TypeDef(symbol)(ctx)) - def TypeDef_copy(original: TypeDef)(name: String, rhs: TypeTree | TypeBoundsTree)(implicit ctx: Context): TypeDef = + def TypeDef_apply(symbol: TypeDefSymbol) given (ctx: Context): TypeDef = withDefaultPos(ctx => tpd.TypeDef(symbol)(ctx)) + def TypeDef_copy(original: TypeDef)(name: String, rhs: TypeTree | TypeBoundsTree) given (ctx: Context): TypeDef = tpd.cpy.TypeDef(original)(name.toTypeName, rhs) type DefDef = tpd.DefDef - def matchDefDef(tree: Tree)(implicit ctx: Context): Option[DefDef] = tree match { + def matchDefDef(tree: Tree) given (ctx: Context): Option[DefDef] = tree match { case x: tpd.DefDef => Some(x) case _ => None } - def DefDef_typeParams(self: DefDef)(implicit ctx: Context): List[TypeDef] = self.tparams - def DefDef_paramss(self: DefDef)(implicit ctx: Context): List[List[ValDef]] = self.vparamss - def DefDef_returnTpt(self: DefDef)(implicit ctx: Context): TypeTree = self.tpt - def DefDef_rhs(self: DefDef)(implicit ctx: Context): Option[Tree] = optional(self.rhs) - def DefDef_symbol(self: DefDef)(implicit ctx: Context): DefDefSymbol = self.symbol.asTerm + def DefDef_typeParams(self: DefDef) given (ctx: Context): List[TypeDef] = self.tparams + def DefDef_paramss(self: DefDef) given (ctx: Context): List[List[ValDef]] = self.vparamss + def DefDef_returnTpt(self: DefDef) given (ctx: Context): TypeTree = self.tpt + def DefDef_rhs(self: DefDef) given (ctx: Context): Option[Tree] = optional(self.rhs) + def DefDef_symbol(self: DefDef) given (ctx: Context): DefDefSymbol = self.symbol.asTerm - def DefDef_apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(implicit ctx: Context): DefDef = + def DefDef_apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term]) given (ctx: Context): DefDef = withDefaultPos(ctx => tpd.polyDefDef(symbol, tparams => vparamss => rhsFn(tparams)(vparamss).getOrElse(tpd.EmptyTree))(ctx)) - 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_copy(original: DefDef)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): DefDef = tpd.cpy.DefDef(original)(name.toTermName, typeParams, paramss, tpt, rhs.getOrElse(tpd.EmptyTree)) type ValDef = tpd.ValDef - def matchValDef(tree: Tree)(implicit ctx: Context): Option[ValDef] = tree match { + def matchValDef(tree: Tree) given (ctx: Context): Option[ValDef] = tree match { case x: tpd.ValDef => Some(x) case _ => None } - def ValDef_tpt(self: ValDef)(implicit ctx: Context): TypeTree = self.tpt - def ValDef_rhs(self: ValDef)(implicit ctx: Context): Option[Tree] = optional(self.rhs) - def ValDef_symbol(self: ValDef)(implicit ctx: Context): ValDefSymbol = self.symbol.asTerm + def ValDef_tpt(self: ValDef) given (ctx: Context): TypeTree = self.tpt + def ValDef_rhs(self: ValDef) given (ctx: Context): Option[Tree] = optional(self.rhs) + def ValDef_symbol(self: ValDef) given (ctx: Context): ValDefSymbol = self.symbol.asTerm - def ValDef_apply(symbol: ValDefSymbol, rhs: Option[Term])(implicit ctx: Context): ValDef = + def ValDef_apply(symbol: ValDefSymbol, rhs: Option[Term]) given (ctx: Context): ValDef = tpd.ValDef(symbol, rhs.getOrElse(tpd.EmptyTree)) - def ValDef_copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term])(implicit ctx: Context): ValDef = + def ValDef_copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): ValDef = tpd.cpy.ValDef(original)(name.toTermName, tpt, rhs.getOrElse(tpd.EmptyTree)) type Term = tpd.Tree - def matchTerm(tree: Tree)(implicit ctx: Context): Option[Term] = tree match { + def matchTerm(tree: Tree) given (ctx: Context): Option[Term] = tree match { case x: tpd.SeqLiteral => Some(tree) case _ if tree.isTerm => Some(tree) case _ => None } - def Term_pos(self: Term)(implicit ctx: Context): Position = self.sourcePos - def Term_tpe(self: Term)(implicit ctx: Context): Type = self.tpe - def Term_underlyingArgument(self: Term)(implicit ctx: Context): Term = self.underlyingArgument - def Term_underlying(self: Term)(implicit ctx: Context): Term = self.underlying + def Term_pos(self: Term) given (ctx: Context): Position = self.sourcePos + def Term_tpe(self: Term) given (ctx: Context): Type = self.tpe + def Term_underlyingArgument(self: Term) given (ctx: Context): Term = self.underlyingArgument + def Term_underlying(self: Term) given (ctx: Context): Term = self.underlying type Ref = tpd.RefTree - def matchRef(tree: Tree)(implicit ctx: Context): Option[Ref] = tree match { + def matchRef(tree: Tree) given (ctx: Context): Option[Ref] = tree match { case x: tpd.RefTree if x.isTerm => Some(x) case _ => None } - def Ref_apply(sym: Symbol)(implicit ctx: Context): Ref = + def Ref_apply(sym: Symbol) given (ctx: Context): Ref = withDefaultPos(ctx => tpd.ref(sym)(ctx).asInstanceOf[tpd.RefTree]) type Ident = tpd.Ident - def matchIdent(x: Term)(implicit ctx: Context): Option[Ident] = x match { + def matchIdent(x: Term) given (ctx: Context): Option[Ident] = x match { case x: tpd.Ident if x.isTerm => Some(x) case _ => None } - def Ident_name(self: Ident)(implicit ctx: Context): String = self.name.show + def Ident_name(self: Ident) given (ctx: Context): String = self.name.show - def Ident_apply(tmref: TermRef)(implicit ctx: Context): Term = + def Ident_apply(tmref: TermRef) given (ctx: Context): Term = withDefaultPos(implicit ctx => tpd.ref(tmref).asInstanceOf[Term]) - def Ident_copy(original: Tree)(name: String)(implicit ctx: Context): Ident = + def Ident_copy(original: Tree)(name: String) given (ctx: Context): Ident = tpd.cpy.Ident(original)(name.toTermName) type Select = tpd.Select - def matchSelect(x: Term)(implicit ctx: Context): Option[Select] = x match { + def matchSelect(x: Term) given (ctx: Context): Option[Select] = x match { case x: tpd.Select if x.isTerm => Some(x) case _ => None } - def Select_qualifier(self: Select)(implicit ctx: Context): Term = self.qualifier - def Select_name(self: Select)(implicit ctx: Context): String = self.name.toString - def Select_signature(self: Select)(implicit ctx: Context): Option[Signature] = + def Select_qualifier(self: Select) given (ctx: Context): Term = self.qualifier + def Select_name(self: Select) given (ctx: Context): String = self.name.toString + def Select_signature(self: Select) given (ctx: Context): Option[Signature] = if (self.symbol.signature == core.Signature.NotAMethod) None else Some(self.symbol.signature) - def Select_apply(qualifier: Term, symbol: Symbol)(implicit ctx: Context): Select = + def Select_apply(qualifier: Term, symbol: Symbol) given (ctx: Context): Select = withDefaultPos(implicit ctx => tpd.Select(qualifier, Types.TermRef(qualifier.tpe, symbol))) - def Select_unique(qualifier: Term, name: String)(implicit ctx: Context): Select = { + def Select_unique(qualifier: Term, name: String) given (ctx: Context): Select = { val denot = qualifier.tpe.member(name.toTermName) assert(!denot.isOverloaded, s"The symbol `$name` is overloaded. The method Select.unique can only be used for non-overloaded symbols.") withDefaultPos(implicit ctx => tpd.Select(qualifier, name.toTermName)) } // 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_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term]) given (ctx: Context): Apply = withDefaultPos(implicit ctx => tpd.applyOverloaded(qualifier, name.toTermName, args, targs, Types.WildcardType).asInstanceOf[Apply]) - def Select_copy(original: Tree)(qualifier: Term, name: String)(implicit ctx: Context): Select = + def Select_copy(original: Tree)(qualifier: Term, name: String) given (ctx: Context): Select = tpd.cpy.Select(original)(qualifier, name.toTermName) type Literal = tpd.Literal - def matchLiteral(x: Term)(implicit ctx: Context): Option[Literal] = x match { + def matchLiteral(x: Term) given (ctx: Context): Option[Literal] = x match { case x: tpd.Literal => Some(x) case _ => None } - def Literal_constant(self: Literal)(implicit ctx: Context): Constant = self.const + def Literal_constant(self: Literal) given (ctx: Context): Constant = self.const - def Literal_apply(constant: Constant)(implicit ctx: Context): Literal = + def Literal_apply(constant: Constant) given (ctx: Context): Literal = withDefaultPos(ctx => tpd.Literal(constant)(ctx)) - def Literal_copy(original: Tree)(constant: Constant)(implicit ctx: Context): Literal = + def Literal_copy(original: Tree)(constant: Constant) given (ctx: Context): Literal = tpd.cpy.Literal(original)(constant) type This = tpd.This - def matchThis(x: Term)(implicit ctx: Context): Option[This] = x match { + def matchThis(x: Term) given (ctx: Context): Option[This] = x match { case x: tpd.This => Some(x) case _ => None } - def This_id(self: This)(implicit ctx: Context): Option[Id] = optional(self.qual) + def This_id(self: This) given (ctx: Context): Option[Id] = optional(self.qual) - def This_apply(cls: ClassDefSymbol)(implicit ctx: Context): This = + def This_apply(cls: ClassDefSymbol) given (ctx: Context): This = withDefaultPos(ctx => tpd.This(cls)(ctx)) - def This_copy(original: Tree)(qual: Option[Id])(implicit ctx: Context): This = + def This_copy(original: Tree)(qual: Option[Id]) given (ctx: Context): This = tpd.cpy.This(original)(qual.getOrElse(untpd.EmptyTypeIdent)) type New = tpd.New - def matchNew(x: Term)(implicit ctx: Context): Option[New] = x match { + def matchNew(x: Term) given (ctx: Context): Option[New] = x match { case x: tpd.New => Some(x) case _ => None } - def New_tpt(self: New)(implicit ctx: Context): TypeTree = self.tpt + def New_tpt(self: New) given (ctx: Context): TypeTree = self.tpt - def New_apply(tpt: TypeTree)(implicit ctx: Context): New = withDefaultPos(ctx => tpd.New(tpt)(ctx)) + def New_apply(tpt: TypeTree) given (ctx: Context): New = withDefaultPos(ctx => tpd.New(tpt)(ctx)) - def New_copy(original: Tree)(tpt: TypeTree)(implicit ctx: Context): New = + def New_copy(original: Tree)(tpt: TypeTree) given (ctx: Context): New = tpd.cpy.New(original)(tpt) type NamedArg = tpd.NamedArg - def matchNamedArg(x: Term)(implicit ctx: Context): Option[NamedArg] = x match { + def matchNamedArg(x: Term) given (ctx: Context): Option[NamedArg] = x match { case x: tpd.NamedArg if x.name.isInstanceOf[core.Names.TermName] => Some(x) // TODO: Now, the name should alwas be a term name case _ => None } - def NamedArg_name(self: NamedArg)(implicit ctx: Context): String = self.name.toString - def NamedArg_value(self: NamedArg)(implicit ctx: Context): Term = self.arg + def NamedArg_name(self: NamedArg) given (ctx: Context): String = self.name.toString + def NamedArg_value(self: NamedArg) given (ctx: Context): Term = self.arg - def NamedArg_apply(name: String, arg: Term)(implicit ctx: Context): NamedArg = + def NamedArg_apply(name: String, arg: Term) given (ctx: Context): NamedArg = withDefaultPos(ctx => tpd.NamedArg(name.toTermName, arg)(ctx)) - def NamedArg_copy(tree: NamedArg)(name: String, arg: Term)(implicit ctx: Context): NamedArg = + def NamedArg_copy(tree: NamedArg)(name: String, arg: Term) given (ctx: Context): NamedArg = tpd.cpy.NamedArg(tree)(name.toTermName, arg) type Apply = tpd.Apply - def matchApply(x: Term)(implicit ctx: Context): Option[Apply] = x match { + def matchApply(x: Term) given (ctx: Context): Option[Apply] = x match { case x: tpd.Apply => Some(x) case _ => None } - def Apply_fun(self: Apply)(implicit ctx: Context): Term = self.fun - def Apply_args(self: Apply)(implicit ctx: Context): List[Term] = self.args + def Apply_fun(self: Apply) given (ctx: Context): Term = self.fun + def Apply_args(self: Apply) given (ctx: Context): List[Term] = self.args - def Apply_apply(fn: Term, args: List[Term])(implicit ctx: Context): Apply = + def Apply_apply(fn: Term, args: List[Term]) given (ctx: Context): Apply = withDefaultPos(ctx => tpd.Apply(fn, args)(ctx)) - def Apply_copy(original: Tree)(fun: Term, args: List[Term])(implicit ctx: Context): Apply = + def Apply_copy(original: Tree)(fun: Term, args: List[Term]) given (ctx: Context): Apply = tpd.cpy.Apply(original)(fun, args) type TypeApply = tpd.TypeApply - def matchTypeApply(x: Term)(implicit ctx: Context): Option[TypeApply] = x match { + def matchTypeApply(x: Term) given (ctx: Context): Option[TypeApply] = x match { case x: tpd.TypeApply => Some(x) case _ => None } - def TypeApply_fun(self: TypeApply)(implicit ctx: Context): Term = self.fun - def TypeApply_args(self: TypeApply)(implicit ctx: Context): List[TypeTree] = self.args + def TypeApply_fun(self: TypeApply) given (ctx: Context): Term = self.fun + def TypeApply_args(self: TypeApply) given (ctx: Context): List[TypeTree] = self.args - def TypeApply_apply(fn: Term, args: List[TypeTree])(implicit ctx: Context): TypeApply = + def TypeApply_apply(fn: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = withDefaultPos(ctx => tpd.TypeApply(fn, args)(ctx)) - def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree])(implicit ctx: Context): TypeApply = + def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = tpd.cpy.TypeApply(original)(fun, args) type Super = tpd.Super - def matchSuper(x: Term)(implicit ctx: Context): Option[Super] = x match { + def matchSuper(x: Term) given (ctx: Context): Option[Super] = x match { case x: tpd.Super => Some(x) case _ => None } - def Super_qualifier(self: Super)(implicit ctx: Context): Term = self.qual - def Super_id(self: Super)(implicit ctx: Context): Option[Id] = optional(self.mix) + def Super_qualifier(self: Super) given (ctx: Context): Term = self.qual + def Super_id(self: Super) given (ctx: Context): Option[Id] = optional(self.mix) - def Super_apply(qual: Term, mix: Option[Id])(implicit ctx: Context): Super = + def Super_apply(qual: Term, mix: Option[Id]) given (ctx: Context): Super = withDefaultPos(ctx => tpd.Super(qual, mix.getOrElse(untpd.EmptyTypeIdent), false, NoSymbol)(ctx)) - def Super_copy(original: Tree)(qual: Term, mix: Option[Id])(implicit ctx: Context): Super = + def Super_copy(original: Tree)(qual: Term, mix: Option[Id]) given (ctx: Context): Super = tpd.cpy.Super(original)(qual, mix.getOrElse(untpd.EmptyTypeIdent)) type Typed = tpd.Typed - def matchTyped(x: Term)(implicit ctx: Context): Option[Typed] = x match { + def matchTyped(x: Term) given (ctx: Context): Option[Typed] = x match { case x: tpd.Typed => Some(x) case _ => None } - def Typed_expr(self: Typed)(implicit ctx: Context): Term = self.expr - def Typed_tpt(self: Typed)(implicit ctx: Context): TypeTree = self.tpt + def Typed_expr(self: Typed) given (ctx: Context): Term = self.expr + def Typed_tpt(self: Typed) given (ctx: Context): TypeTree = self.tpt - def Typed_apply(expr: Term, tpt: TypeTree)(implicit ctx: Context): Typed = + def Typed_apply(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = withDefaultPos(ctx => tpd.Typed(expr, tpt)(ctx)) - def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree)(implicit ctx: Context): Typed = + def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = tpd.cpy.Typed(original)(expr, tpt) type Assign = tpd.Assign - def matchAssign(x: Term)(implicit ctx: Context): Option[Assign] = x match { + def matchAssign(x: Term) given (ctx: Context): Option[Assign] = x match { case x: tpd.Assign => Some(x) case _ => None } - def Assign_lhs(self: Assign)(implicit ctx: Context): Term = self.lhs - def Assign_rhs(self: Assign)(implicit ctx: Context): Term = self.rhs + def Assign_lhs(self: Assign) given (ctx: Context): Term = self.lhs + def Assign_rhs(self: Assign) given (ctx: Context): Term = self.rhs - def Assign_apply(lhs: Term, rhs: Term)(implicit ctx: Context): Assign = + def Assign_apply(lhs: Term, rhs: Term) given (ctx: Context): Assign = withDefaultPos(ctx => tpd.Assign(lhs, rhs)(ctx)) - def Assign_copy(original: Tree)(lhs: Term, rhs: Term)(implicit ctx: Context): Assign = + def Assign_copy(original: Tree)(lhs: Term, rhs: Term) given (ctx: Context): Assign = tpd.cpy.Assign(original)(lhs, rhs) type Block = tpd.Block - def matchBlock(x: Term)(implicit ctx: Context): Option[Block] = normalizedLoops(x) match { + def matchBlock(x: Term) given (ctx: Context): Option[Block] = normalizedLoops(x) match { case x: tpd.Block => Some(x) case _ => None } @@ -454,7 +454,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. * i) Put `while` and `doWhile` loops in their own blocks: `{ def while$() = ...; while$() }` * ii) Put closures in their own blocks: `{ def anon$() = ...; closure(anon$, ...) }` */ - private def normalizedLoops(tree: tpd.Tree)(implicit ctx: Context): tpd.Tree = tree match { + private def normalizedLoops(tree: tpd.Tree) given (ctx: Context): tpd.Tree = tree match { case block: tpd.Block if block.stats.size > 1 => def normalizeInnerLoops(stats: List[tpd.Tree]): List[tpd.Tree] = stats match { case (x: tpd.DefDef) :: y :: xs if needsNormalization(y) => @@ -474,152 +474,152 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } /** If it is the second statement of a closure. See: `normalizedLoops` */ - private def needsNormalization(tree: tpd.Tree)(implicit ctx: Context): Boolean = tree match { + private def needsNormalization(tree: tpd.Tree) given (ctx: Context): Boolean = tree match { case _: tpd.Closure => true case _ => false } - def Block_statements(self: Block)(implicit ctx: Context): List[Statement] = self.stats - def Block_expr(self: Block)(implicit ctx: Context): Term = self.expr + def Block_statements(self: Block) given (ctx: Context): List[Statement] = self.stats + def Block_expr(self: Block) given (ctx: Context): Term = self.expr - def Block_apply(stats: List[Statement], expr: Term)(implicit ctx: Context): Block = + def Block_apply(stats: List[Statement], expr: Term) given (ctx: Context): Block = withDefaultPos(ctx => tpd.Block(stats, expr)(ctx)) - def Block_copy(original: Tree)(stats: List[Statement], expr: Term)(implicit ctx: Context): Block = + def Block_copy(original: Tree)(stats: List[Statement], expr: Term) given (ctx: Context): Block = tpd.cpy.Block(original)(stats, expr) type Inlined = tpd.Inlined - def matchInlined(x: Term)(implicit ctx: Context): Option[Inlined] = x match { + def matchInlined(x: Term) given (ctx: Context): Option[Inlined] = x match { case x: tpd.Inlined => Some(x) case _ => None } - def Inlined_call(self: Inlined)(implicit ctx: Context): Option[Term | TypeTree] = optional(self.call) - def Inlined_bindings(self: Inlined)(implicit ctx: Context): List[Definition] = self.bindings - def Inlined_body(self: Inlined)(implicit ctx: Context): Term = self.expansion + def Inlined_call(self: Inlined) given (ctx: Context): Option[Term | TypeTree] = optional(self.call) + def Inlined_bindings(self: Inlined) given (ctx: Context): List[Definition] = self.bindings + def Inlined_body(self: Inlined) given (ctx: Context): Term = self.expansion - def Inlined_apply(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined = + def Inlined_apply(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = withDefaultPos(ctx => tpd.Inlined(call.getOrElse(tpd.EmptyTree), bindings.map { case b: tpd.MemberDef => b }, expansion)(ctx)) - def Inlined_copy(original: Tree)(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term)(implicit ctx: Context): Inlined = + def Inlined_copy(original: Tree)(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = tpd.cpy.Inlined(original)(call.getOrElse(tpd.EmptyTree), bindings.asInstanceOf[List[tpd.MemberDef]], expansion) type Closure = tpd.Closure - def matchClosure(x: Term)(implicit ctx: Context): Option[Closure] = x match { + def matchClosure(x: Term) given (ctx: Context): Option[Closure] = x match { case x: tpd.Closure => Some(x) case _ => None } - def Closure_meth(self: Closure)(implicit ctx: Context): Term = self.meth - def Closure_tpeOpt(self: Closure)(implicit ctx: Context): Option[Type] = optional(self.tpt).map(_.tpe) + def Closure_meth(self: Closure) given (ctx: Context): Term = self.meth + def Closure_tpeOpt(self: Closure) given (ctx: Context): Option[Type] = optional(self.tpt).map(_.tpe) - def Closure_apply(meth: Term, tpe: Option[Type])(implicit ctx: Context): Closure = + def Closure_apply(meth: Term, tpe: Option[Type]) given (ctx: Context): Closure = withDefaultPos(ctx => tpd.Closure(Nil, meth, tpe.map(tpd.TypeTree(_)).getOrElse(tpd.EmptyTree))(ctx)) - def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type])(implicit ctx: Context): Closure = + def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type]) given (ctx: Context): Closure = tpd.cpy.Closure(original)(Nil, meth, tpe.map(tpd.TypeTree(_)).getOrElse(tpd.EmptyTree)) type If = tpd.If - def matchIf(x: Term)(implicit ctx: Context): Option[If] = x match { + def matchIf(x: Term) given (ctx: Context): Option[If] = x match { case x: tpd.If => Some(x) case _ => None } - def If_cond(self: If)(implicit ctx: Context): Term = self.cond - def If_thenp(self: If)(implicit ctx: Context): Term = self.thenp - def If_elsep(self: If)(implicit ctx: Context): Term = self.elsep + def If_cond(self: If) given (ctx: Context): Term = self.cond + def If_thenp(self: If) given (ctx: Context): Term = self.thenp + def If_elsep(self: If) given (ctx: Context): Term = self.elsep - def If_apply(cond: Term, thenp: Term, elsep: Term)(implicit ctx: Context): If = + def If_apply(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = withDefaultPos(ctx => tpd.If(cond, thenp, elsep)(ctx)) - def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(implicit ctx: Context): If = + def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = tpd.cpy.If(original)(cond, thenp, elsep) type Match = tpd.Match - def matchMatch(x: Term)(implicit ctx: Context): Option[Match] = x match { + def matchMatch(x: Term) given (ctx: Context): Option[Match] = x match { case x: tpd.Match if !x.selector.isEmpty => Some(x) case _ => None } - def Match_scrutinee(self: Match)(implicit ctx: Context): Term = self.selector - def Match_cases(self: Match)(implicit ctx: Context): List[CaseDef] = self.cases + def Match_scrutinee(self: Match) given (ctx: Context): Term = self.selector + def Match_cases(self: Match) given (ctx: Context): List[CaseDef] = self.cases - def Match_apply(selector: Term, cases: List[CaseDef])(implicit ctx: Context): Match = + def Match_apply(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = withDefaultPos(ctx => tpd.Match(selector, cases)(ctx)) - def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef])(implicit ctx: Context): Match = + def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = tpd.cpy.Match(original)(selector, cases) type ImpliedMatch = tpd.Match - def matchImplicitMatch(x: Term)(implicit ctx: Context): Option[Match] = x match { + def matchImplicitMatch(x: Term) given (ctx: Context): Option[Match] = x match { case x: tpd.Match if x.selector.isEmpty => Some(x) case _ => None } - def ImplicitMatch_cases(self: Match)(implicit ctx: Context): List[CaseDef] = self.cases + def ImplicitMatch_cases(self: Match) given (ctx: Context): List[CaseDef] = self.cases - def ImplicitMatch_apply(cases: List[CaseDef])(implicit ctx: Context): ImpliedMatch = + def ImplicitMatch_apply(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = withDefaultPos(ctx => tpd.Match(tpd.EmptyTree, cases)(ctx)) - def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef])(implicit ctx: Context): ImpliedMatch = + def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = tpd.cpy.Match(original)(tpd.EmptyTree, cases) type Try = tpd.Try - def matchTry(x: Term)(implicit ctx: Context): Option[Try] = x match { + def matchTry(x: Term) given (ctx: Context): Option[Try] = x match { case x: tpd.Try => Some(x) case _ => None } - def Try_body(self: Try)(implicit ctx: Context): Term = self.expr - def Try_cases(self: Try)(implicit ctx: Context): List[CaseDef] = self.cases - def Try_finalizer(self: Try)(implicit ctx: Context): Option[Term] = optional(self.finalizer) + def Try_body(self: Try) given (ctx: Context): Term = self.expr + def Try_cases(self: Try) given (ctx: Context): List[CaseDef] = self.cases + def Try_finalizer(self: Try) given (ctx: Context): Option[Term] = optional(self.finalizer) - def Try_apply(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 = withDefaultPos(ctx => tpd.Try(expr, cases, finalizer.getOrElse(tpd.EmptyTree))(ctx)) - def Try_copy(original: Tree)(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]) given (ctx: Context): Try = tpd.cpy.Try(original)(expr, cases, finalizer.getOrElse(tpd.EmptyTree)) type Return = tpd.Return - def matchReturn(x: Term)(implicit ctx: Context): Option[Return] = x match { + def matchReturn(x: Term) given (ctx: Context): Option[Return] = x match { case x: tpd.Return => Some(x) case _ => None } - def Return_expr(self: Return)(implicit ctx: Context): Term = self.expr + def Return_expr(self: Return) given (ctx: Context): Term = self.expr - def Return_apply(expr: Term)(implicit ctx: Context): Return = + def Return_apply(expr: Term) given (ctx: Context): Return = withDefaultPos(ctx => tpd.Return(expr, ctx.owner)(ctx)) - def Return_copy(original: Tree)(expr: Term)(implicit ctx: Context): Return = + def Return_copy(original: Tree)(expr: Term) given (ctx: Context): Return = tpd.cpy.Return(original)(expr, tpd.ref(ctx.owner)) type Repeated = tpd.SeqLiteral - def matchRepeated(x: Term)(implicit ctx: Context): Option[Repeated] = x match { + def matchRepeated(x: Term) given (ctx: Context): Option[Repeated] = x match { case x: tpd.SeqLiteral => Some(x) case _ => None } - def Repeated_elems(self: Repeated)(implicit ctx: Context): List[Term] = self.elems - def Repeated_elemtpt(self: Repeated)(implicit ctx: Context): TypeTree = self.elemtpt + def Repeated_elems(self: Repeated) given (ctx: Context): List[Term] = self.elems + def Repeated_elemtpt(self: Repeated) given (ctx: Context): TypeTree = self.elemtpt - def Repeated_apply(elems: List[Term], elemtpt: TypeTree)(implicit ctx: Context): Repeated = + def Repeated_apply(elems: List[Term], elemtpt: TypeTree) given (ctx: Context): Repeated = withDefaultPos(ctx => tpd.SeqLiteral(elems, elemtpt)(ctx)) - def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree)(implicit ctx: Context): Repeated = + def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree) given (ctx: Context): Repeated = tpd.cpy.SeqLiteral(original)(elems, elemtpt) type SelectOuter = tpd.Select - def matchSelectOuter(x: Term)(implicit ctx: Context): Option[SelectOuter] = x match { + def matchSelectOuter(x: Term) given (ctx: Context): Option[SelectOuter] = x match { case x: tpd.Select => x.name match { case NameKinds.OuterSelectName(_, _) => Some(x) @@ -628,237 +628,237 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def SelectOuter_qualifier(self: SelectOuter)(implicit ctx: Context): Term = self.qualifier - def SelectOuter_level(self: SelectOuter)(implicit ctx: Context): Int = { + def SelectOuter_qualifier(self: SelectOuter) given (ctx: Context): Term = self.qualifier + def SelectOuter_level(self: SelectOuter) given (ctx: Context): Int = { val NameKinds.OuterSelectName(_, levels) = self.name levels } - def SelectOuter_tpe(self: SelectOuter)(implicit ctx: Context): Type = self.tpe.stripTypeVar + def SelectOuter_tpe(self: SelectOuter) given (ctx: Context): Type = self.tpe.stripTypeVar - def SelectOuter_apply(qualifier: Term, name: String, levels: Int)(implicit ctx: Context): SelectOuter = + def SelectOuter_apply(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = withDefaultPos(ctx => tpd.Select(qualifier, NameKinds.OuterSelectName(name.toTermName, levels))(ctx)) - def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int)(implicit ctx: Context): SelectOuter = + def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = tpd.cpy.Select(original)(qualifier, NameKinds.OuterSelectName(name.toTermName, levels)) type While = tpd.WhileDo - def matchWhile(x: Term)(implicit ctx: Context): Option[While] = x match { + def matchWhile(x: Term) given (ctx: Context): Option[While] = x match { case x: tpd.WhileDo => Some(x) case _ => None } - def While_cond(self: While)(implicit ctx: Context): Term = self.cond - def While_body(self: While)(implicit ctx: Context): Term = self.body + def While_cond(self: While) given (ctx: Context): Term = self.cond + def While_body(self: While) given (ctx: Context): Term = self.body - def While_apply(cond: Term, body: Term)(implicit ctx: Context): While = + def While_apply(cond: Term, body: Term) given (ctx: Context): While = withDefaultPos(ctx => tpd.WhileDo(cond, body)(ctx)) - def While_copy(original: Tree)(cond: Term, body: Term)(implicit ctx: Context): While = + def While_copy(original: Tree)(cond: Term, body: Term) given (ctx: Context): While = tpd.cpy.WhileDo(original)(cond, body) type TypeTree = tpd.Tree - def matchTypeTree(x: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[TypeTree] = x match { + def matchTypeTree(x: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeTree] = x match { case x: tpd.TypeBoundsTree => None case _ => if (x.isType) Some(x) else None } - def TypeTree_pos(self: TypeTree)(implicit ctx: Context): Position = self.sourcePos - def TypeTree_symbol(self: TypeTree)(implicit ctx: Context): Symbol = self.symbol - def TypeTree_tpe(self: TypeTree)(implicit ctx: Context): Type = self.tpe.stripTypeVar + def TypeTree_pos(self: TypeTree) given (ctx: Context): Position = self.sourcePos + def TypeTree_symbol(self: TypeTree) given (ctx: Context): Symbol = self.symbol + def TypeTree_tpe(self: TypeTree) given (ctx: Context): Type = self.tpe.stripTypeVar type Inferred = tpd.TypeTree - def matchInferred(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[Inferred] = tpt match { + def matchInferred(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Inferred] = tpt match { case tpt: tpd.TypeTree if !tpt.tpe.isInstanceOf[Types.TypeBounds] => Some(tpt) case _ => None } - def Inferred_apply(tpe: Type)(implicit ctx: Context): Inferred = withDefaultPos(ctx => tpd.TypeTree(tpe)(ctx)) + def Inferred_apply(tpe: Type) given (ctx: Context): Inferred = withDefaultPos(ctx => tpd.TypeTree(tpe)(ctx)) type TypeIdent = tpd.Ident - def matchTypeIdent(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[TypeIdent] = tpt match { + def matchTypeIdent(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeIdent] = tpt match { case tpt: tpd.Ident if tpt.isType => Some(tpt) case _ => None } - def TypeIdent_name(self: TypeIdent)(implicit ctx: Context): String = self.name.toString + def TypeIdent_name(self: TypeIdent) given (ctx: Context): String = self.name.toString - def TypeIdent_copy(original: TypeIdent)(name: String)(implicit ctx: Context): TypeIdent = + def TypeIdent_copy(original: TypeIdent)(name: String) given (ctx: Context): TypeIdent = tpd.cpy.Ident(original)(name.toTypeName) type TypeSelect = tpd.Select - def matchTypeSelect(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[TypeSelect] = tpt match { + def matchTypeSelect(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeSelect] = tpt match { case tpt: tpd.Select if tpt.isType && tpt.qualifier.isTerm => Some(tpt) case _ => None } - def TypeSelect_qualifier(self: TypeSelect)(implicit ctx: Context): Term = self.qualifier - def TypeSelect_name(self: TypeSelect)(implicit ctx: Context): String = self.name.toString + def TypeSelect_qualifier(self: TypeSelect) given (ctx: Context): Term = self.qualifier + def TypeSelect_name(self: TypeSelect) given (ctx: Context): String = self.name.toString - def TypeSelect_apply(qualifier: Term, name: String)(implicit ctx: Context): TypeSelect = + def TypeSelect_apply(qualifier: Term, name: String) given (ctx: Context): TypeSelect = withDefaultPos(ctx => tpd.Select(qualifier, name.toTypeName)(ctx)) - def TypeSelect_copy(original: TypeSelect)(qualifier: Term, name: String)(implicit ctx: Context): TypeSelect = + def TypeSelect_copy(original: TypeSelect)(qualifier: Term, name: String) given (ctx: Context): TypeSelect = tpd.cpy.Select(original)(qualifier, name.toTypeName) type Projection = tpd.Select - def matchProjection(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[Projection] = tpt match { + def matchProjection(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Projection] = tpt match { case tpt: tpd.Select if tpt.isType && tpt.qualifier.isType => Some(tpt) case _ => None } - def Projection_qualifier(self: Projection)(implicit ctx: Context): TypeTree = self.qualifier - def Projection_name(self: Projection)(implicit ctx: Context): String = self.name.toString + def Projection_qualifier(self: Projection) given (ctx: Context): TypeTree = self.qualifier + def Projection_name(self: Projection) given (ctx: Context): String = self.name.toString - 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 = tpd.cpy.Select(original)(qualifier, name.toTypeName) type Singleton = tpd.SingletonTypeTree - def matchSingleton(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[Singleton] = tpt match { + def matchSingleton(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Singleton] = tpt match { case tpt: tpd.SingletonTypeTree => Some(tpt) case _ => None } - def Singleton_ref(self: Singleton)(implicit ctx: Context): Term = self.ref + def Singleton_ref(self: Singleton) given (ctx: Context): Term = self.ref - def Singleton_apply(ref: Term)(implicit ctx: Context): Singleton = + def Singleton_apply(ref: Term) given (ctx: Context): Singleton = withDefaultPos(ctx => tpd.SingletonTypeTree(ref)(ctx)) - def Singleton_copy(original: Singleton)(ref: Term)(implicit ctx: Context): Singleton = + def Singleton_copy(original: Singleton)(ref: Term) given (ctx: Context): Singleton = tpd.cpy.SingletonTypeTree(original)(ref) type Refined = tpd.RefinedTypeTree - def matchRefined(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[Refined] = tpt match { + def matchRefined(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Refined] = tpt match { case tpt: tpd.RefinedTypeTree => Some(tpt) case _ => None } - def Refined_tpt(self: Refined)(implicit ctx: Context): TypeTree = self.tpt - def Refined_refinements(self: Refined)(implicit ctx: Context): List[Definition] = self.refinements + def Refined_tpt(self: Refined) given (ctx: Context): TypeTree = self.tpt + def Refined_refinements(self: Refined) given (ctx: Context): List[Definition] = self.refinements - 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 = tpd.cpy.RefinedTypeTree(original)(tpt, refinements) type Applied = tpd.AppliedTypeTree - def matchApplied(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[Applied] = tpt match { + def matchApplied(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Applied] = tpt match { case tpt: tpd.AppliedTypeTree => Some(tpt) case _ => None } - def Applied_tpt(self: Applied)(implicit ctx: Context): TypeTree = self.tpt - def Applied_args(self: Applied)(implicit ctx: Context): List[TypeTree | TypeBoundsTree] = self.args + def Applied_tpt(self: Applied) given (ctx: Context): TypeTree = self.tpt + def Applied_args(self: Applied) given (ctx: Context): List[TypeTree | TypeBoundsTree] = self.args - def Applied_apply(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree])(implicit ctx: Context): Applied = + def Applied_apply(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree]) given (ctx: Context): Applied = withDefaultPos(ctx => tpd.AppliedTypeTree(tpt, args)(ctx)) - def Applied_copy(original: Applied)(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree])(implicit ctx: Context): Applied = + def Applied_copy(original: Applied)(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree]) given (ctx: Context): Applied = tpd.cpy.AppliedTypeTree(original)(tpt, args) type Annotated = tpd.Annotated - def matchAnnotated(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[Annotated] = tpt match { + def matchAnnotated(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Annotated] = tpt match { case tpt: tpd.Annotated => Some(tpt) case _ => None } - def Annotated_arg(self: Annotated)(implicit ctx: Context): TypeTree = self.arg - def Annotated_annotation(self: Annotated)(implicit ctx: Context): Term = self.annot + def Annotated_arg(self: Annotated) given (ctx: Context): TypeTree = self.arg + def Annotated_annotation(self: Annotated) given (ctx: Context): Term = self.annot - def Annotated_apply(arg: TypeTree, annotation: Term)(implicit ctx: Context): Annotated = + def Annotated_apply(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = withDefaultPos(ctx => tpd.Annotated(arg, annotation)(ctx)) - def Annotated_copy(original: Annotated)(arg: TypeTree, annotation: Term)(implicit ctx: Context): Annotated = + def Annotated_copy(original: Annotated)(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = tpd.cpy.Annotated(original)(arg, annotation) type MatchTypeTree = tpd.MatchTypeTree - def matchMatchTypeTree(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[MatchTypeTree] = tpt match { + def matchMatchTypeTree(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[MatchTypeTree] = tpt match { case tpt: tpd.MatchTypeTree => Some(tpt) case _ => None } - def MatchTypeTree_bound(self: MatchTypeTree)(implicit ctx: Context): Option[TypeTree] = if (self.bound == tpd.EmptyTree) None else Some(self.bound) - def MatchTypeTree_selector(self: MatchTypeTree)(implicit ctx: Context): TypeTree = self.selector - def MatchTypeTree_cases(self: MatchTypeTree)(implicit ctx: Context): List[CaseDef] = self.cases + def MatchTypeTree_bound(self: MatchTypeTree) given (ctx: Context): Option[TypeTree] = if (self.bound == tpd.EmptyTree) None else Some(self.bound) + def MatchTypeTree_selector(self: MatchTypeTree) given (ctx: Context): TypeTree = self.selector + def MatchTypeTree_cases(self: MatchTypeTree) given (ctx: Context): List[CaseDef] = self.cases - def MatchTypeTree_apply(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 = withDefaultPos(ctx => tpd.MatchTypeTree(bound.getOrElse(tpd.EmptyTree), selector, cases)(ctx)) - def MatchTypeTree_copy(original: MatchTypeTree)(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]) given (ctx: Context): MatchTypeTree = tpd.cpy.MatchTypeTree(original)(bound.getOrElse(tpd.EmptyTree), selector, cases) type ByName = tpd.ByNameTypeTree - def matchByName(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[ByName] = tpt match { + def matchByName(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[ByName] = tpt match { case tpt: tpd.ByNameTypeTree => Some(tpt) case _ => None } - def ByName_result(self: ByName)(implicit ctx: Context): TypeTree = self.result + def ByName_result(self: ByName) given (ctx: Context): TypeTree = self.result - def ByName_apply(result: TypeTree)(implicit ctx: Context): ByName = + def ByName_apply(result: TypeTree) given (ctx: Context): ByName = withDefaultPos(ctx => tpd.ByNameTypeTree(result)(ctx)) - def ByName_copy(original: ByName)(result: TypeTree)(implicit ctx: Context): ByName = + def ByName_copy(original: ByName)(result: TypeTree) given (ctx: Context): ByName = tpd.cpy.ByNameTypeTree(original)(result) type LambdaTypeTree = tpd.LambdaTypeTree - def matchLambdaTypeTree(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[LambdaTypeTree] = tpt match { + def matchLambdaTypeTree(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[LambdaTypeTree] = tpt match { case tpt: tpd.LambdaTypeTree => Some(tpt) case _ => None } - def Lambdatparams(self: LambdaTypeTree)(implicit ctx: Context): List[TypeDef] = self.tparams - def Lambdabody(self: LambdaTypeTree)(implicit ctx: Context): TypeTree | TypeBoundsTree = self.body + def Lambdatparams(self: LambdaTypeTree) given (ctx: Context): List[TypeDef] = self.tparams + def Lambdabody(self: LambdaTypeTree) given (ctx: Context): TypeTree | TypeBoundsTree = self.body - def Lambdaapply(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree)(implicit ctx: Context): LambdaTypeTree = + def Lambdaapply(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree) given (ctx: Context): LambdaTypeTree = withDefaultPos(ctx => tpd.LambdaTypeTree(tparams, body)(ctx)) - def Lambdacopy(original: LambdaTypeTree)(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree)(implicit ctx: Context): LambdaTypeTree = + def Lambdacopy(original: LambdaTypeTree)(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree) given (ctx: Context): LambdaTypeTree = tpd.cpy.LambdaTypeTree(original)(tparams, body) type TypeBind = tpd.Bind - def matchTypeBind(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[TypeBind] = tpt match { + def matchTypeBind(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeBind] = tpt match { case tpt: tpd.Bind if tpt.name.isTypeName => Some(tpt) case _ => None } - def TypeBind_name(self: TypeBind)(implicit ctx: Context): String = self.name.toString - def TypeBind_body(self: TypeBind)(implicit ctx: Context): TypeTree | TypeBoundsTree = self.body + def TypeBind_name(self: TypeBind) given (ctx: Context): String = self.name.toString + def TypeBind_body(self: TypeBind) given (ctx: Context): TypeTree | TypeBoundsTree = self.body - def TypeBind_copy(original: TypeBind)(name: String, tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): TypeBind = + def TypeBind_copy(original: TypeBind)(name: String, tpt: TypeTree | TypeBoundsTree) given (ctx: Context): TypeBind = tpd.cpy.Bind(original)(name.toTypeName, tpt) type TypeBlock = tpd.Block - def matchTypeBlock(tpt: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[TypeBlock] = tpt match { + def matchTypeBlock(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeBlock] = tpt match { case tpt: tpd.Block => Some(tpt) case _ => None } - def TypeBlock_aliases(self: TypeBlock)(implicit ctx: Context): List[TypeDef] = self.stats.map { case alias: TypeDef => alias } - def TypeBlock_tpt(self: TypeBlock)(implicit ctx: Context): TypeTree = self.expr + def TypeBlock_aliases(self: TypeBlock) given (ctx: Context): List[TypeDef] = self.stats.map { case alias: TypeDef => alias } + def TypeBlock_tpt(self: TypeBlock) given (ctx: Context): TypeTree = self.expr - def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeBlock = + def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = withDefaultPos(ctx => tpd.Block(aliases, tpt)(ctx)) - def TypeBlock_copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree)(implicit ctx: Context): TypeBlock = + def TypeBlock_copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = tpd.cpy.Block(original)(aliases, tpt) type TypeBoundsTree = tpd.TypeBoundsTree - def matchTypeBoundsTree(x: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[TypeBoundsTree] = x match { + def matchTypeBoundsTree(x: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeBoundsTree] = x match { case x: tpd.TypeBoundsTree => Some(x) case x @ Trees.TypeTree() => // TODO only enums generate this kind of type bounds. Is this possible without enums? If not generate tpd.TypeBoundsTree for enums instead @@ -870,50 +870,50 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def TypeBoundsTree_tpe(self: TypeBoundsTree)(implicit ctx: Context): TypeBounds = self.tpe.asInstanceOf[Types.TypeBounds] - def TypeBoundsTree_low(self: TypeBoundsTree)(implicit ctx: Context): TypeTree = self.lo - def TypeBoundsTree_hi(self: TypeBoundsTree)(implicit ctx: Context): TypeTree = self.hi + def TypeBoundsTree_tpe(self: TypeBoundsTree) given (ctx: Context): TypeBounds = self.tpe.asInstanceOf[Types.TypeBounds] + def TypeBoundsTree_low(self: TypeBoundsTree) given (ctx: Context): TypeTree = self.lo + def TypeBoundsTree_hi(self: TypeBoundsTree) given (ctx: Context): TypeTree = self.hi type WildcardTypeTree = tpd.Ident - def matchWildcardTypeTree(x: TypeTree | TypeBoundsTree)(implicit ctx: Context): Option[WildcardTypeTree] = x match { + def matchWildcardTypeTree(x: TypeTree | TypeBoundsTree) given (ctx: Context): Option[WildcardTypeTree] = x match { case x @ Trees.Ident(nme.WILDCARD) => Some(x) case _ => None } - def WildcardTypeTree_tpe(self: WildcardTypeTree)(implicit ctx: Context): TypeOrBounds = self.tpe.stripTypeVar + def WildcardTypeTree_tpe(self: WildcardTypeTree) given (ctx: Context): TypeOrBounds = self.tpe.stripTypeVar type CaseDef = tpd.CaseDef - def matchCaseDef(tree: Tree)(implicit ctx: Context): Option[CaseDef] = tree match { + def matchCaseDef(tree: Tree) given (ctx: Context): Option[CaseDef] = tree match { case tree: tpd.CaseDef if tree.body.isTerm => Some(tree) case _ => None } - def CaseDef_pattern(self: CaseDef)(implicit ctx: Context): Pattern = self.pat - def CaseDef_guard(self: CaseDef)(implicit ctx: Context): Option[Term] = optional(self.guard) - def CaseDef_rhs(self: CaseDef)(implicit ctx: Context): Term = self.body + def CaseDef_pattern(self: CaseDef) given (ctx: Context): Pattern = self.pat + def CaseDef_guard(self: CaseDef) given (ctx: Context): Option[Term] = optional(self.guard) + def CaseDef_rhs(self: CaseDef) given (ctx: Context): Term = self.body - def CaseDef_module_apply(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 = tpd.CaseDef(pattern, guard.getOrElse(tpd.EmptyTree), body) - def CaseDef_module_copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], body: Term)(implicit ctx: Context): CaseDef = + def CaseDef_module_copy(original: CaseDef)(pattern: Pattern, guard: Option[Term], body: Term) given (ctx: Context): CaseDef = tpd.cpy.CaseDef(original)(pattern, guard.getOrElse(tpd.EmptyTree), body) type TypeCaseDef = tpd.CaseDef - def matchTypeCaseDef(tree: Tree)(implicit ctx: Context): Option[TypeCaseDef] = tree match { + def matchTypeCaseDef(tree: Tree) given (ctx: Context): Option[TypeCaseDef] = tree match { case tree: tpd.CaseDef if tree.body.isType => Some(tree) case _ => None } - def TypeCaseDef_pattern(self: TypeCaseDef)(implicit ctx: Context): TypeTree = self.pat - def TypeCaseDef_rhs(self: TypeCaseDef)(implicit ctx: Context): TypeTree = self.body + def TypeCaseDef_pattern(self: TypeCaseDef) given (ctx: Context): TypeTree = self.pat + def TypeCaseDef_rhs(self: TypeCaseDef) given (ctx: Context): TypeTree = self.body - def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree)(implicit ctx: Context): TypeCaseDef = + def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree) given (ctx: Context): TypeCaseDef = tpd.CaseDef(pattern, tpd.EmptyTree, body) - def TypeCaseDef_module_copy(original: TypeCaseDef)(pattern: TypeTree, body: TypeTree)(implicit ctx: Context): TypeCaseDef = + def TypeCaseDef_module_copy(original: TypeCaseDef)(pattern: TypeTree, body: TypeTree) given (ctx: Context): TypeCaseDef = tpd.cpy.CaseDef(original)(pattern, tpd.EmptyTree, body) // @@ -922,9 +922,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Pattern = tpd.Tree - def Pattern_pos(self: Pattern)(implicit ctx: Context): Position = self.sourcePos - def Pattern_tpe(self: Pattern)(implicit ctx: Context): Type = self.tpe.stripTypeVar - def Pattern_symbol(self: Pattern)(implicit ctx: Context): Symbol = self.symbol + def Pattern_pos(self: Pattern) given (ctx: Context): Position = self.sourcePos + def Pattern_tpe(self: Pattern) given (ctx: Context): Type = self.tpe.stripTypeVar + def Pattern_symbol(self: Pattern) given (ctx: Context): Symbol = self.symbol type Value = tpd.Tree @@ -935,14 +935,14 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def Pattern_Value_value(self: Value)(implicit ctx: Context): Term = self + def Pattern_Value_value(self: Value) given (ctx: Context): Term = self - def Pattern_Value_module_apply(term: Term)(implicit ctx: Context): Value = term match { + def Pattern_Value_module_apply(term: Term) given (ctx: Context): Value = term match { case lit: tpd.Literal => lit case ref: tpd.RefTree if ref.isTerm => ref case ths: tpd.This => ths } - def Pattern_Value_module_copy(original: Value)(term: Term)(implicit ctx: Context): Value = term match { + def Pattern_Value_module_copy(original: Value)(term: Term) given (ctx: Context): Value = term match { case lit: tpd.Literal => tpd.cpy.Literal(original)(lit.const) case ref: tpd.RefTree if ref.isTerm => tpd.cpy.Ref(original.asInstanceOf[tpd.RefTree])(ref.name) case ths: tpd.This => tpd.cpy.This(original)(ths.qual) @@ -950,31 +950,31 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Bind = tpd.Bind - def matchPattern_Bind(x: Pattern)(implicit ctx: Context): Option[Bind] = x match { + def matchPattern_Bind(x: Pattern) given (ctx: Context): Option[Bind] = x match { case x: tpd.Bind if x.name.isTermName => Some(x) case _ => None } - def Pattern_Bind_name(self: Bind)(implicit ctx: Context): String = self.name.toString + def Pattern_Bind_name(self: Bind) given (ctx: Context): String = self.name.toString - def Pattern_Bind_pattern(self: Bind)(implicit ctx: Context): Pattern = self.body + def Pattern_Bind_pattern(self: Bind) given (ctx: Context): Pattern = self.body - 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 = withDefaultPos(ctx => tpd.cpy.Bind(original)(name.toTermName, pattern)(ctx)) type Unapply = tpd.UnApply - def matchPattern_Unapply(pattern: Pattern)(implicit ctx: Context): Option[Unapply] = pattern match { + def matchPattern_Unapply(pattern: Pattern) given (ctx: Context): Option[Unapply] = pattern match { case pattern @ Trees.UnApply(_, _, _) => Some(pattern) case Trees.Typed(pattern @ Trees.UnApply(_, _, _), _) => Some(pattern) case _ => None } - def Pattern_Unapply_fun(self: Unapply)(implicit ctx: Context): Term = self.fun - def Pattern_Unapply_implicits(self: Unapply)(implicit ctx: Context): List[Term] = self.implicits - def Pattern_Unapply_patterns(self: Unapply)(implicit ctx: Context): List[Pattern] = effectivePatterns(self.patterns) + def Pattern_Unapply_fun(self: Unapply) given (ctx: Context): Term = self.fun + def Pattern_Unapply_implicits(self: Unapply) given (ctx: Context): List[Term] = self.implicits + def Pattern_Unapply_patterns(self: Unapply) given (ctx: Context): List[Pattern] = effectivePatterns(self.patterns) - 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 = withDefaultPos(ctx => tpd.cpy.UnApply(original)(fun, implicits, patterns)(ctx)) private def effectivePatterns(patterns: List[Pattern]): List[Pattern] = patterns match { @@ -984,45 +984,45 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Alternatives = tpd.Alternative - def matchPattern_Alternatives(pattern: Pattern)(implicit ctx: Context): Option[Alternatives] = pattern match { + def matchPattern_Alternatives(pattern: Pattern) given (ctx: Context): Option[Alternatives] = pattern match { case pattern: tpd.Alternative => Some(pattern) case _ => None } - def Pattern_Alternatives_patterns(self: Alternatives)(implicit ctx: Context): List[Pattern] = self.trees + def Pattern_Alternatives_patterns(self: Alternatives) given (ctx: Context): List[Pattern] = self.trees - def Pattern_Alternatives_module_apply(patterns: List[Pattern])(implicit ctx: Context): Alternatives = + def Pattern_Alternatives_module_apply(patterns: List[Pattern]) given (ctx: Context): Alternatives = withDefaultPos(ctx => tpd.Alternative(patterns)(ctx)) - def Pattern_Alternatives_module_copy(original: Alternatives)(patterns: List[Pattern])(implicit ctx: Context): Alternatives = + def Pattern_Alternatives_module_copy(original: Alternatives)(patterns: List[Pattern]) given (ctx: Context): Alternatives = tpd.cpy.Alternative(original)(patterns) type TypeTest = tpd.Typed - def matchPattern_TypeTest(pattern: Pattern)(implicit ctx: Context): Option[TypeTest] = pattern match { + def matchPattern_TypeTest(pattern: Pattern) given (ctx: Context): Option[TypeTest] = pattern match { case Trees.Typed(_: tpd.UnApply, _) => None case pattern: tpd.Typed => Some(pattern) case _ => None } - def Pattern_TypeTest_tpt(self: TypeTest)(implicit ctx: Context): TypeTree = self.tpt + def Pattern_TypeTest_tpt(self: TypeTest) given (ctx: Context): TypeTree = self.tpt - def Pattern_TypeTest_module_apply(tpt: TypeTree)(implicit ctx: Context): TypeTest = + def Pattern_TypeTest_module_apply(tpt: TypeTree) given (ctx: Context): TypeTest = withDefaultPos(ctx => tpd.Typed(untpd.Ident(nme.WILDCARD)(ctx.source).withType(tpt.tpe)(ctx), tpt)(ctx)) - def Pattern_TypeTest_module_copy(original: TypeTest)(tpt: TypeTree)(implicit ctx: Context): TypeTest = + def Pattern_TypeTest_module_copy(original: TypeTest)(tpt: TypeTree) given (ctx: Context): TypeTest = tpd.cpy.Typed(original)(untpd.Ident(nme.WILDCARD).withSpan(original.span).withType(tpt.tpe), tpt) type WildcardPattern = tpd.Ident - def matchPattern_WildcardPattern(pattern: Pattern)(implicit ctx: Context): Option[WildcardPattern] = { + def matchPattern_WildcardPattern(pattern: Pattern) given (ctx: Context): Option[WildcardPattern] = { pattern match { case pattern: tpd.Ident if tpd.isWildcardArg(pattern) => Some(pattern) case _ => None } } - def Pattern_WildcardPattern_module_apply(tpe: TypeOrBounds)(implicit ctx: Context): WildcardPattern = + def Pattern_WildcardPattern_module_apply(tpe: TypeOrBounds) given (ctx: Context): WildcardPattern = untpd.Ident(nme.WILDCARD).withType(tpe) // @@ -1033,28 +1033,28 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type NoPrefix = Types.NoPrefix.type - def matchNoPrefix(x: TypeOrBounds)(implicit ctx: Context): Option[NoPrefix] = + def matchNoPrefix(x: TypeOrBounds) given (ctx: Context): Option[NoPrefix] = if (x == Types.NoPrefix) Some(Types.NoPrefix) else None type TypeBounds = Types.TypeBounds - def matchTypeBounds(x: TypeOrBounds)(implicit ctx: Context): Option[TypeBounds] = x match { + def matchTypeBounds(x: TypeOrBounds) given (ctx: Context): Option[TypeBounds] = x match { case x: Types.TypeBounds => Some(x) case _ => None } - def TypeBounds_low(self: TypeBounds)(implicit ctx: Context): Type = self.lo - def TypeBounds_hi(self: TypeBounds)(implicit ctx: Context): Type = self.hi + def TypeBounds_low(self: TypeBounds) given (ctx: Context): Type = self.lo + def TypeBounds_hi(self: TypeBounds) given (ctx: Context): Type = self.hi type Type = Types.Type - def matchType(x: TypeOrBounds)(implicit ctx: Context): Option[Type] = x match { + def matchType(x: TypeOrBounds) given (ctx: Context): Option[Type] = x match { case x: TypeBounds => None case x if x == Types.NoPrefix => None case _ => Some(x) } - def Type_apply(clazz: Class[_])(implicit ctx: Context): Type = { + def Type_apply(clazz: Class[_]) given (ctx: Context): Type = { if (clazz.isPrimitive) { if (clazz == classOf[Boolean]) defn.BooleanType else if (clazz == classOf[Byte]) defn.ByteType @@ -1077,9 +1077,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } else ctx.getClassIfDefined(clazz.getCanonicalName).typeRef } - def `Type_=:=`(self: Type)(that: Type)(implicit ctx: Context): Boolean = self =:= that + def `Type_=:=`(self: Type)(that: Type) given (ctx: Context): Boolean = self =:= that - def `Type_<:<`(self: Type)(that: Type)(implicit ctx: Context): Boolean = self <:< that + def `Type_<:<`(self: Type)(that: Type) given (ctx: Context): Boolean = self <:< that /** Widen from singleton type to its underlying non-singleton * base type by applying one or more `underlying` dereferences, @@ -1090,49 +1090,49 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. * def o: Outer * .widen = o.C */ - def Type_widen(self: Type)(implicit ctx: Context): Type = self.widen + def Type_widen(self: Type) given (ctx: Context): Type = self.widen - def Type_dealias(self: Type)(implicit ctx: Context): Type = self.dealias + def Type_dealias(self: Type) given (ctx: Context): Type = self.dealias - def Type_classSymbol(self: Type)(implicit ctx: Context): Option[ClassDefSymbol] = + def Type_classSymbol(self: Type) given (ctx: Context): Option[ClassDefSymbol] = if (self.classSymbol.exists) Some(self.classSymbol.asClass) else None - def Type_typeSymbol(self: Type)(implicit ctx: Context): Symbol = self.typeSymbol + def Type_typeSymbol(self: Type) given (ctx: Context): Symbol = self.typeSymbol - def Type_isSingleton(self: Type)(implicit ctx: Context): Boolean = self.isSingleton + def Type_isSingleton(self: Type) given (ctx: Context): Boolean = self.isSingleton - def Type_memberType(self: Type)(member: Symbol)(implicit ctx: Context): Type = + def Type_memberType(self: Type)(member: Symbol) given (ctx: Context): Type = member.info.asSeenFrom(self, member.owner) - def Type_derivesFrom(self: Type)(cls: ClassDefSymbol)(implicit ctx: Context): Boolean = + def Type_derivesFrom(self: Type)(cls: ClassDefSymbol) given (ctx: Context): Boolean = self.derivesFrom(cls) - def Type_isFunctionType(self: Type)(implicit ctx: Context): Boolean = + def Type_isFunctionType(self: Type) given (ctx: Context): Boolean = defn.isFunctionType(self) - def Type_isImplicitFunctionType(self: Type)(implicit ctx: Context): Boolean = + def Type_isImplicitFunctionType(self: Type) given (ctx: Context): Boolean = defn.isImplicitFunctionType(self) - def Type_isErasedFunctionType(self: Type)(implicit ctx: Context): Boolean = + def Type_isErasedFunctionType(self: Type) given (ctx: Context): Boolean = defn.isErasedFunctionType(self) - def Type_isDependentFunctionType(self: Type)(implicit ctx: Context): Boolean = { + def Type_isDependentFunctionType(self: Type) given (ctx: Context): Boolean = { val tpNoRefinement = self.dropDependentRefinement tpNoRefinement != self && defn.isNonRefinedFunction(tpNoRefinement) } type ConstantType = Types.ConstantType - def matchConstantType(tpe: TypeOrBounds)(implicit ctx: Context): Option[ConstantType] = tpe match { + def matchConstantType(tpe: TypeOrBounds) given (ctx: Context): Option[ConstantType] = tpe match { case tpe: Types.ConstantType => Some(tpe) case _ => None } - def ConstantType_constant(self: ConstantType)(implicit ctx: Context): Constant = self.value + def ConstantType_constant(self: ConstantType) given (ctx: Context): Constant = self.value type SymRef = Types.NamedType - def matchSymRef(tpe: TypeOrBounds)(implicit ctx: Context): Option[SymRef] = tpe match { + def matchSymRef(tpe: TypeOrBounds) given (ctx: Context): Option[SymRef] = tpe match { case tp: Types.NamedType => tp.designator match { case sym: Symbol => Some(tp) @@ -1141,10 +1141,10 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def SymRef_qualifier(self: SymRef)(implicit ctx: Context): TypeOrBounds = self.prefix + def SymRef_qualifier(self: SymRef) given (ctx: Context): TypeOrBounds = self.prefix // TODO remove this method. May require splitting SymRef into TypeSymRef and TermSymRef - def matchSymRef_unapply(tpe: TypeOrBounds)(implicit ctx: Context): Option[(Symbol, Type | NoPrefix)] = tpe match { + def matchSymRef_unapply(tpe: TypeOrBounds) given (ctx: Context): Option[(Symbol, Type | NoPrefix)] = tpe match { case tpe: Types.NamedType => tpe.designator match { case sym: Symbol => Some((sym, tpe.prefix)) @@ -1155,7 +1155,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type TermRef = Types.NamedType - def matchTermRef(tpe: TypeOrBounds)(implicit ctx: Context): Option[TermRef] = tpe match { + def matchTermRef(tpe: TypeOrBounds) given (ctx: Context): Option[TermRef] = tpe match { case tpe: Types.NamedType => tpe.designator match { case name: Names.TermName => Some(tpe) @@ -1164,15 +1164,15 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def TermRef_name(self: TermRef)(implicit ctx: Context): String = self.name.toString - def TermRef_qualifier(self: TermRef)(implicit ctx: Context): TypeOrBounds = self.prefix + def TermRef_name(self: TermRef) given (ctx: Context): String = self.name.toString + def TermRef_qualifier(self: TermRef) given (ctx: Context): TypeOrBounds = self.prefix - def TermRef_apply(qual: TypeOrBounds, name: String)(implicit ctx: Context): TermRef = + def TermRef_apply(qual: TypeOrBounds, name: String) given (ctx: Context): TermRef = Types.TermRef(qual, name.toTermName) type TypeRef = Types.NamedType - def matchTypeRef(tpe: TypeOrBounds)(implicit ctx: Context): Option[TypeRef] = tpe match { + def matchTypeRef(tpe: TypeOrBounds) given (ctx: Context): Option[TypeRef] = tpe match { case tpe: Types.NamedType => tpe.designator match { case name: Names.TypeName => Some(tpe) @@ -1181,165 +1181,165 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def TypeRef_name(self: TypeRef)(implicit ctx: Context): String = self.name.toString - def TypeRef_qualifier(self: TypeRef)(implicit ctx: Context): TypeOrBounds = self.prefix + def TypeRef_name(self: TypeRef) given (ctx: Context): String = self.name.toString + def TypeRef_qualifier(self: TypeRef) given (ctx: Context): TypeOrBounds = self.prefix type SuperType = Types.SuperType - def matchSuperType(tpe: TypeOrBounds)(implicit ctx: Context): Option[SuperType] = tpe match { + def matchSuperType(tpe: TypeOrBounds) given (ctx: Context): Option[SuperType] = tpe match { case tpe: Types.SuperType => Some(tpe) case _ => None } - def SuperType_thistpe(self: SuperType)(implicit ctx: Context): Type = self.thistpe - def SuperType_supertpe(self: SuperType)(implicit ctx: Context): Type = self.supertpe + def SuperType_thistpe(self: SuperType) given (ctx: Context): Type = self.thistpe + def SuperType_supertpe(self: SuperType) given (ctx: Context): Type = self.supertpe type Refinement = Types.RefinedType - def matchRefinement(tpe: TypeOrBounds)(implicit ctx: Context): Option[Refinement] = tpe match { + def matchRefinement(tpe: TypeOrBounds) given (ctx: Context): Option[Refinement] = tpe match { case tpe: Types.RefinedType => Some(tpe) case _ => None } - def Refinement_parent(self: Refinement)(implicit ctx: Context): Type = self.parent - def Refinement_name(self: Refinement)(implicit ctx: Context): String = self.refinedName.toString - def Refinement_info(self: Refinement)(implicit ctx: Context): TypeOrBounds = self.refinedInfo + def Refinement_parent(self: Refinement) given (ctx: Context): Type = self.parent + def Refinement_name(self: Refinement) given (ctx: Context): String = self.refinedName.toString + def Refinement_info(self: Refinement) given (ctx: Context): TypeOrBounds = self.refinedInfo type AppliedType = Types.AppliedType - def matchAppliedType(tpe: TypeOrBounds)(implicit ctx: Context): Option[AppliedType] = tpe match { + def matchAppliedType(tpe: TypeOrBounds) given (ctx: Context): Option[AppliedType] = tpe match { case tpe: Types.AppliedType => Some(tpe) case _ => None } - def AppliedType_tycon(self: AppliedType)(implicit ctx: Context): Type = self.tycon - def AppliedType_args(self: AppliedType)(implicit ctx: Context): List[TypeOrBounds] = self.args + def AppliedType_tycon(self: AppliedType) given (ctx: Context): Type = self.tycon + def AppliedType_args(self: AppliedType) given (ctx: Context): List[TypeOrBounds] = self.args type AnnotatedType = Types.AnnotatedType - def matchAnnotatedType(tpe: TypeOrBounds)(implicit ctx: Context): Option[AnnotatedType] = tpe match { + def matchAnnotatedType(tpe: TypeOrBounds) given (ctx: Context): Option[AnnotatedType] = tpe match { case tpe: Types.AnnotatedType => Some(tpe) case _ => None } - def AnnotatedType_underlying(self: AnnotatedType)(implicit ctx: Context): Type = self.underlying.stripTypeVar - def AnnotatedType_annot(self: AnnotatedType)(implicit ctx: Context): Term = self.annot.tree + def AnnotatedType_underlying(self: AnnotatedType) given (ctx: Context): Type = self.underlying.stripTypeVar + def AnnotatedType_annot(self: AnnotatedType) given (ctx: Context): Term = self.annot.tree type AndType = Types.AndType - def matchAndType(tpe: TypeOrBounds)(implicit ctx: Context): Option[AndType] = tpe match { + def matchAndType(tpe: TypeOrBounds) given (ctx: Context): Option[AndType] = tpe match { case tpe: Types.AndType => Some(tpe) case _ => None } - def AndType_left(self: AndType)(implicit ctx: Context): Type = self.tp1.stripTypeVar - def AndType_right(self: AndType)(implicit ctx: Context): Type = self.tp2.stripTypeVar + def AndType_left(self: AndType) given (ctx: Context): Type = self.tp1.stripTypeVar + def AndType_right(self: AndType) given (ctx: Context): Type = self.tp2.stripTypeVar type OrType = Types.OrType - def matchOrType(tpe: TypeOrBounds)(implicit ctx: Context): Option[OrType] = tpe match { + def matchOrType(tpe: TypeOrBounds) given (ctx: Context): Option[OrType] = tpe match { case tpe: Types.OrType => Some(tpe) case _ => None } - def OrType_left(self: OrType)(implicit ctx: Context): Type = self.tp1.stripTypeVar - def OrType_right(self: OrType)(implicit ctx: Context): Type = self.tp2.stripTypeVar + def OrType_left(self: OrType) given (ctx: Context): Type = self.tp1.stripTypeVar + def OrType_right(self: OrType) given (ctx: Context): Type = self.tp2.stripTypeVar type MatchType = Types.MatchType - def matchMatchType(tpe: TypeOrBounds)(implicit ctx: Context): Option[MatchType] = tpe match { + def matchMatchType(tpe: TypeOrBounds) given (ctx: Context): Option[MatchType] = tpe match { case tpe: Types.MatchType => Some(tpe) case _ => None } - def MatchType_bound(self: MatchType)(implicit ctx: Context): Type = self.bound - def MatchType_scrutinee(self: MatchType)(implicit ctx: Context): Type = self.scrutinee - def MatchType_cases(self: MatchType)(implicit ctx: Context): List[Type] = self.cases + def MatchType_bound(self: MatchType) given (ctx: Context): Type = self.bound + def MatchType_scrutinee(self: MatchType) given (ctx: Context): Type = self.scrutinee + def MatchType_cases(self: MatchType) given (ctx: Context): List[Type] = self.cases type ByNameType = Types.ExprType - def matchByNameType(tpe: TypeOrBounds)(implicit ctx: Context): Option[ByNameType] = tpe match { + def matchByNameType(tpe: TypeOrBounds) given (ctx: Context): Option[ByNameType] = tpe match { case tpe: Types.ExprType => Some(tpe) case _ => None } - def ByNameType_underlying(self: ByNameType)(implicit ctx: Context): Type = self.resType.stripTypeVar + def ByNameType_underlying(self: ByNameType) given (ctx: Context): Type = self.resType.stripTypeVar type ParamRef = Types.ParamRef - def matchParamRef(tpe: TypeOrBounds)(implicit ctx: Context): Option[ParamRef] = tpe match { + def matchParamRef(tpe: TypeOrBounds) given (ctx: Context): Option[ParamRef] = tpe match { case tpe: Types.TypeParamRef => Some(tpe) case tpe: Types.TermParamRef => Some(tpe) case _ => None } - def ParamRef_binder(self: ParamRef)(implicit ctx: Context): LambdaType[TypeOrBounds] = + def ParamRef_binder(self: ParamRef) given (ctx: Context): LambdaType[TypeOrBounds] = self.binder.asInstanceOf[LambdaType[TypeOrBounds]] // Cast to tpd - def ParamRef_paramNum(self: ParamRef)(implicit ctx: Context): Int = self.paramNum + def ParamRef_paramNum(self: ParamRef) given (ctx: Context): Int = self.paramNum type ThisType = Types.ThisType - def matchThisType(tpe: TypeOrBounds)(implicit ctx: Context): Option[ThisType] = tpe match { + def matchThisType(tpe: TypeOrBounds) given (ctx: Context): Option[ThisType] = tpe match { case tpe: Types.ThisType => Some(tpe) case _ => None } - def ThisType_tref(self: ThisType)(implicit ctx: Context): Type = self.tref + def ThisType_tref(self: ThisType) given (ctx: Context): Type = self.tref type RecursiveThis = Types.RecThis - def matchRecursiveThis(tpe: TypeOrBounds)(implicit ctx: Context): Option[RecursiveThis] = tpe match { + def matchRecursiveThis(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveThis] = tpe match { case tpe: Types.RecThis => Some(tpe) case _ => None } - def RecursiveThis_binder(self: RecursiveThis)(implicit ctx: Context): RecursiveType = self.binder + def RecursiveThis_binder(self: RecursiveThis) given (ctx: Context): RecursiveType = self.binder type RecursiveType = Types.RecType - def matchRecursiveType(tpe: TypeOrBounds)(implicit ctx: Context): Option[RecursiveType] = tpe match { + def matchRecursiveType(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveType] = tpe match { case tpe: Types.RecType => Some(tpe) case _ => None } - def RecursiveType_underlying(self: RecursiveType)(implicit ctx: Context): Type = self.underlying.stripTypeVar + def RecursiveType_underlying(self: RecursiveType) given (ctx: Context): Type = self.underlying.stripTypeVar type LambdaType[ParamInfo] = Types.LambdaType { type PInfo = ParamInfo } type MethodType = Types.MethodType - def matchMethodType(tpe: TypeOrBounds)(implicit ctx: Context): Option[MethodType] = tpe match { + def matchMethodType(tpe: TypeOrBounds) given (ctx: Context): Option[MethodType] = tpe match { case tpe: Types.MethodType => Some(tpe) case _ => None } def MethodType_isErased(self: MethodType): Boolean = self.isErasedMethod def MethodType_isImplicit(self: MethodType): Boolean = self.isImplicitMethod - def MethodType_paramNames(self: MethodType)(implicit ctx: Context): List[String] = self.paramNames.map(_.toString) - def MethodType_paramTypes(self: MethodType)(implicit ctx: Context): List[Type] = self.paramInfos - def MethodType_resType(self: MethodType)(implicit ctx: Context): Type = self.resType + def MethodType_paramNames(self: MethodType) given (ctx: Context): List[String] = self.paramNames.map(_.toString) + def MethodType_paramTypes(self: MethodType) given (ctx: Context): List[Type] = self.paramInfos + def MethodType_resType(self: MethodType) given (ctx: Context): Type = self.resType type PolyType = Types.PolyType - def matchPolyType(tpe: TypeOrBounds)(implicit ctx: Context): Option[PolyType] = tpe match { + def matchPolyType(tpe: TypeOrBounds) given (ctx: Context): Option[PolyType] = tpe match { case tpe: Types.PolyType => Some(tpe) case _ => None } - def PolyType_paramNames(self: PolyType)(implicit ctx: Context): List[String] = self.paramNames.map(_.toString) - def PolyType_paramBounds(self: PolyType)(implicit ctx: Context): List[TypeBounds] = self.paramInfos - def PolyType_resType(self: PolyType)(implicit ctx: Context): Type = self.resType + def PolyType_paramNames(self: PolyType) given (ctx: Context): List[String] = self.paramNames.map(_.toString) + def PolyType_paramBounds(self: PolyType) given (ctx: Context): List[TypeBounds] = self.paramInfos + def PolyType_resType(self: PolyType) given (ctx: Context): Type = self.resType type TypeLambda = Types.TypeLambda - def matchTypeLambda(tpe: TypeOrBounds)(implicit ctx: Context): Option[TypeLambda] = tpe match { + def matchTypeLambda(tpe: TypeOrBounds) given (ctx: Context): Option[TypeLambda] = tpe match { case tpe: Types.TypeLambda => Some(tpe) case _ => None } - def TypeLambda_paramNames(self: TypeLambda)(implicit ctx: Context): List[String] = self.paramNames.map(_.toString) - def TypeLambda_paramBounds(self: TypeLambda)(implicit ctx: Context): List[TypeBounds] = self.paramInfos - def TypeLambda_resType(self: TypeLambda)(implicit ctx: Context): Type = self.resType + def TypeLambda_paramNames(self: TypeLambda) given (ctx: Context): List[String] = self.paramNames.map(_.toString) + def TypeLambda_paramBounds(self: TypeLambda) given (ctx: Context): List[TypeBounds] = self.paramInfos + def TypeLambda_resType(self: TypeLambda) given (ctx: Context): Type = self.resType // // IMPORT SELECTORS @@ -1349,33 +1349,33 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type SimpleSelector = untpd.Ident - def matchSimpleSelector(self: ImportSelector)(implicit ctx: Context): Option[SimpleSelector] = self match { + def matchSimpleSelector(self: ImportSelector) given (ctx: Context): Option[SimpleSelector] = self match { case self: untpd.Ident => Some(self) case _ => None } - def SimpleSelector_selection(self: SimpleSelector)(implicit ctx: Context): Id = self + def SimpleSelector_selection(self: SimpleSelector) given (ctx: Context): Id = self type RenameSelector = untpd.Thicket - def matchRenameSelector(self: ImportSelector)(implicit ctx: Context): Option[RenameSelector] = self match { + def matchRenameSelector(self: ImportSelector) given (ctx: Context): Option[RenameSelector] = self match { case self @ Trees.Thicket((id1: untpd.Ident) :: (id2: untpd.Ident) :: Nil) if id2.name != nme.WILDCARD => Some(self) case _ => None } - def RenameSelector_from(self: RenameSelector)(implicit ctx: Context): Id = + def RenameSelector_from(self: RenameSelector) given (ctx: Context): Id = self.trees.head.asInstanceOf[untpd.Ident] - def RenameSelector_to(self: RenameSelector)(implicit ctx: Context): Id = + def RenameSelector_to(self: RenameSelector) given (ctx: Context): Id = self.trees.last.asInstanceOf[untpd.Ident] type OmitSelector = untpd.Thicket - def matchOmitSelector(self: ImportSelector)(implicit ctx: Context): Option[OmitSelector] = self match { + def matchOmitSelector(self: ImportSelector) given (ctx: Context): Option[OmitSelector] = self match { case self @ Trees.Thicket((id: untpd.Ident) :: Trees.Ident(nme.WILDCARD) :: Nil) => Some(self) case _ => None } - def SimpleSelector_omited(self: OmitSelector)(implicit ctx: Context): Id = + def SimpleSelector_omited(self: OmitSelector) given (ctx: Context): Id = self.trees.head.asInstanceOf[untpd.Ident] // @@ -1384,9 +1384,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Id = untpd.Ident - def Id_pos(self: Id)(implicit ctx: Context): Position = self.sourcePos + def Id_pos(self: Id) given (ctx: Context): Position = self.sourcePos - def Id_name(self: Id)(implicit ctx: Context): String = self.name.toString + def Id_name(self: Id) given (ctx: Context): String = self.name.toString // // SIGNATURES @@ -1470,34 +1470,34 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Symbol = core.Symbols.Symbol - def Symbol_owner(self: Symbol)(implicit ctx: Context): Symbol = self.owner + def Symbol_owner(self: Symbol) given (ctx: Context): Symbol = self.owner - def Symbol_flags(self: Symbol)(implicit ctx: Context): Flags = self.flags + def Symbol_flags(self: Symbol) given (ctx: Context): Flags = self.flags - def Symbol_privateWithin(self: Symbol)(implicit ctx: Context): Option[Type] = { + def Symbol_privateWithin(self: Symbol) given (ctx: Context): Option[Type] = { val within = self.privateWithin if (within.exists && !self.is(core.Flags.Protected)) Some(within.typeRef) else None } - def Symbol_protectedWithin(self: Symbol)(implicit ctx: Context): Option[Type] = { + def Symbol_protectedWithin(self: Symbol) given (ctx: Context): Option[Type] = { val within = self.privateWithin if (within.exists && self.is(core.Flags.Protected)) Some(within.typeRef) else None } - def Symbol_name(self: Symbol)(implicit ctx: Context): String = self.name.toString + def Symbol_name(self: Symbol) given (ctx: Context): String = self.name.toString - def Symbol_fullName(self: Symbol)(implicit ctx: Context): String = self.fullName.toString + def Symbol_fullName(self: Symbol) given (ctx: Context): String = self.fullName.toString - def Symbol_pos(self: Symbol)(implicit ctx: Context): Position = self.sourcePos + def Symbol_pos(self: Symbol) given (ctx: Context): Position = self.sourcePos - def Symbol_localContext(self: Symbol)(implicit ctx: Context): Context = { + def Symbol_localContext(self: Symbol) given (ctx: Context): Context = { if (self.exists) ctx.withOwner(self) else ctx } - def Symbol_comment(self: Symbol)(implicit ctx: Context): Option[Comment] = { + def Symbol_comment(self: Symbol) given (ctx: Context): Option[Comment] = { import dotty.tools.dotc.core.Comments.CommentsContext val docCtx = ctx.docCtx.getOrElse { throw new RuntimeException( @@ -1506,60 +1506,60 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } docCtx.docstring(self) } - def Symbol_annots(self: Symbol)(implicit ctx: Context): List[Term] = { + def Symbol_annots(self: Symbol) given (ctx: Context): List[Term] = { self.annotations.flatMap { case _: core.Annotations.LazyBodyAnnotation => Nil case annot => annot.tree :: Nil } } - def Symbol_isDefinedInCurrentRun(self: Symbol)(implicit ctx: Context): Boolean = + def Symbol_isDefinedInCurrentRun(self: Symbol) given (ctx: Context): Boolean = self.topLevelClass.asClass.isDefinedInCurrentRun - def Symbol_isLocalDummy(self: Symbol)(implicit ctx: Context): Boolean = self.isLocalDummy - def Symbol_isRefinementClass(self: Symbol)(implicit ctx: Context): Boolean = self.isRefinementClass - def Symbol_isAliasType(self: Symbol)(implicit ctx: Context): Boolean = self.isAliasType - def Symbol_isAnonymousClass(self: Symbol)(implicit ctx: Context): Boolean = self.isAnonymousClass - def Symbol_isAnonymousFunction(self: Symbol)(implicit ctx: Context): Boolean = self.isAnonymousFunction - def Symbol_isAbstractType(self: Symbol)(implicit ctx: Context): Boolean = self.isAbstractType - def Symbol_isClassConstructor(self: Symbol)(implicit ctx: Context): Boolean = self.isClassConstructor + def Symbol_isLocalDummy(self: Symbol) given (ctx: Context): Boolean = self.isLocalDummy + def Symbol_isRefinementClass(self: Symbol) given (ctx: Context): Boolean = self.isRefinementClass + def Symbol_isAliasType(self: Symbol) given (ctx: Context): Boolean = self.isAliasType + def Symbol_isAnonymousClass(self: Symbol) given (ctx: Context): Boolean = self.isAnonymousClass + def Symbol_isAnonymousFunction(self: Symbol) given (ctx: Context): Boolean = self.isAnonymousFunction + def Symbol_isAbstractType(self: Symbol) given (ctx: Context): Boolean = self.isAbstractType + def Symbol_isClassConstructor(self: Symbol) given (ctx: Context): Boolean = self.isClassConstructor type PackageDefSymbol = core.Symbols.Symbol - def matchPackageDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[PackageDefSymbol] = + def matchPackageDefSymbol(symbol: Symbol) given (ctx: Context): Option[PackageDefSymbol] = if (symbol.is(core.Flags.Package)) Some(symbol) else None - def PackageDefSymbol_tree(self: PackageDefSymbol)(implicit ctx: Context): PackageDef = + def PackageDefSymbol_tree(self: PackageDefSymbol) given (ctx: Context): PackageDef = FromSymbol.packageDefFromSym(self) type TypeSymbol = core.Symbols.TypeSymbol - def matchTypeSymbol(symbol: Symbol)(implicit ctx: Context): Option[TypeSymbol] = + def matchTypeSymbol(symbol: Symbol) given (ctx: Context): Option[TypeSymbol] = if (symbol.isType) Some(symbol.asType) else None type ClassDefSymbol = core.Symbols.ClassSymbol - def matchClassDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[ClassDefSymbol] = + def matchClassDefSymbol(symbol: Symbol) given (ctx: Context): Option[ClassDefSymbol] = if (symbol.isClass) Some(symbol.asClass) else None - def ClassDefSymbol_tree(self: ClassDefSymbol)(implicit ctx: Context): ClassDef = + def ClassDefSymbol_tree(self: ClassDefSymbol) given (ctx: Context): ClassDef = FromSymbol.classDef(self) - def ClassDefSymbol_fields(self: Symbol)(implicit ctx: Context): List[Symbol] = + def ClassDefSymbol_fields(self: Symbol) given (ctx: Context): List[Symbol] = self.unforcedDecls.filter(isField) - def ClassDefSymbol_field(self: Symbol)(name: String)(implicit ctx: Context): Option[Symbol] = { + def ClassDefSymbol_field(self: Symbol)(name: String) given (ctx: Context): Option[Symbol] = { val sym = self.unforcedDecls.find(sym => sym.name == name.toTermName) if (sym.exists && isField(sym)) Some(sym) else None } - def ClassDefSymbol_classMethod(self: Symbol)(name: String)(implicit ctx: Context): List[DefDefSymbol] = { + def ClassDefSymbol_classMethod(self: Symbol)(name: String) given (ctx: Context): List[DefDefSymbol] = { self.typeRef.decls.iterator.collect { case sym if isMethod(sym) && sym.name.toString == name => sym.asTerm }.toList } - def ClassDefSymbol_classMethods(self: Symbol)(implicit ctx: Context): List[DefDefSymbol] = { + def ClassDefSymbol_classMethods(self: Symbol) given (ctx: Context): List[DefDefSymbol] = { self.typeRef.decls.iterator.collect { case sym if isMethod(sym) => sym.asTerm }.toList @@ -1567,110 +1567,110 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. private def appliedTypeRef(sym: Symbol): Type = sym.typeRef.appliedTo(sym.typeParams.map(_.typeRef)) - def ClassDefSymbol_method(self: Symbol)(name: String)(implicit ctx: Context): List[DefDefSymbol] = { + def ClassDefSymbol_method(self: Symbol)(name: String) given (ctx: Context): List[DefDefSymbol] = { appliedTypeRef(self).allMembers.iterator.map(_.symbol).collect { case sym if isMethod(sym) && sym.name.toString == name => sym.asTerm }.toList } - def ClassDefSymbol_methods(self: Symbol)(implicit ctx: Context): List[DefDefSymbol] = { + def ClassDefSymbol_methods(self: Symbol) given (ctx: Context): List[DefDefSymbol] = { appliedTypeRef(self).allMembers.iterator.map(_.symbol).collect { case sym if isMethod(sym) => sym.asTerm }.toList } - private def isMethod(sym: Symbol)(implicit ctx: Context): Boolean = + private def isMethod(sym: Symbol) given (ctx: Context): Boolean = sym.isTerm && sym.is(Flags.Method) && !sym.isConstructor - def ClassDefSymbol_caseFields(self: Symbol)(implicit ctx: Context): List[ValDefSymbol] = { + def ClassDefSymbol_caseFields(self: Symbol) given (ctx: Context): List[ValDefSymbol] = { if (!self.isClass) Nil else self.asClass.paramAccessors.collect { case sym if sym.is(Flags.CaseAccessor) => sym.asTerm } } - def ClassDefSymbol_companionClass(self: Symbol)(implicit ctx: Context): Option[ClassDefSymbol] = { + def ClassDefSymbol_companionClass(self: Symbol) given (ctx: Context): Option[ClassDefSymbol] = { val sym = self.companionModule.companionClass if (sym.exists) Some(sym.asClass) else None } - def ClassDefSymbol_companionModule(self: Symbol)(implicit ctx: Context): Option[ValDefSymbol] = { + def ClassDefSymbol_companionModule(self: Symbol) given (ctx: Context): Option[ValDefSymbol] = { val sym = self.companionModule if (sym.exists) Some(sym.asTerm) else None } - def ClassDefSymbol_moduleClass(self: Symbol)(implicit ctx: Context): Option[Symbol] = { + def ClassDefSymbol_moduleClass(self: Symbol) given (ctx: Context): Option[Symbol] = { val sym = self.moduleClass if (sym.exists) Some(sym.asTerm) else None } - private def isField(sym: Symbol)(implicit ctx: Context): Boolean = sym.isTerm && !sym.is(Flags.Method) + private def isField(sym: Symbol) given (ctx: Context): Boolean = sym.isTerm && !sym.is(Flags.Method) - def ClassDefSymbol_of(fullName: String)(implicit ctx: Context): ClassDefSymbol = ctx.requiredClass(fullName) + def ClassDefSymbol_of(fullName: String) given (ctx: Context): ClassDefSymbol = ctx.requiredClass(fullName) type TypeDefSymbol = core.Symbols.TypeSymbol - def matchTypeDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[TypeDefSymbol] = + def matchTypeDefSymbol(symbol: Symbol) given (ctx: Context): Option[TypeDefSymbol] = if (symbol.isType) Some(symbol.asType) else None - def TypeDefSymbol_tree(self: TypeDefSymbol)(implicit ctx: Context): TypeDef = + def TypeDefSymbol_tree(self: TypeDefSymbol) given (ctx: Context): TypeDef = FromSymbol.typeDefFromSym(self) - def TypeDefSymbol_isTypeParam(self: TypeDefSymbol)(implicit ctx: Context): Boolean = + def TypeDefSymbol_isTypeParam(self: TypeDefSymbol) given (ctx: Context): Boolean = self.isTypeParam type TypeBindSymbol = core.Symbols.TypeSymbol - def matchTypeBindSymbol(symbol: Symbol)(implicit ctx: Context): Option[TypeBindSymbol] = + def matchTypeBindSymbol(symbol: Symbol) given (ctx: Context): Option[TypeBindSymbol] = if (symbol.isType && symbol.is(core.Flags.Case)) Some(symbol.asType) else None - def TypeBindSymbol_tree(self: TypeBindSymbol)(implicit ctx: Context): TypeBind = + def TypeBindSymbol_tree(self: TypeBindSymbol) given (ctx: Context): TypeBind = FromSymbol.typeBindFromSym(self) type TermSymbol = core.Symbols.TermSymbol - def matchTermSymbol(symbol: Symbol)(implicit ctx: Context): Option[TermSymbol] = + def matchTermSymbol(symbol: Symbol) given (ctx: Context): Option[TermSymbol] = if (symbol.isTerm) Some(symbol.asTerm) else None type DefDefSymbol = core.Symbols.TermSymbol - def matchDefDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[DefDefSymbol] = + def matchDefDefSymbol(symbol: Symbol) given (ctx: Context): Option[DefDefSymbol] = if (symbol.isTerm && symbol.is(core.Flags.Method)) Some(symbol.asTerm) else None - def DefDefSymbol_tree(self: DefDefSymbol)(implicit ctx: Context): DefDef = + def DefDefSymbol_tree(self: DefDefSymbol) given (ctx: Context): DefDef = FromSymbol.defDefFromSym(self) - def DefDefSymbol_signature(self: DefDefSymbol)(implicit ctx: Context): Signature = + def DefDefSymbol_signature(self: DefDefSymbol) given (ctx: Context): Signature = self.signature type ValDefSymbol = core.Symbols.TermSymbol - def matchValDefSymbol(symbol: Symbol)(implicit ctx: Context): Option[ValDefSymbol] = + def matchValDefSymbol(symbol: Symbol) given (ctx: Context): Option[ValDefSymbol] = if (symbol.isTerm && !symbol.is(core.Flags.Method) && !symbol.is(core.Flags.Case)) Some(symbol.asTerm) else None - def ValDefSymbol_tree(self: ValDefSymbol)(implicit ctx: Context): ValDef = + def ValDefSymbol_tree(self: ValDefSymbol) given (ctx: Context): ValDef = FromSymbol.valDefFromSym(self) - def ValDefSymbol_moduleClass(self: ValDefSymbol)(implicit ctx: Context): Option[ClassDefSymbol] = { + def ValDefSymbol_moduleClass(self: ValDefSymbol) given (ctx: Context): Option[ClassDefSymbol] = { val sym = self.moduleClass if (sym.exists) Some(sym.asClass) else None } - def ValDefSymbol_companionClass(self: ValDefSymbol)(implicit ctx: Context): Option[ClassDefSymbol] = { + def ValDefSymbol_companionClass(self: ValDefSymbol) given (ctx: Context): Option[ClassDefSymbol] = { val sym = self.companionClass if (sym.exists) Some(sym.asClass) else None } type BindSymbol = core.Symbols.TermSymbol - def matchBindSymbol(symbol: Symbol)(implicit ctx: Context): Option[BindSymbol] = + def matchBindSymbol(symbol: Symbol) given (ctx: Context): Option[BindSymbol] = if (symbol.isTerm && symbol.is(core.Flags.Case)) Some(symbol.asTerm) else None - def BindSymbol_tree(self: BindSymbol)(implicit ctx: Context): Bind = + def BindSymbol_tree(self: BindSymbol) given (ctx: Context): Bind = FromSymbol.bindFromSym(self) type NoSymbol = core.Symbols.NoSymbol.type - def matchNoSymbol(symbol: Symbol)(implicit ctx: Context): Boolean = symbol eq core.Symbols.NoSymbol + def matchNoSymbol(symbol: Symbol) given (ctx: Context): Boolean = symbol eq core.Symbols.NoSymbol // // FLAGS @@ -1728,15 +1728,15 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. // /** 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 = PickledQuotes.quotedExprToTree(self) /** View this expression `quoted.Type[_]` 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 = PickledQuotes.quotedTypeToTree(self) /** 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] = { def etaExpand(term: Term): Term = term.tpe.widen match { case mtpe: Types.MethodType if !mtpe.isParamDependent => val closureResType = mtpe.resType match { @@ -1752,7 +1752,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } /** 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] = { val tree = QuotedExpr_unseal(self) val expectedType = QuotedType_unseal(tp).tpe if (tree.tpe <:< expectedType) { @@ -1767,7 +1767,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } /** 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[_] = { val dummySpan = ctx.owner.span // FIXME new scala.internal.quoted.TreeType(tpd.TypeTree(self).withSpan(dummySpan)) } @@ -1855,38 +1855,38 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type ImplicitSearchResult = Tree - def searchImplicit(tpe: Type)(implicit ctx: Context): ImplicitSearchResult = + def searchImplicit(tpe: Type) given (ctx: Context): ImplicitSearchResult = ctx.typer.inferImplicitArg(tpe, rootPosition.span) type ImplicitSearchSuccess = Tree - def matchImplicitSearchSuccess(isr: ImplicitSearchResult)(implicit ctx: Context): Option[ImplicitSearchSuccess] = isr.tpe match { + def matchImplicitSearchSuccess(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchSuccess] = isr.tpe match { case _: SearchFailureType => None case _ => Some(isr) } - def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess)(implicit ctx: Context): Term = self + def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess) given (ctx: Context): Term = self type ImplicitSearchFailure = Tree - def matchImplicitSearchFailure(isr: ImplicitSearchResult)(implicit ctx: Context): Option[ImplicitSearchFailure] = isr.tpe match { + def matchImplicitSearchFailure(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchFailure] = isr.tpe match { case _: SearchFailureType => Some(isr) case _ => None } - def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure)(implicit ctx: Context): String = + def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure) given (ctx: Context): String = self.tpe.asInstanceOf[SearchFailureType].explanation type DivergingImplicit = Tree - def matchDivergingImplicit(isr: ImplicitSearchResult)(implicit ctx: Context): Option[DivergingImplicit] = isr.tpe match { + def matchDivergingImplicit(isr: ImplicitSearchResult) given (ctx: Context): Option[DivergingImplicit] = isr.tpe match { case _: Implicits.DivergingImplicit => Some(isr) case _ => None } type NoMatchingImplicits = Tree - def matchNoMatchingImplicits(isr: ImplicitSearchResult)(implicit ctx: Context): Option[NoMatchingImplicits] = isr.tpe match { + def matchNoMatchingImplicits(isr: ImplicitSearchResult) given (ctx: Context): Option[NoMatchingImplicits] = isr.tpe match { case _: Implicits.NoMatchingImplicits => Some(isr) case _ => None } type AmbiguousImplicits = Tree - def matchAmbiguousImplicits(isr: ImplicitSearchResult)(implicit ctx: Context): Option[AmbiguousImplicits] = isr.tpe match { + def matchAmbiguousImplicits(isr: ImplicitSearchResult) given (ctx: Context): Option[AmbiguousImplicits] = isr.tpe match { case _: Implicits.AmbiguousImplicits => Some(isr) case _ => None } @@ -1898,7 +1898,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. private def optional[T <: Trees.Tree[_]](tree: T): Option[tree.type] = if (tree.isEmpty) None else Some(tree) - private def withDefaultPos[T <: Tree](fn: Context => T)(implicit ctx: Context): T = { + private def withDefaultPos[T <: Tree](fn: Context => T) given (ctx: Context): T = { fn(ctx.withSource(rootPosition.source)).withSpan(rootPosition.span) } } From 307b5a587124c7d75819ff143afc811dcb042dc3 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Sun, 28 Jul 2019 11:25:59 +0200 Subject: [PATCH 2/3] Use contextual functions --- .../tools/dotc/tastyreflect/KernelImpl.scala | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala index cb56108b3149..addceb1c9831 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala @@ -107,7 +107,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def PackageClause_stats(self: PackageClause) given (ctx: Context): List[Tree] = self.stats def PackageClause_apply(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = - withDefaultPos(ctx => tpd.PackageDef(pid.asInstanceOf[tpd.RefTree], stats)(ctx)) + withDefaultPos(tpd.PackageDef(pid.asInstanceOf[tpd.RefTree], stats)) def PackageClause_copy(original: PackageClause)(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = tpd.cpy.PackageDef(original)(pid, stats) @@ -131,7 +131,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Import_selectors(self: Import) given (ctx: Context): List[ImportSelector] = self.selectors def Import_apply(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import = - withDefaultPos(ctx => tpd.Import(importImplied, expr, selectors)(ctx)) + withDefaultPos(tpd.Import(importImplied, expr, selectors)) def Import_copy(original: Import)(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import = tpd.cpy.Import(original)(importImplied, expr, selectors) @@ -195,7 +195,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def TypeDef_rhs(self: TypeDef) given (ctx: Context): TypeTree | TypeBoundsTree = self.rhs def TypeDef_symbol(self: TypeDef) given (ctx: Context): TypeDefSymbol = self.symbol.asType - def TypeDef_apply(symbol: TypeDefSymbol) given (ctx: Context): TypeDef = withDefaultPos(ctx => tpd.TypeDef(symbol)(ctx)) + def TypeDef_apply(symbol: TypeDefSymbol) given (ctx: Context): TypeDef = withDefaultPos(tpd.TypeDef(symbol)) def TypeDef_copy(original: TypeDef)(name: String, rhs: TypeTree | TypeBoundsTree) given (ctx: Context): TypeDef = tpd.cpy.TypeDef(original)(name.toTypeName, rhs) @@ -213,7 +213,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def DefDef_symbol(self: DefDef) given (ctx: Context): DefDefSymbol = self.symbol.asTerm def DefDef_apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term]) given (ctx: Context): DefDef = - withDefaultPos(ctx => tpd.polyDefDef(symbol, tparams => vparamss => rhsFn(tparams)(vparamss).getOrElse(tpd.EmptyTree))(ctx)) + withDefaultPos(tpd.polyDefDef(symbol, tparams => vparamss => rhsFn(tparams)(vparamss).getOrElse(tpd.EmptyTree))) def DefDef_copy(original: DefDef)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): DefDef = tpd.cpy.DefDef(original)(name.toTermName, typeParams, paramss, tpt, rhs.getOrElse(tpd.EmptyTree)) @@ -256,7 +256,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } def Ref_apply(sym: Symbol) given (ctx: Context): Ref = - withDefaultPos(ctx => tpd.ref(sym)(ctx).asInstanceOf[tpd.RefTree]) + withDefaultPos(tpd.ref(sym).asInstanceOf[tpd.RefTree]) type Ident = tpd.Ident @@ -268,7 +268,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Ident_name(self: Ident) given (ctx: Context): String = self.name.show def Ident_apply(tmref: TermRef) given (ctx: Context): Term = - withDefaultPos(implicit ctx => tpd.ref(tmref).asInstanceOf[Term]) + withDefaultPos(tpd.ref(tmref).asInstanceOf[Term]) def Ident_copy(original: Tree)(name: String) given (ctx: Context): Ident = tpd.cpy.Ident(original)(name.toTermName) @@ -287,17 +287,17 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. else Some(self.symbol.signature) def Select_apply(qualifier: Term, symbol: Symbol) given (ctx: Context): Select = - withDefaultPos(implicit ctx => tpd.Select(qualifier, Types.TermRef(qualifier.tpe, symbol))) + withDefaultPos(tpd.Select(qualifier, Types.TermRef(qualifier.tpe, symbol))) def Select_unique(qualifier: Term, name: String) given (ctx: Context): Select = { val denot = qualifier.tpe.member(name.toTermName) assert(!denot.isOverloaded, s"The symbol `$name` is overloaded. The method Select.unique can only be used for non-overloaded symbols.") - withDefaultPos(implicit ctx => tpd.Select(qualifier, name.toTermName)) + withDefaultPos(tpd.Select(qualifier, name.toTermName)) } // TODO rename, this returns an Apply and not a Select def Select_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term]) given (ctx: Context): Apply = - withDefaultPos(implicit ctx => tpd.applyOverloaded(qualifier, name.toTermName, args, targs, Types.WildcardType).asInstanceOf[Apply]) + withDefaultPos(tpd.applyOverloaded(qualifier, name.toTermName, args, targs, Types.WildcardType).asInstanceOf[Apply]) def Select_copy(original: Tree)(qualifier: Term, name: String) given (ctx: Context): Select = tpd.cpy.Select(original)(qualifier, name.toTermName) @@ -312,7 +312,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Literal_constant(self: Literal) given (ctx: Context): Constant = self.const def Literal_apply(constant: Constant) given (ctx: Context): Literal = - withDefaultPos(ctx => tpd.Literal(constant)(ctx)) + withDefaultPos(tpd.Literal(constant)) def Literal_copy(original: Tree)(constant: Constant) given (ctx: Context): Literal = tpd.cpy.Literal(original)(constant) @@ -327,7 +327,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def This_id(self: This) given (ctx: Context): Option[Id] = optional(self.qual) def This_apply(cls: ClassDefSymbol) given (ctx: Context): This = - withDefaultPos(ctx => tpd.This(cls)(ctx)) + withDefaultPos(tpd.This(cls)) def This_copy(original: Tree)(qual: Option[Id]) given (ctx: Context): This = tpd.cpy.This(original)(qual.getOrElse(untpd.EmptyTypeIdent)) @@ -341,7 +341,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def New_tpt(self: New) given (ctx: Context): TypeTree = self.tpt - def New_apply(tpt: TypeTree) given (ctx: Context): New = withDefaultPos(ctx => tpd.New(tpt)(ctx)) + def New_apply(tpt: TypeTree) given (ctx: Context): New = withDefaultPos(tpd.New(tpt)) def New_copy(original: Tree)(tpt: TypeTree) given (ctx: Context): New = tpd.cpy.New(original)(tpt) @@ -357,7 +357,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def NamedArg_value(self: NamedArg) given (ctx: Context): Term = self.arg def NamedArg_apply(name: String, arg: Term) given (ctx: Context): NamedArg = - withDefaultPos(ctx => tpd.NamedArg(name.toTermName, arg)(ctx)) + withDefaultPos(tpd.NamedArg(name.toTermName, arg)) def NamedArg_copy(tree: NamedArg)(name: String, arg: Term) given (ctx: Context): NamedArg = tpd.cpy.NamedArg(tree)(name.toTermName, arg) @@ -374,7 +374,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Apply_apply(fn: Term, args: List[Term]) given (ctx: Context): Apply = - withDefaultPos(ctx => tpd.Apply(fn, args)(ctx)) + withDefaultPos(tpd.Apply(fn, args)) def Apply_copy(original: Tree)(fun: Term, args: List[Term]) given (ctx: Context): Apply = tpd.cpy.Apply(original)(fun, args) @@ -390,7 +390,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def TypeApply_args(self: TypeApply) given (ctx: Context): List[TypeTree] = self.args def TypeApply_apply(fn: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = - withDefaultPos(ctx => tpd.TypeApply(fn, args)(ctx)) + withDefaultPos(tpd.TypeApply(fn, args)) def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = tpd.cpy.TypeApply(original)(fun, args) @@ -406,7 +406,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Super_id(self: Super) given (ctx: Context): Option[Id] = optional(self.mix) def Super_apply(qual: Term, mix: Option[Id]) given (ctx: Context): Super = - withDefaultPos(ctx => tpd.Super(qual, mix.getOrElse(untpd.EmptyTypeIdent), false, NoSymbol)(ctx)) + withDefaultPos(tpd.Super(qual, mix.getOrElse(untpd.EmptyTypeIdent), false, NoSymbol)) def Super_copy(original: Tree)(qual: Term, mix: Option[Id]) given (ctx: Context): Super = tpd.cpy.Super(original)(qual, mix.getOrElse(untpd.EmptyTypeIdent)) @@ -422,7 +422,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Typed_tpt(self: Typed) given (ctx: Context): TypeTree = self.tpt def Typed_apply(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = - withDefaultPos(ctx => tpd.Typed(expr, tpt)(ctx)) + withDefaultPos(tpd.Typed(expr, tpt)) def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = tpd.cpy.Typed(original)(expr, tpt) @@ -438,7 +438,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Assign_rhs(self: Assign) given (ctx: Context): Term = self.rhs def Assign_apply(lhs: Term, rhs: Term) given (ctx: Context): Assign = - withDefaultPos(ctx => tpd.Assign(lhs, rhs)(ctx)) + withDefaultPos(tpd.Assign(lhs, rhs)) def Assign_copy(original: Tree)(lhs: Term, rhs: Term) given (ctx: Context): Assign = tpd.cpy.Assign(original)(lhs, rhs) @@ -483,7 +483,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Block_expr(self: Block) given (ctx: Context): Term = self.expr def Block_apply(stats: List[Statement], expr: Term) given (ctx: Context): Block = - withDefaultPos(ctx => tpd.Block(stats, expr)(ctx)) + withDefaultPos(tpd.Block(stats, expr)) def Block_copy(original: Tree)(stats: List[Statement], expr: Term) given (ctx: Context): Block = tpd.cpy.Block(original)(stats, expr) @@ -500,7 +500,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Inlined_body(self: Inlined) given (ctx: Context): Term = self.expansion def Inlined_apply(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = - withDefaultPos(ctx => tpd.Inlined(call.getOrElse(tpd.EmptyTree), bindings.map { case b: tpd.MemberDef => b }, expansion)(ctx)) + withDefaultPos(tpd.Inlined(call.getOrElse(tpd.EmptyTree), bindings.map { case b: tpd.MemberDef => b }, expansion)) def Inlined_copy(original: Tree)(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = tpd.cpy.Inlined(original)(call.getOrElse(tpd.EmptyTree), bindings.asInstanceOf[List[tpd.MemberDef]], expansion) @@ -516,7 +516,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Closure_tpeOpt(self: Closure) given (ctx: Context): Option[Type] = optional(self.tpt).map(_.tpe) def Closure_apply(meth: Term, tpe: Option[Type]) given (ctx: Context): Closure = - withDefaultPos(ctx => tpd.Closure(Nil, meth, tpe.map(tpd.TypeTree(_)).getOrElse(tpd.EmptyTree))(ctx)) + withDefaultPos(tpd.Closure(Nil, meth, tpe.map(tpd.TypeTree(_)).getOrElse(tpd.EmptyTree))) def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type]) given (ctx: Context): Closure = tpd.cpy.Closure(original)(Nil, meth, tpe.map(tpd.TypeTree(_)).getOrElse(tpd.EmptyTree)) @@ -533,7 +533,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def If_elsep(self: If) given (ctx: Context): Term = self.elsep def If_apply(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = - withDefaultPos(ctx => tpd.If(cond, thenp, elsep)(ctx)) + withDefaultPos(tpd.If(cond, thenp, elsep)) def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = tpd.cpy.If(original)(cond, thenp, elsep) @@ -549,7 +549,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Match_cases(self: Match) given (ctx: Context): List[CaseDef] = self.cases def Match_apply(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = - withDefaultPos(ctx => tpd.Match(selector, cases)(ctx)) + withDefaultPos(tpd.Match(selector, cases)) def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = tpd.cpy.Match(original)(selector, cases) @@ -564,7 +564,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def ImplicitMatch_cases(self: Match) given (ctx: Context): List[CaseDef] = self.cases def ImplicitMatch_apply(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = - withDefaultPos(ctx => tpd.Match(tpd.EmptyTree, cases)(ctx)) + withDefaultPos(tpd.Match(tpd.EmptyTree, cases)) def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = tpd.cpy.Match(original)(tpd.EmptyTree, cases) @@ -581,7 +581,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Try_finalizer(self: Try) given (ctx: Context): Option[Term] = optional(self.finalizer) def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try = - withDefaultPos(ctx => tpd.Try(expr, cases, finalizer.getOrElse(tpd.EmptyTree))(ctx)) + withDefaultPos(tpd.Try(expr, cases, finalizer.getOrElse(tpd.EmptyTree))) def Try_copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try = tpd.cpy.Try(original)(expr, cases, finalizer.getOrElse(tpd.EmptyTree)) @@ -596,7 +596,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Return_expr(self: Return) given (ctx: Context): Term = self.expr def Return_apply(expr: Term) given (ctx: Context): Return = - withDefaultPos(ctx => tpd.Return(expr, ctx.owner)(ctx)) + withDefaultPos(tpd.Return(expr, ctx.owner)) def Return_copy(original: Tree)(expr: Term) given (ctx: Context): Return = tpd.cpy.Return(original)(expr, tpd.ref(ctx.owner)) @@ -612,7 +612,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Repeated_elemtpt(self: Repeated) given (ctx: Context): TypeTree = self.elemtpt def Repeated_apply(elems: List[Term], elemtpt: TypeTree) given (ctx: Context): Repeated = - withDefaultPos(ctx => tpd.SeqLiteral(elems, elemtpt)(ctx)) + withDefaultPos(tpd.SeqLiteral(elems, elemtpt)) def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree) given (ctx: Context): Repeated = tpd.cpy.SeqLiteral(original)(elems, elemtpt) @@ -636,7 +636,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def SelectOuter_tpe(self: SelectOuter) given (ctx: Context): Type = self.tpe.stripTypeVar def SelectOuter_apply(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = - withDefaultPos(ctx => tpd.Select(qualifier, NameKinds.OuterSelectName(name.toTermName, levels))(ctx)) + withDefaultPos(tpd.Select(qualifier, NameKinds.OuterSelectName(name.toTermName, levels))) def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = tpd.cpy.Select(original)(qualifier, NameKinds.OuterSelectName(name.toTermName, levels)) @@ -652,7 +652,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def While_body(self: While) given (ctx: Context): Term = self.body def While_apply(cond: Term, body: Term) given (ctx: Context): While = - withDefaultPos(ctx => tpd.WhileDo(cond, body)(ctx)) + withDefaultPos(tpd.WhileDo(cond, body)) def While_copy(original: Tree)(cond: Term, body: Term) given (ctx: Context): While = tpd.cpy.WhileDo(original)(cond, body) @@ -675,7 +675,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def Inferred_apply(tpe: Type) given (ctx: Context): Inferred = withDefaultPos(ctx => tpd.TypeTree(tpe)(ctx)) + def Inferred_apply(tpe: Type) given (ctx: Context): Inferred = withDefaultPos(tpd.TypeTree(tpe)) type TypeIdent = tpd.Ident @@ -700,7 +700,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def TypeSelect_name(self: TypeSelect) given (ctx: Context): String = self.name.toString def TypeSelect_apply(qualifier: Term, name: String) given (ctx: Context): TypeSelect = - withDefaultPos(ctx => tpd.Select(qualifier, name.toTypeName)(ctx)) + withDefaultPos(tpd.Select(qualifier, name.toTypeName)) def TypeSelect_copy(original: TypeSelect)(qualifier: Term, name: String) given (ctx: Context): TypeSelect = tpd.cpy.Select(original)(qualifier, name.toTypeName) @@ -729,7 +729,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Singleton_ref(self: Singleton) given (ctx: Context): Term = self.ref def Singleton_apply(ref: Term) given (ctx: Context): Singleton = - withDefaultPos(ctx => tpd.SingletonTypeTree(ref)(ctx)) + withDefaultPos(tpd.SingletonTypeTree(ref)) def Singleton_copy(original: Singleton)(ref: Term) given (ctx: Context): Singleton = tpd.cpy.SingletonTypeTree(original)(ref) @@ -758,7 +758,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Applied_args(self: Applied) given (ctx: Context): List[TypeTree | TypeBoundsTree] = self.args def Applied_apply(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree]) given (ctx: Context): Applied = - withDefaultPos(ctx => tpd.AppliedTypeTree(tpt, args)(ctx)) + withDefaultPos(tpd.AppliedTypeTree(tpt, args)) def Applied_copy(original: Applied)(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree]) given (ctx: Context): Applied = tpd.cpy.AppliedTypeTree(original)(tpt, args) @@ -774,7 +774,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Annotated_annotation(self: Annotated) given (ctx: Context): Term = self.annot def Annotated_apply(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = - withDefaultPos(ctx => tpd.Annotated(arg, annotation)(ctx)) + withDefaultPos(tpd.Annotated(arg, annotation)) def Annotated_copy(original: Annotated)(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = tpd.cpy.Annotated(original)(arg, annotation) @@ -791,7 +791,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def MatchTypeTree_cases(self: MatchTypeTree) given (ctx: Context): List[CaseDef] = self.cases def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree = - withDefaultPos(ctx => tpd.MatchTypeTree(bound.getOrElse(tpd.EmptyTree), selector, cases)(ctx)) + withDefaultPos(tpd.MatchTypeTree(bound.getOrElse(tpd.EmptyTree), selector, cases)) def MatchTypeTree_copy(original: MatchTypeTree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree = tpd.cpy.MatchTypeTree(original)(bound.getOrElse(tpd.EmptyTree), selector, cases) @@ -806,7 +806,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def ByName_result(self: ByName) given (ctx: Context): TypeTree = self.result def ByName_apply(result: TypeTree) given (ctx: Context): ByName = - withDefaultPos(ctx => tpd.ByNameTypeTree(result)(ctx)) + withDefaultPos(tpd.ByNameTypeTree(result)) def ByName_copy(original: ByName)(result: TypeTree) given (ctx: Context): ByName = tpd.cpy.ByNameTypeTree(original)(result) @@ -822,7 +822,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Lambdabody(self: LambdaTypeTree) given (ctx: Context): TypeTree | TypeBoundsTree = self.body def Lambdaapply(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree) given (ctx: Context): LambdaTypeTree = - withDefaultPos(ctx => tpd.LambdaTypeTree(tparams, body)(ctx)) + withDefaultPos(tpd.LambdaTypeTree(tparams, body)) def Lambdacopy(original: LambdaTypeTree)(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree) given (ctx: Context): LambdaTypeTree = tpd.cpy.LambdaTypeTree(original)(tparams, body) @@ -851,7 +851,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def TypeBlock_tpt(self: TypeBlock) given (ctx: Context): TypeTree = self.expr def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = - withDefaultPos(ctx => tpd.Block(aliases, tpt)(ctx)) + withDefaultPos(tpd.Block(aliases, tpt)) def TypeBlock_copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = tpd.cpy.Block(original)(aliases, tpt) @@ -960,7 +960,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Pattern_Bind_pattern(self: Bind) given (ctx: Context): Pattern = self.body def Pattern_Bind_module_copy(original: Bind)(name: String, pattern: Pattern) given (ctx: Context): Bind = - withDefaultPos(ctx => tpd.cpy.Bind(original)(name.toTermName, pattern)(ctx)) + withDefaultPos(tpd.cpy.Bind(original)(name.toTermName, pattern)) type Unapply = tpd.UnApply @@ -975,7 +975,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Pattern_Unapply_patterns(self: Unapply) given (ctx: Context): List[Pattern] = effectivePatterns(self.patterns) def Pattern_Unapply_module_copy(original: Unapply)(fun: Term, implicits: List[Term], patterns: List[Pattern]) given (ctx: Context): Unapply = - withDefaultPos(ctx => tpd.cpy.UnApply(original)(fun, implicits, patterns)(ctx)) + withDefaultPos(tpd.cpy.UnApply(original)(fun, implicits, patterns)) private def effectivePatterns(patterns: List[Pattern]): List[Pattern] = patterns match { case patterns0 :+ Trees.SeqLiteral(elems, _) => patterns0 ::: elems @@ -992,7 +992,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Pattern_Alternatives_patterns(self: Alternatives) given (ctx: Context): List[Pattern] = self.trees def Pattern_Alternatives_module_apply(patterns: List[Pattern]) given (ctx: Context): Alternatives = - withDefaultPos(ctx => tpd.Alternative(patterns)(ctx)) + withDefaultPos(tpd.Alternative(patterns)) def Pattern_Alternatives_module_copy(original: Alternatives)(patterns: List[Pattern]) given (ctx: Context): Alternatives = tpd.cpy.Alternative(original)(patterns) @@ -1008,7 +1008,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. def Pattern_TypeTest_tpt(self: TypeTest) given (ctx: Context): TypeTree = self.tpt def Pattern_TypeTest_module_apply(tpt: TypeTree) given (ctx: Context): TypeTest = - withDefaultPos(ctx => tpd.Typed(untpd.Ident(nme.WILDCARD)(ctx.source).withType(tpt.tpe)(ctx), tpt)(ctx)) + withDefaultPos(tpd.Typed(untpd.Ident(nme.WILDCARD)(ctx.source).withType(tpt.tpe), tpt)) def Pattern_TypeTest_module_copy(original: TypeTest)(tpt: TypeTree) given (ctx: Context): TypeTest = tpd.cpy.Typed(original)(untpd.Ident(nme.WILDCARD).withSpan(original.span).withType(tpt.tpe), tpt) @@ -1898,7 +1898,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. private def optional[T <: Trees.Tree[_]](tree: T): Option[tree.type] = if (tree.isEmpty) None else Some(tree) - private def withDefaultPos[T <: Tree](fn: Context => T) given (ctx: Context): T = { - fn(ctx.withSource(rootPosition.source)).withSpan(rootPosition.span) - } + private def withDefaultPos[T <: Tree](fn: given Context => T) given (ctx: Context): T = + (fn given ctx.withSource(rootPosition.source)).withSpan(rootPosition.span) + } From 9b5b361be4ffa059222d042dda05e11a86fb3cbb Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Sun, 28 Jul 2019 11:31:06 +0200 Subject: [PATCH 3/3] Use shorter syntax --- .../tools/dotc/tastyreflect/KernelImpl.scala | 816 +++++++++--------- 1 file changed, 408 insertions(+), 408 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala index addceb1c9831..bbb49d505b1a 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/KernelImpl.scala @@ -93,359 +93,359 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Tree = tpd.Tree - def Tree_pos(self: Tree) given (ctx: Context): Position = self.sourcePos - def Tree_symbol(self: Tree) given (ctx: Context): Symbol = self.symbol + def Tree_pos(self: Tree) given Context: Position = self.sourcePos + def Tree_symbol(self: Tree) given Context: Symbol = self.symbol type PackageClause = tpd.PackageDef - def matchPackageClause(tree: Tree) given (ctx: Context): Option[PackageClause] = tree match { + def matchPackageClause(tree: Tree) given Context: Option[PackageClause] = tree match { case x: tpd.PackageDef => Some(x) case _ => None } - def PackageClause_pid(self: PackageClause) given (ctx: Context): Ref = self.pid - def PackageClause_stats(self: PackageClause) given (ctx: Context): List[Tree] = self.stats + def PackageClause_pid(self: PackageClause) given Context: Ref = self.pid + def PackageClause_stats(self: PackageClause) given Context: List[Tree] = self.stats - def PackageClause_apply(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = + def PackageClause_apply(pid: Ref, stats: List[Tree]) given Context: PackageClause = withDefaultPos(tpd.PackageDef(pid.asInstanceOf[tpd.RefTree], stats)) - def PackageClause_copy(original: PackageClause)(pid: Ref, stats: List[Tree]) given (ctx: Context): PackageClause = + def PackageClause_copy(original: PackageClause)(pid: Ref, stats: List[Tree]) given Context: PackageClause = tpd.cpy.PackageDef(original)(pid, stats) type Statement = tpd.Tree - def matchStatement(tree: Tree) given (ctx: Context): Option[Statement] = tree match { + def matchStatement(tree: Tree) given Context: Option[Statement] = tree match { case tree if tree.isTerm => Some(tree) case _ => matchDefinition(tree) } type Import = tpd.Import - def matchImport(tree: Tree) given (ctx: Context): Option[Import] = tree match { + def matchImport(tree: Tree) given Context: Option[Import] = tree match { case tree: tpd.Import => Some(tree) case _ => None } def Import_implied(self: Import): Boolean = self.importGiven - def Import_expr(self: Import) given (ctx: Context): Tree = self.expr - def Import_selectors(self: Import) given (ctx: Context): List[ImportSelector] = self.selectors + def Import_expr(self: Import) given Context: Tree = self.expr + def Import_selectors(self: Import) given Context: List[ImportSelector] = self.selectors - def Import_apply(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import = + def Import_apply(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given Context: Import = withDefaultPos(tpd.Import(importImplied, expr, selectors)) - def Import_copy(original: Import)(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given (ctx: Context): Import = + def Import_copy(original: Import)(importImplied: Boolean, expr: Term, selectors: List[ImportSelector]) given Context: Import = tpd.cpy.Import(original)(importImplied, expr, selectors) type Definition = tpd.Tree - def matchDefinition(tree: Tree) given (ctx: Context): Option[Definition] = tree match { + def matchDefinition(tree: Tree) given Context: Option[Definition] = tree match { case tree: tpd.MemberDef => Some(tree) case tree: PackageDefinition => Some(tree) case _ => None } - def Definition_name(self: Definition) given (ctx: Context): String = self match { + def Definition_name(self: Definition) given Context: String = self match { case self: tpd.MemberDef => self.name.toString case self: PackageDefinition => self.symbol.name.toString // TODO make PackageDefinition a MemberDef or NameTree } type PackageDef = PackageDefinition - def matchPackageDef(tree: Tree) given (ctx: Context): Option[PackageDef] = tree match { + def matchPackageDef(tree: Tree) given Context: Option[PackageDef] = tree match { case x: PackageDefinition => Some(x) case _ => None } - def PackageDef_owner(self: PackageDef) given (ctx: Context): PackageDef = packageDefFromSym(self.symbol.owner) + def PackageDef_owner(self: PackageDef) given Context: PackageDef = packageDefFromSym(self.symbol.owner) - def PackageDef_members(self: PackageDef) given (ctx: Context): List[Statement] = { + def PackageDef_members(self: PackageDef) given Context: List[Statement] = { if (self.symbol.is(core.Flags.JavaDefined)) Nil // FIXME should also support java packages else self.symbol.info.decls.iterator.map(definitionFromSym).toList } - def PackageDef_symbol(self: PackageDef) given (ctx: Context): PackageDefSymbol = self.symbol + def PackageDef_symbol(self: PackageDef) given Context: PackageDefSymbol = self.symbol type ClassDef = tpd.TypeDef - def matchClassDef(tree: Tree) given (ctx: Context): Option[ClassDef] = tree match { + def matchClassDef(tree: Tree) given Context: Option[ClassDef] = tree match { case x: tpd.TypeDef if x.isClassDef => Some(x) case _ => None } - def ClassDef_constructor(self: ClassDef) given (ctx: Context): DefDef = ClassDef_rhs(self).constr - def ClassDef_parents(self: ClassDef) given (ctx: Context): List[Term | TypeTree] = ClassDef_rhs(self).parents - def ClassDef_derived(self: ClassDef) given (ctx: Context): List[TypeTree] = ClassDef_rhs(self).derived.asInstanceOf[List[TypeTree]] - def ClassDef_self(self: ClassDef) given (ctx: Context): Option[ValDef] = optional(ClassDef_rhs(self).self) - def ClassDef_body(self: ClassDef) given (ctx: Context): List[Statement] = ClassDef_rhs(self).body - def ClassDef_symbol(self: ClassDef) given (ctx: Context): ClassDefSymbol = self.symbol.asClass + def ClassDef_constructor(self: ClassDef) given Context: DefDef = ClassDef_rhs(self).constr + def ClassDef_parents(self: ClassDef) given Context: List[Term | TypeTree] = ClassDef_rhs(self).parents + def ClassDef_derived(self: ClassDef) given Context: List[TypeTree] = ClassDef_rhs(self).derived.asInstanceOf[List[TypeTree]] + def ClassDef_self(self: ClassDef) given Context: Option[ValDef] = optional(ClassDef_rhs(self).self) + def ClassDef_body(self: ClassDef) given Context: List[Statement] = ClassDef_rhs(self).body + def ClassDef_symbol(self: ClassDef) given Context: ClassDefSymbol = self.symbol.asClass private def ClassDef_rhs(self: ClassDef) = self.rhs.asInstanceOf[tpd.Template] - def ClassDef_copy(original: ClassDef)(name: String, constr: DefDef, parents: List[Term | TypeTree], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement]) given (ctx: Context): ClassDef = { + def ClassDef_copy(original: ClassDef)(name: String, constr: DefDef, parents: List[Term | TypeTree], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement]) given Context: ClassDef = { val Trees.TypeDef(_, originalImpl: tpd.Template) = original tpd.cpy.TypeDef(original)(name.toTypeName, tpd.cpy.Template(originalImpl)(constr, parents, derived, selfOpt.getOrElse(tpd.EmptyValDef), body)) } type TypeDef = tpd.TypeDef - def matchTypeDef(tree: Tree) given (ctx: Context): Option[TypeDef] = tree match { + def matchTypeDef(tree: Tree) given Context: Option[TypeDef] = tree match { case x: tpd.TypeDef if !x.symbol.isClass => Some(x) case _ => None } - def TypeDef_rhs(self: TypeDef) given (ctx: Context): TypeTree | TypeBoundsTree = self.rhs - def TypeDef_symbol(self: TypeDef) given (ctx: Context): TypeDefSymbol = self.symbol.asType + def TypeDef_rhs(self: TypeDef) given Context: TypeTree | TypeBoundsTree = self.rhs + def TypeDef_symbol(self: TypeDef) given Context: TypeDefSymbol = self.symbol.asType - def TypeDef_apply(symbol: TypeDefSymbol) given (ctx: Context): TypeDef = withDefaultPos(tpd.TypeDef(symbol)) - def TypeDef_copy(original: TypeDef)(name: String, rhs: TypeTree | TypeBoundsTree) given (ctx: Context): TypeDef = + def TypeDef_apply(symbol: TypeDefSymbol) given Context: TypeDef = withDefaultPos(tpd.TypeDef(symbol)) + def TypeDef_copy(original: TypeDef)(name: String, rhs: TypeTree | TypeBoundsTree) given Context: TypeDef = tpd.cpy.TypeDef(original)(name.toTypeName, rhs) type DefDef = tpd.DefDef - def matchDefDef(tree: Tree) given (ctx: Context): Option[DefDef] = tree match { + def matchDefDef(tree: Tree) given Context: Option[DefDef] = tree match { case x: tpd.DefDef => Some(x) case _ => None } - def DefDef_typeParams(self: DefDef) given (ctx: Context): List[TypeDef] = self.tparams - def DefDef_paramss(self: DefDef) given (ctx: Context): List[List[ValDef]] = self.vparamss - def DefDef_returnTpt(self: DefDef) given (ctx: Context): TypeTree = self.tpt - def DefDef_rhs(self: DefDef) given (ctx: Context): Option[Tree] = optional(self.rhs) - def DefDef_symbol(self: DefDef) given (ctx: Context): DefDefSymbol = self.symbol.asTerm + def DefDef_typeParams(self: DefDef) given Context: List[TypeDef] = self.tparams + def DefDef_paramss(self: DefDef) given Context: List[List[ValDef]] = self.vparamss + def DefDef_returnTpt(self: DefDef) given Context: TypeTree = self.tpt + def DefDef_rhs(self: DefDef) given Context: Option[Tree] = optional(self.rhs) + def DefDef_symbol(self: DefDef) given Context: DefDefSymbol = self.symbol.asTerm - def DefDef_apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term]) given (ctx: Context): DefDef = + def DefDef_apply(symbol: DefDefSymbol, rhsFn: List[Type] => List[List[Term]] => Option[Term]) given Context: DefDef = withDefaultPos(tpd.polyDefDef(symbol, tparams => vparamss => rhsFn(tparams)(vparamss).getOrElse(tpd.EmptyTree))) - def DefDef_copy(original: DefDef)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: 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 Context: DefDef = tpd.cpy.DefDef(original)(name.toTermName, typeParams, paramss, tpt, rhs.getOrElse(tpd.EmptyTree)) type ValDef = tpd.ValDef - def matchValDef(tree: Tree) given (ctx: Context): Option[ValDef] = tree match { + def matchValDef(tree: Tree) given Context: Option[ValDef] = tree match { case x: tpd.ValDef => Some(x) case _ => None } - def ValDef_tpt(self: ValDef) given (ctx: Context): TypeTree = self.tpt - def ValDef_rhs(self: ValDef) given (ctx: Context): Option[Tree] = optional(self.rhs) - def ValDef_symbol(self: ValDef) given (ctx: Context): ValDefSymbol = self.symbol.asTerm + def ValDef_tpt(self: ValDef) given Context: TypeTree = self.tpt + def ValDef_rhs(self: ValDef) given Context: Option[Tree] = optional(self.rhs) + def ValDef_symbol(self: ValDef) given Context: ValDefSymbol = self.symbol.asTerm - def ValDef_apply(symbol: ValDefSymbol, rhs: Option[Term]) given (ctx: Context): ValDef = + def ValDef_apply(symbol: ValDefSymbol, rhs: Option[Term]) given Context: ValDef = tpd.ValDef(symbol, rhs.getOrElse(tpd.EmptyTree)) - def ValDef_copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term]) given (ctx: Context): ValDef = + def ValDef_copy(original: ValDef)(name: String, tpt: TypeTree, rhs: Option[Term]) given Context: ValDef = tpd.cpy.ValDef(original)(name.toTermName, tpt, rhs.getOrElse(tpd.EmptyTree)) type Term = tpd.Tree - def matchTerm(tree: Tree) given (ctx: Context): Option[Term] = tree match { + def matchTerm(tree: Tree) given Context: Option[Term] = tree match { case x: tpd.SeqLiteral => Some(tree) case _ if tree.isTerm => Some(tree) case _ => None } - def Term_pos(self: Term) given (ctx: Context): Position = self.sourcePos - def Term_tpe(self: Term) given (ctx: Context): Type = self.tpe - def Term_underlyingArgument(self: Term) given (ctx: Context): Term = self.underlyingArgument - def Term_underlying(self: Term) given (ctx: Context): Term = self.underlying + def Term_pos(self: Term) given Context: Position = self.sourcePos + def Term_tpe(self: Term) given Context: Type = self.tpe + def Term_underlyingArgument(self: Term) given Context: Term = self.underlyingArgument + def Term_underlying(self: Term) given Context: Term = self.underlying type Ref = tpd.RefTree - def matchRef(tree: Tree) given (ctx: Context): Option[Ref] = tree match { + def matchRef(tree: Tree) given Context: Option[Ref] = tree match { case x: tpd.RefTree if x.isTerm => Some(x) case _ => None } - def Ref_apply(sym: Symbol) given (ctx: Context): Ref = + def Ref_apply(sym: Symbol) given Context: Ref = withDefaultPos(tpd.ref(sym).asInstanceOf[tpd.RefTree]) type Ident = tpd.Ident - def matchIdent(x: Term) given (ctx: Context): Option[Ident] = x match { + def matchIdent(x: Term) given Context: Option[Ident] = x match { case x: tpd.Ident if x.isTerm => Some(x) case _ => None } - def Ident_name(self: Ident) given (ctx: Context): String = self.name.show + def Ident_name(self: Ident) given Context: String = self.name.show - def Ident_apply(tmref: TermRef) given (ctx: Context): Term = + def Ident_apply(tmref: TermRef) given Context: Term = withDefaultPos(tpd.ref(tmref).asInstanceOf[Term]) - def Ident_copy(original: Tree)(name: String) given (ctx: Context): Ident = + def Ident_copy(original: Tree)(name: String) given Context: Ident = tpd.cpy.Ident(original)(name.toTermName) type Select = tpd.Select - def matchSelect(x: Term) given (ctx: Context): Option[Select] = x match { + def matchSelect(x: Term) given Context: Option[Select] = x match { case x: tpd.Select if x.isTerm => Some(x) case _ => None } - def Select_qualifier(self: Select) given (ctx: Context): Term = self.qualifier - def Select_name(self: Select) given (ctx: Context): String = self.name.toString - def Select_signature(self: Select) given (ctx: Context): Option[Signature] = + def Select_qualifier(self: Select) given Context: Term = self.qualifier + def Select_name(self: Select) given Context: String = self.name.toString + def Select_signature(self: Select) given Context: Option[Signature] = if (self.symbol.signature == core.Signature.NotAMethod) None else Some(self.symbol.signature) - def Select_apply(qualifier: Term, symbol: Symbol) given (ctx: Context): Select = + def Select_apply(qualifier: Term, symbol: Symbol) given Context: Select = withDefaultPos(tpd.Select(qualifier, Types.TermRef(qualifier.tpe, symbol))) - def Select_unique(qualifier: Term, name: String) given (ctx: Context): Select = { + def Select_unique(qualifier: Term, name: String) given Context: Select = { val denot = qualifier.tpe.member(name.toTermName) assert(!denot.isOverloaded, s"The symbol `$name` is overloaded. The method Select.unique can only be used for non-overloaded symbols.") withDefaultPos(tpd.Select(qualifier, name.toTermName)) } // TODO rename, this returns an Apply and not a Select - def Select_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term]) given (ctx: Context): Apply = + def Select_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term]) given Context: Apply = withDefaultPos(tpd.applyOverloaded(qualifier, name.toTermName, args, targs, Types.WildcardType).asInstanceOf[Apply]) - def Select_copy(original: Tree)(qualifier: Term, name: String) given (ctx: Context): Select = + def Select_copy(original: Tree)(qualifier: Term, name: String) given Context: Select = tpd.cpy.Select(original)(qualifier, name.toTermName) type Literal = tpd.Literal - def matchLiteral(x: Term) given (ctx: Context): Option[Literal] = x match { + def matchLiteral(x: Term) given Context: Option[Literal] = x match { case x: tpd.Literal => Some(x) case _ => None } - def Literal_constant(self: Literal) given (ctx: Context): Constant = self.const + def Literal_constant(self: Literal) given Context: Constant = self.const - def Literal_apply(constant: Constant) given (ctx: Context): Literal = + def Literal_apply(constant: Constant) given Context: Literal = withDefaultPos(tpd.Literal(constant)) - def Literal_copy(original: Tree)(constant: Constant) given (ctx: Context): Literal = + def Literal_copy(original: Tree)(constant: Constant) given Context: Literal = tpd.cpy.Literal(original)(constant) type This = tpd.This - def matchThis(x: Term) given (ctx: Context): Option[This] = x match { + def matchThis(x: Term) given Context: Option[This] = x match { case x: tpd.This => Some(x) case _ => None } - def This_id(self: This) given (ctx: Context): Option[Id] = optional(self.qual) + def This_id(self: This) given Context: Option[Id] = optional(self.qual) - def This_apply(cls: ClassDefSymbol) given (ctx: Context): This = + def This_apply(cls: ClassDefSymbol) given Context: This = withDefaultPos(tpd.This(cls)) - def This_copy(original: Tree)(qual: Option[Id]) given (ctx: Context): This = + def This_copy(original: Tree)(qual: Option[Id]) given Context: This = tpd.cpy.This(original)(qual.getOrElse(untpd.EmptyTypeIdent)) type New = tpd.New - def matchNew(x: Term) given (ctx: Context): Option[New] = x match { + def matchNew(x: Term) given Context: Option[New] = x match { case x: tpd.New => Some(x) case _ => None } - def New_tpt(self: New) given (ctx: Context): TypeTree = self.tpt + def New_tpt(self: New) given Context: TypeTree = self.tpt - def New_apply(tpt: TypeTree) given (ctx: Context): New = withDefaultPos(tpd.New(tpt)) + def New_apply(tpt: TypeTree) given Context: New = withDefaultPos(tpd.New(tpt)) - def New_copy(original: Tree)(tpt: TypeTree) given (ctx: Context): New = + def New_copy(original: Tree)(tpt: TypeTree) given Context: New = tpd.cpy.New(original)(tpt) type NamedArg = tpd.NamedArg - def matchNamedArg(x: Term) given (ctx: Context): Option[NamedArg] = x match { + def matchNamedArg(x: Term) given Context: Option[NamedArg] = x match { case x: tpd.NamedArg if x.name.isInstanceOf[core.Names.TermName] => Some(x) // TODO: Now, the name should alwas be a term name case _ => None } - def NamedArg_name(self: NamedArg) given (ctx: Context): String = self.name.toString - def NamedArg_value(self: NamedArg) given (ctx: Context): Term = self.arg + def NamedArg_name(self: NamedArg) given Context: String = self.name.toString + def NamedArg_value(self: NamedArg) given Context: Term = self.arg - def NamedArg_apply(name: String, arg: Term) given (ctx: Context): NamedArg = + def NamedArg_apply(name: String, arg: Term) given Context: NamedArg = withDefaultPos(tpd.NamedArg(name.toTermName, arg)) - def NamedArg_copy(tree: NamedArg)(name: String, arg: Term) given (ctx: Context): NamedArg = + def NamedArg_copy(tree: NamedArg)(name: String, arg: Term) given Context: NamedArg = tpd.cpy.NamedArg(tree)(name.toTermName, arg) type Apply = tpd.Apply - def matchApply(x: Term) given (ctx: Context): Option[Apply] = x match { + def matchApply(x: Term) given Context: Option[Apply] = x match { case x: tpd.Apply => Some(x) case _ => None } - def Apply_fun(self: Apply) given (ctx: Context): Term = self.fun - def Apply_args(self: Apply) given (ctx: Context): List[Term] = self.args + def Apply_fun(self: Apply) given Context: Term = self.fun + def Apply_args(self: Apply) given Context: List[Term] = self.args - def Apply_apply(fn: Term, args: List[Term]) given (ctx: Context): Apply = + def Apply_apply(fn: Term, args: List[Term]) given Context: Apply = withDefaultPos(tpd.Apply(fn, args)) - def Apply_copy(original: Tree)(fun: Term, args: List[Term]) given (ctx: Context): Apply = + def Apply_copy(original: Tree)(fun: Term, args: List[Term]) given Context: Apply = tpd.cpy.Apply(original)(fun, args) type TypeApply = tpd.TypeApply - def matchTypeApply(x: Term) given (ctx: Context): Option[TypeApply] = x match { + def matchTypeApply(x: Term) given Context: Option[TypeApply] = x match { case x: tpd.TypeApply => Some(x) case _ => None } - def TypeApply_fun(self: TypeApply) given (ctx: Context): Term = self.fun - def TypeApply_args(self: TypeApply) given (ctx: Context): List[TypeTree] = self.args + def TypeApply_fun(self: TypeApply) given Context: Term = self.fun + def TypeApply_args(self: TypeApply) given Context: List[TypeTree] = self.args - def TypeApply_apply(fn: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = + def TypeApply_apply(fn: Term, args: List[TypeTree]) given Context: TypeApply = withDefaultPos(tpd.TypeApply(fn, args)) - def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree]) given (ctx: Context): TypeApply = + def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree]) given Context: TypeApply = tpd.cpy.TypeApply(original)(fun, args) type Super = tpd.Super - def matchSuper(x: Term) given (ctx: Context): Option[Super] = x match { + def matchSuper(x: Term) given Context: Option[Super] = x match { case x: tpd.Super => Some(x) case _ => None } - def Super_qualifier(self: Super) given (ctx: Context): Term = self.qual - def Super_id(self: Super) given (ctx: Context): Option[Id] = optional(self.mix) + def Super_qualifier(self: Super) given Context: Term = self.qual + def Super_id(self: Super) given Context: Option[Id] = optional(self.mix) - def Super_apply(qual: Term, mix: Option[Id]) given (ctx: Context): Super = + def Super_apply(qual: Term, mix: Option[Id]) given Context: Super = withDefaultPos(tpd.Super(qual, mix.getOrElse(untpd.EmptyTypeIdent), false, NoSymbol)) - def Super_copy(original: Tree)(qual: Term, mix: Option[Id]) given (ctx: Context): Super = + def Super_copy(original: Tree)(qual: Term, mix: Option[Id]) given Context: Super = tpd.cpy.Super(original)(qual, mix.getOrElse(untpd.EmptyTypeIdent)) type Typed = tpd.Typed - def matchTyped(x: Term) given (ctx: Context): Option[Typed] = x match { + def matchTyped(x: Term) given Context: Option[Typed] = x match { case x: tpd.Typed => Some(x) case _ => None } - def Typed_expr(self: Typed) given (ctx: Context): Term = self.expr - def Typed_tpt(self: Typed) given (ctx: Context): TypeTree = self.tpt + def Typed_expr(self: Typed) given Context: Term = self.expr + def Typed_tpt(self: Typed) given Context: TypeTree = self.tpt - def Typed_apply(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = + def Typed_apply(expr: Term, tpt: TypeTree) given Context: Typed = withDefaultPos(tpd.Typed(expr, tpt)) - def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree) given (ctx: Context): Typed = + def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree) given Context: Typed = tpd.cpy.Typed(original)(expr, tpt) type Assign = tpd.Assign - def matchAssign(x: Term) given (ctx: Context): Option[Assign] = x match { + def matchAssign(x: Term) given Context: Option[Assign] = x match { case x: tpd.Assign => Some(x) case _ => None } - def Assign_lhs(self: Assign) given (ctx: Context): Term = self.lhs - def Assign_rhs(self: Assign) given (ctx: Context): Term = self.rhs + def Assign_lhs(self: Assign) given Context: Term = self.lhs + def Assign_rhs(self: Assign) given Context: Term = self.rhs - def Assign_apply(lhs: Term, rhs: Term) given (ctx: Context): Assign = + def Assign_apply(lhs: Term, rhs: Term) given Context: Assign = withDefaultPos(tpd.Assign(lhs, rhs)) - def Assign_copy(original: Tree)(lhs: Term, rhs: Term) given (ctx: Context): Assign = + def Assign_copy(original: Tree)(lhs: Term, rhs: Term) given Context: Assign = tpd.cpy.Assign(original)(lhs, rhs) type Block = tpd.Block - def matchBlock(x: Term) given (ctx: Context): Option[Block] = normalizedLoops(x) match { + def matchBlock(x: Term) given Context: Option[Block] = normalizedLoops(x) match { case x: tpd.Block => Some(x) case _ => None } @@ -454,7 +454,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. * i) Put `while` and `doWhile` loops in their own blocks: `{ def while$() = ...; while$() }` * ii) Put closures in their own blocks: `{ def anon$() = ...; closure(anon$, ...) }` */ - private def normalizedLoops(tree: tpd.Tree) given (ctx: Context): tpd.Tree = tree match { + private def normalizedLoops(tree: tpd.Tree) given Context: tpd.Tree = tree match { case block: tpd.Block if block.stats.size > 1 => def normalizeInnerLoops(stats: List[tpd.Tree]): List[tpd.Tree] = stats match { case (x: tpd.DefDef) :: y :: xs if needsNormalization(y) => @@ -474,126 +474,126 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } /** If it is the second statement of a closure. See: `normalizedLoops` */ - private def needsNormalization(tree: tpd.Tree) given (ctx: Context): Boolean = tree match { + private def needsNormalization(tree: tpd.Tree) given Context: Boolean = tree match { case _: tpd.Closure => true case _ => false } - def Block_statements(self: Block) given (ctx: Context): List[Statement] = self.stats - def Block_expr(self: Block) given (ctx: Context): Term = self.expr + def Block_statements(self: Block) given Context: List[Statement] = self.stats + def Block_expr(self: Block) given Context: Term = self.expr - def Block_apply(stats: List[Statement], expr: Term) given (ctx: Context): Block = + def Block_apply(stats: List[Statement], expr: Term) given Context: Block = withDefaultPos(tpd.Block(stats, expr)) - def Block_copy(original: Tree)(stats: List[Statement], expr: Term) given (ctx: Context): Block = + def Block_copy(original: Tree)(stats: List[Statement], expr: Term) given Context: Block = tpd.cpy.Block(original)(stats, expr) type Inlined = tpd.Inlined - def matchInlined(x: Term) given (ctx: Context): Option[Inlined] = x match { + def matchInlined(x: Term) given Context: Option[Inlined] = x match { case x: tpd.Inlined => Some(x) case _ => None } - def Inlined_call(self: Inlined) given (ctx: Context): Option[Term | TypeTree] = optional(self.call) - def Inlined_bindings(self: Inlined) given (ctx: Context): List[Definition] = self.bindings - def Inlined_body(self: Inlined) given (ctx: Context): Term = self.expansion + def Inlined_call(self: Inlined) given Context: Option[Term | TypeTree] = optional(self.call) + def Inlined_bindings(self: Inlined) given Context: List[Definition] = self.bindings + def Inlined_body(self: Inlined) given Context: Term = self.expansion - def Inlined_apply(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = + def Inlined_apply(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term) given Context: Inlined = withDefaultPos(tpd.Inlined(call.getOrElse(tpd.EmptyTree), bindings.map { case b: tpd.MemberDef => b }, expansion)) - def Inlined_copy(original: Tree)(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term) given (ctx: Context): Inlined = + def Inlined_copy(original: Tree)(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term) given Context: Inlined = tpd.cpy.Inlined(original)(call.getOrElse(tpd.EmptyTree), bindings.asInstanceOf[List[tpd.MemberDef]], expansion) type Closure = tpd.Closure - def matchClosure(x: Term) given (ctx: Context): Option[Closure] = x match { + def matchClosure(x: Term) given Context: Option[Closure] = x match { case x: tpd.Closure => Some(x) case _ => None } - def Closure_meth(self: Closure) given (ctx: Context): Term = self.meth - def Closure_tpeOpt(self: Closure) given (ctx: Context): Option[Type] = optional(self.tpt).map(_.tpe) + def Closure_meth(self: Closure) given Context: Term = self.meth + def Closure_tpeOpt(self: Closure) given Context: Option[Type] = optional(self.tpt).map(_.tpe) - def Closure_apply(meth: Term, tpe: Option[Type]) given (ctx: Context): Closure = + def Closure_apply(meth: Term, tpe: Option[Type]) given Context: Closure = withDefaultPos(tpd.Closure(Nil, meth, tpe.map(tpd.TypeTree(_)).getOrElse(tpd.EmptyTree))) - def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type]) given (ctx: Context): Closure = + def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type]) given Context: Closure = tpd.cpy.Closure(original)(Nil, meth, tpe.map(tpd.TypeTree(_)).getOrElse(tpd.EmptyTree)) type If = tpd.If - def matchIf(x: Term) given (ctx: Context): Option[If] = x match { + def matchIf(x: Term) given Context: Option[If] = x match { case x: tpd.If => Some(x) case _ => None } - def If_cond(self: If) given (ctx: Context): Term = self.cond - def If_thenp(self: If) given (ctx: Context): Term = self.thenp - def If_elsep(self: If) given (ctx: Context): Term = self.elsep + def If_cond(self: If) given Context: Term = self.cond + def If_thenp(self: If) given Context: Term = self.thenp + def If_elsep(self: If) given Context: Term = self.elsep - def If_apply(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = + def If_apply(cond: Term, thenp: Term, elsep: Term) given Context: If = withDefaultPos(tpd.If(cond, thenp, elsep)) - def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term) given (ctx: Context): If = + def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term) given Context: If = tpd.cpy.If(original)(cond, thenp, elsep) type Match = tpd.Match - def matchMatch(x: Term) given (ctx: Context): Option[Match] = x match { + def matchMatch(x: Term) given Context: Option[Match] = x match { case x: tpd.Match if !x.selector.isEmpty => Some(x) case _ => None } - def Match_scrutinee(self: Match) given (ctx: Context): Term = self.selector - def Match_cases(self: Match) given (ctx: Context): List[CaseDef] = self.cases + def Match_scrutinee(self: Match) given Context: Term = self.selector + def Match_cases(self: Match) given Context: List[CaseDef] = self.cases - def Match_apply(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = + def Match_apply(selector: Term, cases: List[CaseDef]) given Context: Match = withDefaultPos(tpd.Match(selector, cases)) - def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef]) given (ctx: Context): Match = + def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef]) given Context: Match = tpd.cpy.Match(original)(selector, cases) type ImpliedMatch = tpd.Match - def matchImplicitMatch(x: Term) given (ctx: Context): Option[Match] = x match { + def matchImplicitMatch(x: Term) given Context: Option[Match] = x match { case x: tpd.Match if x.selector.isEmpty => Some(x) case _ => None } - def ImplicitMatch_cases(self: Match) given (ctx: Context): List[CaseDef] = self.cases + def ImplicitMatch_cases(self: Match) given Context: List[CaseDef] = self.cases - def ImplicitMatch_apply(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = + def ImplicitMatch_apply(cases: List[CaseDef]) given Context: ImpliedMatch = withDefaultPos(tpd.Match(tpd.EmptyTree, cases)) - def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef]) given (ctx: Context): ImpliedMatch = + def ImplicitMatch_copy(original: Tree)(cases: List[CaseDef]) given Context: ImpliedMatch = tpd.cpy.Match(original)(tpd.EmptyTree, cases) type Try = tpd.Try - def matchTry(x: Term) given (ctx: Context): Option[Try] = x match { + def matchTry(x: Term) given Context: Option[Try] = x match { case x: tpd.Try => Some(x) case _ => None } - def Try_body(self: Try) given (ctx: Context): Term = self.expr - def Try_cases(self: Try) given (ctx: Context): List[CaseDef] = self.cases - def Try_finalizer(self: Try) given (ctx: Context): Option[Term] = optional(self.finalizer) + def Try_body(self: Try) given Context: Term = self.expr + def Try_cases(self: Try) given Context: List[CaseDef] = self.cases + def Try_finalizer(self: Try) given Context: Option[Term] = optional(self.finalizer) - def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given (ctx: Context): Try = + def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term]) given Context: Try = withDefaultPos(tpd.Try(expr, cases, finalizer.getOrElse(tpd.EmptyTree))) - def Try_copy(original: Tree)(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 Context: Try = tpd.cpy.Try(original)(expr, cases, finalizer.getOrElse(tpd.EmptyTree)) type Return = tpd.Return - def matchReturn(x: Term) given (ctx: Context): Option[Return] = x match { + def matchReturn(x: Term) given Context: Option[Return] = x match { case x: tpd.Return => Some(x) case _ => None } - def Return_expr(self: Return) given (ctx: Context): Term = self.expr + def Return_expr(self: Return) given Context: Term = self.expr def Return_apply(expr: Term) given (ctx: Context): Return = withDefaultPos(tpd.Return(expr, ctx.owner)) @@ -603,23 +603,23 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Repeated = tpd.SeqLiteral - def matchRepeated(x: Term) given (ctx: Context): Option[Repeated] = x match { + def matchRepeated(x: Term) given Context: Option[Repeated] = x match { case x: tpd.SeqLiteral => Some(x) case _ => None } - def Repeated_elems(self: Repeated) given (ctx: Context): List[Term] = self.elems - def Repeated_elemtpt(self: Repeated) given (ctx: Context): TypeTree = self.elemtpt + def Repeated_elems(self: Repeated) given Context: List[Term] = self.elems + def Repeated_elemtpt(self: Repeated) given Context: TypeTree = self.elemtpt - def Repeated_apply(elems: List[Term], elemtpt: TypeTree) given (ctx: Context): Repeated = + def Repeated_apply(elems: List[Term], elemtpt: TypeTree) given Context: Repeated = withDefaultPos(tpd.SeqLiteral(elems, elemtpt)) - def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree) given (ctx: Context): Repeated = + def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree) given Context: Repeated = tpd.cpy.SeqLiteral(original)(elems, elemtpt) type SelectOuter = tpd.Select - def matchSelectOuter(x: Term) given (ctx: Context): Option[SelectOuter] = x match { + def matchSelectOuter(x: Term) given Context: Option[SelectOuter] = x match { case x: tpd.Select => x.name match { case NameKinds.OuterSelectName(_, _) => Some(x) @@ -628,237 +628,237 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def SelectOuter_qualifier(self: SelectOuter) given (ctx: Context): Term = self.qualifier - def SelectOuter_level(self: SelectOuter) given (ctx: Context): Int = { + def SelectOuter_qualifier(self: SelectOuter) given Context: Term = self.qualifier + def SelectOuter_level(self: SelectOuter) given Context: Int = { val NameKinds.OuterSelectName(_, levels) = self.name levels } - def SelectOuter_tpe(self: SelectOuter) given (ctx: Context): Type = self.tpe.stripTypeVar + def SelectOuter_tpe(self: SelectOuter) given Context: Type = self.tpe.stripTypeVar - def SelectOuter_apply(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = + def SelectOuter_apply(qualifier: Term, name: String, levels: Int) given Context: SelectOuter = withDefaultPos(tpd.Select(qualifier, NameKinds.OuterSelectName(name.toTermName, levels))) - def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int) given (ctx: Context): SelectOuter = + def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int) given Context: SelectOuter = tpd.cpy.Select(original)(qualifier, NameKinds.OuterSelectName(name.toTermName, levels)) type While = tpd.WhileDo - def matchWhile(x: Term) given (ctx: Context): Option[While] = x match { + def matchWhile(x: Term) given Context: Option[While] = x match { case x: tpd.WhileDo => Some(x) case _ => None } - def While_cond(self: While) given (ctx: Context): Term = self.cond - def While_body(self: While) given (ctx: Context): Term = self.body + def While_cond(self: While) given Context: Term = self.cond + def While_body(self: While) given Context: Term = self.body - def While_apply(cond: Term, body: Term) given (ctx: Context): While = + def While_apply(cond: Term, body: Term) given Context: While = withDefaultPos(tpd.WhileDo(cond, body)) - def While_copy(original: Tree)(cond: Term, body: Term) given (ctx: Context): While = + def While_copy(original: Tree)(cond: Term, body: Term) given Context: While = tpd.cpy.WhileDo(original)(cond, body) type TypeTree = tpd.Tree - def matchTypeTree(x: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeTree] = x match { + def matchTypeTree(x: TypeTree | TypeBoundsTree) given Context: Option[TypeTree] = x match { case x: tpd.TypeBoundsTree => None case _ => if (x.isType) Some(x) else None } - def TypeTree_pos(self: TypeTree) given (ctx: Context): Position = self.sourcePos - def TypeTree_symbol(self: TypeTree) given (ctx: Context): Symbol = self.symbol - def TypeTree_tpe(self: TypeTree) given (ctx: Context): Type = self.tpe.stripTypeVar + def TypeTree_pos(self: TypeTree) given Context: Position = self.sourcePos + def TypeTree_symbol(self: TypeTree) given Context: Symbol = self.symbol + def TypeTree_tpe(self: TypeTree) given Context: Type = self.tpe.stripTypeVar type Inferred = tpd.TypeTree - def matchInferred(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Inferred] = tpt match { + def matchInferred(tpt: TypeTree | TypeBoundsTree) given Context: Option[Inferred] = tpt match { case tpt: tpd.TypeTree if !tpt.tpe.isInstanceOf[Types.TypeBounds] => Some(tpt) case _ => None } - def Inferred_apply(tpe: Type) given (ctx: Context): Inferred = withDefaultPos(tpd.TypeTree(tpe)) + def Inferred_apply(tpe: Type) given Context: Inferred = withDefaultPos(tpd.TypeTree(tpe)) type TypeIdent = tpd.Ident - def matchTypeIdent(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeIdent] = tpt match { + def matchTypeIdent(tpt: TypeTree | TypeBoundsTree) given Context: Option[TypeIdent] = tpt match { case tpt: tpd.Ident if tpt.isType => Some(tpt) case _ => None } - def TypeIdent_name(self: TypeIdent) given (ctx: Context): String = self.name.toString + def TypeIdent_name(self: TypeIdent) given Context: String = self.name.toString - def TypeIdent_copy(original: TypeIdent)(name: String) given (ctx: Context): TypeIdent = + def TypeIdent_copy(original: TypeIdent)(name: String) given Context: TypeIdent = tpd.cpy.Ident(original)(name.toTypeName) type TypeSelect = tpd.Select - def matchTypeSelect(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeSelect] = tpt match { + def matchTypeSelect(tpt: TypeTree | TypeBoundsTree) given Context: Option[TypeSelect] = tpt match { case tpt: tpd.Select if tpt.isType && tpt.qualifier.isTerm => Some(tpt) case _ => None } - def TypeSelect_qualifier(self: TypeSelect) given (ctx: Context): Term = self.qualifier - def TypeSelect_name(self: TypeSelect) given (ctx: Context): String = self.name.toString + def TypeSelect_qualifier(self: TypeSelect) given Context: Term = self.qualifier + def TypeSelect_name(self: TypeSelect) given Context: String = self.name.toString - def TypeSelect_apply(qualifier: Term, name: String) given (ctx: Context): TypeSelect = + def TypeSelect_apply(qualifier: Term, name: String) given Context: TypeSelect = withDefaultPos(tpd.Select(qualifier, name.toTypeName)) - def TypeSelect_copy(original: TypeSelect)(qualifier: Term, name: String) given (ctx: Context): TypeSelect = + def TypeSelect_copy(original: TypeSelect)(qualifier: Term, name: String) given Context: TypeSelect = tpd.cpy.Select(original)(qualifier, name.toTypeName) type Projection = tpd.Select - def matchProjection(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Projection] = tpt match { + def matchProjection(tpt: TypeTree | TypeBoundsTree) given Context: Option[Projection] = tpt match { case tpt: tpd.Select if tpt.isType && tpt.qualifier.isType => Some(tpt) case _ => None } - def Projection_qualifier(self: Projection) given (ctx: Context): TypeTree = self.qualifier - def Projection_name(self: Projection) given (ctx: Context): String = self.name.toString + def Projection_qualifier(self: Projection) given Context: TypeTree = self.qualifier + def Projection_name(self: Projection) given Context: String = self.name.toString - def Projection_copy(original: Projection)(qualifier: TypeTree, name: String) given (ctx: Context): Projection = + def Projection_copy(original: Projection)(qualifier: TypeTree, name: String) given Context: Projection = tpd.cpy.Select(original)(qualifier, name.toTypeName) type Singleton = tpd.SingletonTypeTree - def matchSingleton(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Singleton] = tpt match { + def matchSingleton(tpt: TypeTree | TypeBoundsTree) given Context: Option[Singleton] = tpt match { case tpt: tpd.SingletonTypeTree => Some(tpt) case _ => None } - def Singleton_ref(self: Singleton) given (ctx: Context): Term = self.ref + def Singleton_ref(self: Singleton) given Context: Term = self.ref - def Singleton_apply(ref: Term) given (ctx: Context): Singleton = + def Singleton_apply(ref: Term) given Context: Singleton = withDefaultPos(tpd.SingletonTypeTree(ref)) - def Singleton_copy(original: Singleton)(ref: Term) given (ctx: Context): Singleton = + def Singleton_copy(original: Singleton)(ref: Term) given Context: Singleton = tpd.cpy.SingletonTypeTree(original)(ref) type Refined = tpd.RefinedTypeTree - def matchRefined(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Refined] = tpt match { + def matchRefined(tpt: TypeTree | TypeBoundsTree) given Context: Option[Refined] = tpt match { case tpt: tpd.RefinedTypeTree => Some(tpt) case _ => None } - def Refined_tpt(self: Refined) given (ctx: Context): TypeTree = self.tpt - def Refined_refinements(self: Refined) given (ctx: Context): List[Definition] = self.refinements + def Refined_tpt(self: Refined) given Context: TypeTree = self.tpt + def Refined_refinements(self: Refined) given Context: List[Definition] = self.refinements - def Refined_copy(original: Refined)(tpt: TypeTree, refinements: List[Definition]) given (ctx: Context): Refined = + def Refined_copy(original: Refined)(tpt: TypeTree, refinements: List[Definition]) given Context: Refined = tpd.cpy.RefinedTypeTree(original)(tpt, refinements) type Applied = tpd.AppliedTypeTree - def matchApplied(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Applied] = tpt match { + def matchApplied(tpt: TypeTree | TypeBoundsTree) given Context: Option[Applied] = tpt match { case tpt: tpd.AppliedTypeTree => Some(tpt) case _ => None } - def Applied_tpt(self: Applied) given (ctx: Context): TypeTree = self.tpt - def Applied_args(self: Applied) given (ctx: Context): List[TypeTree | TypeBoundsTree] = self.args + def Applied_tpt(self: Applied) given Context: TypeTree = self.tpt + def Applied_args(self: Applied) given Context: List[TypeTree | TypeBoundsTree] = self.args - def Applied_apply(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree]) given (ctx: Context): Applied = + def Applied_apply(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree]) given Context: Applied = withDefaultPos(tpd.AppliedTypeTree(tpt, args)) - def Applied_copy(original: Applied)(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree]) given (ctx: Context): Applied = + def Applied_copy(original: Applied)(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree]) given Context: Applied = tpd.cpy.AppliedTypeTree(original)(tpt, args) type Annotated = tpd.Annotated - def matchAnnotated(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[Annotated] = tpt match { + def matchAnnotated(tpt: TypeTree | TypeBoundsTree) given Context: Option[Annotated] = tpt match { case tpt: tpd.Annotated => Some(tpt) case _ => None } - def Annotated_arg(self: Annotated) given (ctx: Context): TypeTree = self.arg - def Annotated_annotation(self: Annotated) given (ctx: Context): Term = self.annot + def Annotated_arg(self: Annotated) given Context: TypeTree = self.arg + def Annotated_annotation(self: Annotated) given Context: Term = self.annot - def Annotated_apply(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = + def Annotated_apply(arg: TypeTree, annotation: Term) given Context: Annotated = withDefaultPos(tpd.Annotated(arg, annotation)) - def Annotated_copy(original: Annotated)(arg: TypeTree, annotation: Term) given (ctx: Context): Annotated = + def Annotated_copy(original: Annotated)(arg: TypeTree, annotation: Term) given Context: Annotated = tpd.cpy.Annotated(original)(arg, annotation) type MatchTypeTree = tpd.MatchTypeTree - def matchMatchTypeTree(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[MatchTypeTree] = tpt match { + def matchMatchTypeTree(tpt: TypeTree | TypeBoundsTree) given Context: Option[MatchTypeTree] = tpt match { case tpt: tpd.MatchTypeTree => Some(tpt) case _ => None } - def MatchTypeTree_bound(self: MatchTypeTree) given (ctx: Context): Option[TypeTree] = if (self.bound == tpd.EmptyTree) None else Some(self.bound) - def MatchTypeTree_selector(self: MatchTypeTree) given (ctx: Context): TypeTree = self.selector - def MatchTypeTree_cases(self: MatchTypeTree) given (ctx: Context): List[CaseDef] = self.cases + def MatchTypeTree_bound(self: MatchTypeTree) given Context: Option[TypeTree] = if (self.bound == tpd.EmptyTree) None else Some(self.bound) + def MatchTypeTree_selector(self: MatchTypeTree) given Context: TypeTree = self.selector + def MatchTypeTree_cases(self: MatchTypeTree) given Context: List[CaseDef] = self.cases - def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given (ctx: Context): MatchTypeTree = + def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef]) given Context: MatchTypeTree = withDefaultPos(tpd.MatchTypeTree(bound.getOrElse(tpd.EmptyTree), selector, cases)) - def MatchTypeTree_copy(original: MatchTypeTree)(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 Context: MatchTypeTree = tpd.cpy.MatchTypeTree(original)(bound.getOrElse(tpd.EmptyTree), selector, cases) type ByName = tpd.ByNameTypeTree - def matchByName(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[ByName] = tpt match { + def matchByName(tpt: TypeTree | TypeBoundsTree) given Context: Option[ByName] = tpt match { case tpt: tpd.ByNameTypeTree => Some(tpt) case _ => None } - def ByName_result(self: ByName) given (ctx: Context): TypeTree = self.result + def ByName_result(self: ByName) given Context: TypeTree = self.result - def ByName_apply(result: TypeTree) given (ctx: Context): ByName = + def ByName_apply(result: TypeTree) given Context: ByName = withDefaultPos(tpd.ByNameTypeTree(result)) - def ByName_copy(original: ByName)(result: TypeTree) given (ctx: Context): ByName = + def ByName_copy(original: ByName)(result: TypeTree) given Context: ByName = tpd.cpy.ByNameTypeTree(original)(result) type LambdaTypeTree = tpd.LambdaTypeTree - def matchLambdaTypeTree(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[LambdaTypeTree] = tpt match { + def matchLambdaTypeTree(tpt: TypeTree | TypeBoundsTree) given Context: Option[LambdaTypeTree] = tpt match { case tpt: tpd.LambdaTypeTree => Some(tpt) case _ => None } - def Lambdatparams(self: LambdaTypeTree) given (ctx: Context): List[TypeDef] = self.tparams - def Lambdabody(self: LambdaTypeTree) given (ctx: Context): TypeTree | TypeBoundsTree = self.body + def Lambdatparams(self: LambdaTypeTree) given Context: List[TypeDef] = self.tparams + def Lambdabody(self: LambdaTypeTree) given Context: TypeTree | TypeBoundsTree = self.body - def Lambdaapply(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree) given (ctx: Context): LambdaTypeTree = + def Lambdaapply(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree) given Context: LambdaTypeTree = withDefaultPos(tpd.LambdaTypeTree(tparams, body)) - def Lambdacopy(original: LambdaTypeTree)(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree) given (ctx: Context): LambdaTypeTree = + def Lambdacopy(original: LambdaTypeTree)(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree) given Context: LambdaTypeTree = tpd.cpy.LambdaTypeTree(original)(tparams, body) type TypeBind = tpd.Bind - def matchTypeBind(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeBind] = tpt match { + def matchTypeBind(tpt: TypeTree | TypeBoundsTree) given Context: Option[TypeBind] = tpt match { case tpt: tpd.Bind if tpt.name.isTypeName => Some(tpt) case _ => None } - def TypeBind_name(self: TypeBind) given (ctx: Context): String = self.name.toString - def TypeBind_body(self: TypeBind) given (ctx: Context): TypeTree | TypeBoundsTree = self.body + def TypeBind_name(self: TypeBind) given Context: String = self.name.toString + def TypeBind_body(self: TypeBind) given Context: TypeTree | TypeBoundsTree = self.body - def TypeBind_copy(original: TypeBind)(name: String, tpt: TypeTree | TypeBoundsTree) given (ctx: Context): TypeBind = + def TypeBind_copy(original: TypeBind)(name: String, tpt: TypeTree | TypeBoundsTree) given Context: TypeBind = tpd.cpy.Bind(original)(name.toTypeName, tpt) type TypeBlock = tpd.Block - def matchTypeBlock(tpt: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeBlock] = tpt match { + def matchTypeBlock(tpt: TypeTree | TypeBoundsTree) given Context: Option[TypeBlock] = tpt match { case tpt: tpd.Block => Some(tpt) case _ => None } - def TypeBlock_aliases(self: TypeBlock) given (ctx: Context): List[TypeDef] = self.stats.map { case alias: TypeDef => alias } - def TypeBlock_tpt(self: TypeBlock) given (ctx: Context): TypeTree = self.expr + def TypeBlock_aliases(self: TypeBlock) given Context: List[TypeDef] = self.stats.map { case alias: TypeDef => alias } + def TypeBlock_tpt(self: TypeBlock) given Context: TypeTree = self.expr - def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = + def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree) given Context: TypeBlock = withDefaultPos(tpd.Block(aliases, tpt)) - def TypeBlock_copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree) given (ctx: Context): TypeBlock = + def TypeBlock_copy(original: TypeBlock)(aliases: List[TypeDef], tpt: TypeTree) given Context: TypeBlock = tpd.cpy.Block(original)(aliases, tpt) type TypeBoundsTree = tpd.TypeBoundsTree - def matchTypeBoundsTree(x: TypeTree | TypeBoundsTree) given (ctx: Context): Option[TypeBoundsTree] = x match { + def matchTypeBoundsTree(x: TypeTree | TypeBoundsTree) given Context: Option[TypeBoundsTree] = x match { case x: tpd.TypeBoundsTree => Some(x) case x @ Trees.TypeTree() => // TODO only enums generate this kind of type bounds. Is this possible without enums? If not generate tpd.TypeBoundsTree for enums instead @@ -870,50 +870,50 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def TypeBoundsTree_tpe(self: TypeBoundsTree) given (ctx: Context): TypeBounds = self.tpe.asInstanceOf[Types.TypeBounds] - def TypeBoundsTree_low(self: TypeBoundsTree) given (ctx: Context): TypeTree = self.lo - def TypeBoundsTree_hi(self: TypeBoundsTree) given (ctx: Context): TypeTree = self.hi + def TypeBoundsTree_tpe(self: TypeBoundsTree) given Context: TypeBounds = self.tpe.asInstanceOf[Types.TypeBounds] + def TypeBoundsTree_low(self: TypeBoundsTree) given Context: TypeTree = self.lo + def TypeBoundsTree_hi(self: TypeBoundsTree) given Context: TypeTree = self.hi type WildcardTypeTree = tpd.Ident - def matchWildcardTypeTree(x: TypeTree | TypeBoundsTree) given (ctx: Context): Option[WildcardTypeTree] = x match { + def matchWildcardTypeTree(x: TypeTree | TypeBoundsTree) given Context: Option[WildcardTypeTree] = x match { case x @ Trees.Ident(nme.WILDCARD) => Some(x) case _ => None } - def WildcardTypeTree_tpe(self: WildcardTypeTree) given (ctx: Context): TypeOrBounds = self.tpe.stripTypeVar + def WildcardTypeTree_tpe(self: WildcardTypeTree) given Context: TypeOrBounds = self.tpe.stripTypeVar type CaseDef = tpd.CaseDef - def matchCaseDef(tree: Tree) given (ctx: Context): Option[CaseDef] = tree match { + def matchCaseDef(tree: Tree) given Context: Option[CaseDef] = tree match { case tree: tpd.CaseDef if tree.body.isTerm => Some(tree) case _ => None } - def CaseDef_pattern(self: CaseDef) given (ctx: Context): Pattern = self.pat - def CaseDef_guard(self: CaseDef) given (ctx: Context): Option[Term] = optional(self.guard) - def CaseDef_rhs(self: CaseDef) given (ctx: Context): Term = self.body + def CaseDef_pattern(self: CaseDef) given Context: Pattern = self.pat + def CaseDef_guard(self: CaseDef) given Context: Option[Term] = optional(self.guard) + def CaseDef_rhs(self: CaseDef) given Context: Term = self.body - def CaseDef_module_apply(pattern: Pattern, guard: Option[Term], body: Term) given (ctx: Context): CaseDef = + def CaseDef_module_apply(pattern: Pattern, guard: Option[Term], body: Term) given Context: CaseDef = tpd.CaseDef(pattern, guard.getOrElse(tpd.EmptyTree), body) - def CaseDef_module_copy(original: CaseDef)(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 Context: CaseDef = tpd.cpy.CaseDef(original)(pattern, guard.getOrElse(tpd.EmptyTree), body) type TypeCaseDef = tpd.CaseDef - def matchTypeCaseDef(tree: Tree) given (ctx: Context): Option[TypeCaseDef] = tree match { + def matchTypeCaseDef(tree: Tree) given Context: Option[TypeCaseDef] = tree match { case tree: tpd.CaseDef if tree.body.isType => Some(tree) case _ => None } - def TypeCaseDef_pattern(self: TypeCaseDef) given (ctx: Context): TypeTree = self.pat - def TypeCaseDef_rhs(self: TypeCaseDef) given (ctx: Context): TypeTree = self.body + def TypeCaseDef_pattern(self: TypeCaseDef) given Context: TypeTree = self.pat + def TypeCaseDef_rhs(self: TypeCaseDef) given Context: TypeTree = self.body - def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree) given (ctx: Context): TypeCaseDef = + def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree) given Context: TypeCaseDef = tpd.CaseDef(pattern, tpd.EmptyTree, body) - def TypeCaseDef_module_copy(original: TypeCaseDef)(pattern: TypeTree, body: TypeTree) given (ctx: Context): TypeCaseDef = + def TypeCaseDef_module_copy(original: TypeCaseDef)(pattern: TypeTree, body: TypeTree) given Context: TypeCaseDef = tpd.cpy.CaseDef(original)(pattern, tpd.EmptyTree, body) // @@ -922,9 +922,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Pattern = tpd.Tree - def Pattern_pos(self: Pattern) given (ctx: Context): Position = self.sourcePos - def Pattern_tpe(self: Pattern) given (ctx: Context): Type = self.tpe.stripTypeVar - def Pattern_symbol(self: Pattern) given (ctx: Context): Symbol = self.symbol + def Pattern_pos(self: Pattern) given Context: Position = self.sourcePos + def Pattern_tpe(self: Pattern) given Context: Type = self.tpe.stripTypeVar + def Pattern_symbol(self: Pattern) given Context: Symbol = self.symbol type Value = tpd.Tree @@ -935,14 +935,14 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def Pattern_Value_value(self: Value) given (ctx: Context): Term = self + def Pattern_Value_value(self: Value) given Context: Term = self - def Pattern_Value_module_apply(term: Term) given (ctx: Context): Value = term match { + def Pattern_Value_module_apply(term: Term) given Context: Value = term match { case lit: tpd.Literal => lit case ref: tpd.RefTree if ref.isTerm => ref case ths: tpd.This => ths } - def Pattern_Value_module_copy(original: Value)(term: Term) given (ctx: Context): Value = term match { + def Pattern_Value_module_copy(original: Value)(term: Term) given Context: Value = term match { case lit: tpd.Literal => tpd.cpy.Literal(original)(lit.const) case ref: tpd.RefTree if ref.isTerm => tpd.cpy.Ref(original.asInstanceOf[tpd.RefTree])(ref.name) case ths: tpd.This => tpd.cpy.This(original)(ths.qual) @@ -950,31 +950,31 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Bind = tpd.Bind - def matchPattern_Bind(x: Pattern) given (ctx: Context): Option[Bind] = x match { + def matchPattern_Bind(x: Pattern) given Context: Option[Bind] = x match { case x: tpd.Bind if x.name.isTermName => Some(x) case _ => None } - def Pattern_Bind_name(self: Bind) given (ctx: Context): String = self.name.toString + def Pattern_Bind_name(self: Bind) given Context: String = self.name.toString - def Pattern_Bind_pattern(self: Bind) given (ctx: Context): Pattern = self.body + def Pattern_Bind_pattern(self: Bind) given Context: Pattern = self.body - def Pattern_Bind_module_copy(original: Bind)(name: String, pattern: Pattern) given (ctx: Context): Bind = + def Pattern_Bind_module_copy(original: Bind)(name: String, pattern: Pattern) given Context: Bind = withDefaultPos(tpd.cpy.Bind(original)(name.toTermName, pattern)) type Unapply = tpd.UnApply - def matchPattern_Unapply(pattern: Pattern) given (ctx: Context): Option[Unapply] = pattern match { + def matchPattern_Unapply(pattern: Pattern) given Context: Option[Unapply] = pattern match { case pattern @ Trees.UnApply(_, _, _) => Some(pattern) case Trees.Typed(pattern @ Trees.UnApply(_, _, _), _) => Some(pattern) case _ => None } - def Pattern_Unapply_fun(self: Unapply) given (ctx: Context): Term = self.fun - def Pattern_Unapply_implicits(self: Unapply) given (ctx: Context): List[Term] = self.implicits - def Pattern_Unapply_patterns(self: Unapply) given (ctx: Context): List[Pattern] = effectivePatterns(self.patterns) + def Pattern_Unapply_fun(self: Unapply) given Context: Term = self.fun + def Pattern_Unapply_implicits(self: Unapply) given Context: List[Term] = self.implicits + def Pattern_Unapply_patterns(self: Unapply) given Context: List[Pattern] = effectivePatterns(self.patterns) - def Pattern_Unapply_module_copy(original: Unapply)(fun: Term, implicits: List[Term], patterns: List[Pattern]) given (ctx: Context): Unapply = + def Pattern_Unapply_module_copy(original: Unapply)(fun: Term, implicits: List[Term], patterns: List[Pattern]) given Context: Unapply = withDefaultPos(tpd.cpy.UnApply(original)(fun, implicits, patterns)) private def effectivePatterns(patterns: List[Pattern]): List[Pattern] = patterns match { @@ -984,45 +984,45 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Alternatives = tpd.Alternative - def matchPattern_Alternatives(pattern: Pattern) given (ctx: Context): Option[Alternatives] = pattern match { + def matchPattern_Alternatives(pattern: Pattern) given Context: Option[Alternatives] = pattern match { case pattern: tpd.Alternative => Some(pattern) case _ => None } - def Pattern_Alternatives_patterns(self: Alternatives) given (ctx: Context): List[Pattern] = self.trees + def Pattern_Alternatives_patterns(self: Alternatives) given Context: List[Pattern] = self.trees - def Pattern_Alternatives_module_apply(patterns: List[Pattern]) given (ctx: Context): Alternatives = + def Pattern_Alternatives_module_apply(patterns: List[Pattern]) given Context: Alternatives = withDefaultPos(tpd.Alternative(patterns)) - def Pattern_Alternatives_module_copy(original: Alternatives)(patterns: List[Pattern]) given (ctx: Context): Alternatives = + def Pattern_Alternatives_module_copy(original: Alternatives)(patterns: List[Pattern]) given Context: Alternatives = tpd.cpy.Alternative(original)(patterns) type TypeTest = tpd.Typed - def matchPattern_TypeTest(pattern: Pattern) given (ctx: Context): Option[TypeTest] = pattern match { + def matchPattern_TypeTest(pattern: Pattern) given Context: Option[TypeTest] = pattern match { case Trees.Typed(_: tpd.UnApply, _) => None case pattern: tpd.Typed => Some(pattern) case _ => None } - def Pattern_TypeTest_tpt(self: TypeTest) given (ctx: Context): TypeTree = self.tpt + def Pattern_TypeTest_tpt(self: TypeTest) given Context: TypeTree = self.tpt def Pattern_TypeTest_module_apply(tpt: TypeTree) given (ctx: Context): TypeTest = withDefaultPos(tpd.Typed(untpd.Ident(nme.WILDCARD)(ctx.source).withType(tpt.tpe), tpt)) - def Pattern_TypeTest_module_copy(original: TypeTest)(tpt: TypeTree) given (ctx: Context): TypeTest = + def Pattern_TypeTest_module_copy(original: TypeTest)(tpt: TypeTree) given Context: TypeTest = tpd.cpy.Typed(original)(untpd.Ident(nme.WILDCARD).withSpan(original.span).withType(tpt.tpe), tpt) type WildcardPattern = tpd.Ident - def matchPattern_WildcardPattern(pattern: Pattern) given (ctx: Context): Option[WildcardPattern] = { + def matchPattern_WildcardPattern(pattern: Pattern) given Context: Option[WildcardPattern] = { pattern match { case pattern: tpd.Ident if tpd.isWildcardArg(pattern) => Some(pattern) case _ => None } } - def Pattern_WildcardPattern_module_apply(tpe: TypeOrBounds) given (ctx: Context): WildcardPattern = + def Pattern_WildcardPattern_module_apply(tpe: TypeOrBounds) given Context: WildcardPattern = untpd.Ident(nme.WILDCARD).withType(tpe) // @@ -1033,22 +1033,22 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type NoPrefix = Types.NoPrefix.type - def matchNoPrefix(x: TypeOrBounds) given (ctx: Context): Option[NoPrefix] = + def matchNoPrefix(x: TypeOrBounds) given Context: Option[NoPrefix] = if (x == Types.NoPrefix) Some(Types.NoPrefix) else None type TypeBounds = Types.TypeBounds - def matchTypeBounds(x: TypeOrBounds) given (ctx: Context): Option[TypeBounds] = x match { + def matchTypeBounds(x: TypeOrBounds) given Context: Option[TypeBounds] = x match { case x: Types.TypeBounds => Some(x) case _ => None } - def TypeBounds_low(self: TypeBounds) given (ctx: Context): Type = self.lo - def TypeBounds_hi(self: TypeBounds) given (ctx: Context): Type = self.hi + def TypeBounds_low(self: TypeBounds) given Context: Type = self.lo + def TypeBounds_hi(self: TypeBounds) given Context: Type = self.hi type Type = Types.Type - def matchType(x: TypeOrBounds) given (ctx: Context): Option[Type] = x match { + def matchType(x: TypeOrBounds) given Context: Option[Type] = x match { case x: TypeBounds => None case x if x == Types.NoPrefix => None case _ => Some(x) @@ -1077,9 +1077,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } else ctx.getClassIfDefined(clazz.getCanonicalName).typeRef } - def `Type_=:=`(self: Type)(that: Type) given (ctx: Context): Boolean = self =:= that + def `Type_=:=`(self: Type)(that: Type) given Context: Boolean = self =:= that - def `Type_<:<`(self: Type)(that: Type) given (ctx: Context): Boolean = self <:< that + def `Type_<:<`(self: Type)(that: Type) given Context: Boolean = self <:< that /** Widen from singleton type to its underlying non-singleton * base type by applying one or more `underlying` dereferences, @@ -1090,49 +1090,49 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. * def o: Outer * .widen = o.C */ - def Type_widen(self: Type) given (ctx: Context): Type = self.widen + def Type_widen(self: Type) given Context: Type = self.widen - def Type_dealias(self: Type) given (ctx: Context): Type = self.dealias + def Type_dealias(self: Type) given Context: Type = self.dealias - def Type_classSymbol(self: Type) given (ctx: Context): Option[ClassDefSymbol] = + def Type_classSymbol(self: Type) given Context: Option[ClassDefSymbol] = if (self.classSymbol.exists) Some(self.classSymbol.asClass) else None - def Type_typeSymbol(self: Type) given (ctx: Context): Symbol = self.typeSymbol + def Type_typeSymbol(self: Type) given Context: Symbol = self.typeSymbol - def Type_isSingleton(self: Type) given (ctx: Context): Boolean = self.isSingleton + def Type_isSingleton(self: Type) given Context: Boolean = self.isSingleton - def Type_memberType(self: Type)(member: Symbol) given (ctx: Context): Type = + def Type_memberType(self: Type)(member: Symbol) given Context: Type = member.info.asSeenFrom(self, member.owner) - def Type_derivesFrom(self: Type)(cls: ClassDefSymbol) given (ctx: Context): Boolean = + def Type_derivesFrom(self: Type)(cls: ClassDefSymbol) given Context: Boolean = self.derivesFrom(cls) - def Type_isFunctionType(self: Type) given (ctx: Context): Boolean = + def Type_isFunctionType(self: Type) given Context: Boolean = defn.isFunctionType(self) - def Type_isImplicitFunctionType(self: Type) given (ctx: Context): Boolean = + def Type_isImplicitFunctionType(self: Type) given Context: Boolean = defn.isImplicitFunctionType(self) - def Type_isErasedFunctionType(self: Type) given (ctx: Context): Boolean = + def Type_isErasedFunctionType(self: Type) given Context: Boolean = defn.isErasedFunctionType(self) - def Type_isDependentFunctionType(self: Type) given (ctx: Context): Boolean = { + def Type_isDependentFunctionType(self: Type) given Context: Boolean = { val tpNoRefinement = self.dropDependentRefinement tpNoRefinement != self && defn.isNonRefinedFunction(tpNoRefinement) } type ConstantType = Types.ConstantType - def matchConstantType(tpe: TypeOrBounds) given (ctx: Context): Option[ConstantType] = tpe match { + def matchConstantType(tpe: TypeOrBounds) given Context: Option[ConstantType] = tpe match { case tpe: Types.ConstantType => Some(tpe) case _ => None } - def ConstantType_constant(self: ConstantType) given (ctx: Context): Constant = self.value + def ConstantType_constant(self: ConstantType) given Context: Constant = self.value type SymRef = Types.NamedType - def matchSymRef(tpe: TypeOrBounds) given (ctx: Context): Option[SymRef] = tpe match { + def matchSymRef(tpe: TypeOrBounds) given Context: Option[SymRef] = tpe match { case tp: Types.NamedType => tp.designator match { case sym: Symbol => Some(tp) @@ -1141,10 +1141,10 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def SymRef_qualifier(self: SymRef) given (ctx: Context): TypeOrBounds = self.prefix + def SymRef_qualifier(self: SymRef) given Context: TypeOrBounds = self.prefix // TODO remove this method. May require splitting SymRef into TypeSymRef and TermSymRef - def matchSymRef_unapply(tpe: TypeOrBounds) given (ctx: Context): Option[(Symbol, Type | NoPrefix)] = tpe match { + def matchSymRef_unapply(tpe: TypeOrBounds) given Context: Option[(Symbol, Type | NoPrefix)] = tpe match { case tpe: Types.NamedType => tpe.designator match { case sym: Symbol => Some((sym, tpe.prefix)) @@ -1155,7 +1155,7 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type TermRef = Types.NamedType - def matchTermRef(tpe: TypeOrBounds) given (ctx: Context): Option[TermRef] = tpe match { + def matchTermRef(tpe: TypeOrBounds) given Context: Option[TermRef] = tpe match { case tpe: Types.NamedType => tpe.designator match { case name: Names.TermName => Some(tpe) @@ -1164,15 +1164,15 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def TermRef_name(self: TermRef) given (ctx: Context): String = self.name.toString - def TermRef_qualifier(self: TermRef) given (ctx: Context): TypeOrBounds = self.prefix + def TermRef_name(self: TermRef) given Context: String = self.name.toString + def TermRef_qualifier(self: TermRef) given Context: TypeOrBounds = self.prefix - def TermRef_apply(qual: TypeOrBounds, name: String) given (ctx: Context): TermRef = + def TermRef_apply(qual: TypeOrBounds, name: String) given Context: TermRef = Types.TermRef(qual, name.toTermName) type TypeRef = Types.NamedType - def matchTypeRef(tpe: TypeOrBounds) given (ctx: Context): Option[TypeRef] = tpe match { + def matchTypeRef(tpe: TypeOrBounds) given Context: Option[TypeRef] = tpe match { case tpe: Types.NamedType => tpe.designator match { case name: Names.TypeName => Some(tpe) @@ -1181,165 +1181,165 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. case _ => None } - def TypeRef_name(self: TypeRef) given (ctx: Context): String = self.name.toString - def TypeRef_qualifier(self: TypeRef) given (ctx: Context): TypeOrBounds = self.prefix + def TypeRef_name(self: TypeRef) given Context: String = self.name.toString + def TypeRef_qualifier(self: TypeRef) given Context: TypeOrBounds = self.prefix type SuperType = Types.SuperType - def matchSuperType(tpe: TypeOrBounds) given (ctx: Context): Option[SuperType] = tpe match { + def matchSuperType(tpe: TypeOrBounds) given Context: Option[SuperType] = tpe match { case tpe: Types.SuperType => Some(tpe) case _ => None } - def SuperType_thistpe(self: SuperType) given (ctx: Context): Type = self.thistpe - def SuperType_supertpe(self: SuperType) given (ctx: Context): Type = self.supertpe + def SuperType_thistpe(self: SuperType) given Context: Type = self.thistpe + def SuperType_supertpe(self: SuperType) given Context: Type = self.supertpe type Refinement = Types.RefinedType - def matchRefinement(tpe: TypeOrBounds) given (ctx: Context): Option[Refinement] = tpe match { + def matchRefinement(tpe: TypeOrBounds) given Context: Option[Refinement] = tpe match { case tpe: Types.RefinedType => Some(tpe) case _ => None } - def Refinement_parent(self: Refinement) given (ctx: Context): Type = self.parent - def Refinement_name(self: Refinement) given (ctx: Context): String = self.refinedName.toString - def Refinement_info(self: Refinement) given (ctx: Context): TypeOrBounds = self.refinedInfo + def Refinement_parent(self: Refinement) given Context: Type = self.parent + def Refinement_name(self: Refinement) given Context: String = self.refinedName.toString + def Refinement_info(self: Refinement) given Context: TypeOrBounds = self.refinedInfo type AppliedType = Types.AppliedType - def matchAppliedType(tpe: TypeOrBounds) given (ctx: Context): Option[AppliedType] = tpe match { + def matchAppliedType(tpe: TypeOrBounds) given Context: Option[AppliedType] = tpe match { case tpe: Types.AppliedType => Some(tpe) case _ => None } - def AppliedType_tycon(self: AppliedType) given (ctx: Context): Type = self.tycon - def AppliedType_args(self: AppliedType) given (ctx: Context): List[TypeOrBounds] = self.args + def AppliedType_tycon(self: AppliedType) given Context: Type = self.tycon + def AppliedType_args(self: AppliedType) given Context: List[TypeOrBounds] = self.args type AnnotatedType = Types.AnnotatedType - def matchAnnotatedType(tpe: TypeOrBounds) given (ctx: Context): Option[AnnotatedType] = tpe match { + def matchAnnotatedType(tpe: TypeOrBounds) given Context: Option[AnnotatedType] = tpe match { case tpe: Types.AnnotatedType => Some(tpe) case _ => None } - def AnnotatedType_underlying(self: AnnotatedType) given (ctx: Context): Type = self.underlying.stripTypeVar - def AnnotatedType_annot(self: AnnotatedType) given (ctx: Context): Term = self.annot.tree + def AnnotatedType_underlying(self: AnnotatedType) given Context: Type = self.underlying.stripTypeVar + def AnnotatedType_annot(self: AnnotatedType) given Context: Term = self.annot.tree type AndType = Types.AndType - def matchAndType(tpe: TypeOrBounds) given (ctx: Context): Option[AndType] = tpe match { + def matchAndType(tpe: TypeOrBounds) given Context: Option[AndType] = tpe match { case tpe: Types.AndType => Some(tpe) case _ => None } - def AndType_left(self: AndType) given (ctx: Context): Type = self.tp1.stripTypeVar - def AndType_right(self: AndType) given (ctx: Context): Type = self.tp2.stripTypeVar + def AndType_left(self: AndType) given Context: Type = self.tp1.stripTypeVar + def AndType_right(self: AndType) given Context: Type = self.tp2.stripTypeVar type OrType = Types.OrType - def matchOrType(tpe: TypeOrBounds) given (ctx: Context): Option[OrType] = tpe match { + def matchOrType(tpe: TypeOrBounds) given Context: Option[OrType] = tpe match { case tpe: Types.OrType => Some(tpe) case _ => None } - def OrType_left(self: OrType) given (ctx: Context): Type = self.tp1.stripTypeVar - def OrType_right(self: OrType) given (ctx: Context): Type = self.tp2.stripTypeVar + def OrType_left(self: OrType) given Context: Type = self.tp1.stripTypeVar + def OrType_right(self: OrType) given Context: Type = self.tp2.stripTypeVar type MatchType = Types.MatchType - def matchMatchType(tpe: TypeOrBounds) given (ctx: Context): Option[MatchType] = tpe match { + def matchMatchType(tpe: TypeOrBounds) given Context: Option[MatchType] = tpe match { case tpe: Types.MatchType => Some(tpe) case _ => None } - def MatchType_bound(self: MatchType) given (ctx: Context): Type = self.bound - def MatchType_scrutinee(self: MatchType) given (ctx: Context): Type = self.scrutinee - def MatchType_cases(self: MatchType) given (ctx: Context): List[Type] = self.cases + def MatchType_bound(self: MatchType) given Context: Type = self.bound + def MatchType_scrutinee(self: MatchType) given Context: Type = self.scrutinee + def MatchType_cases(self: MatchType) given Context: List[Type] = self.cases type ByNameType = Types.ExprType - def matchByNameType(tpe: TypeOrBounds) given (ctx: Context): Option[ByNameType] = tpe match { + def matchByNameType(tpe: TypeOrBounds) given Context: Option[ByNameType] = tpe match { case tpe: Types.ExprType => Some(tpe) case _ => None } - def ByNameType_underlying(self: ByNameType) given (ctx: Context): Type = self.resType.stripTypeVar + def ByNameType_underlying(self: ByNameType) given Context: Type = self.resType.stripTypeVar type ParamRef = Types.ParamRef - def matchParamRef(tpe: TypeOrBounds) given (ctx: Context): Option[ParamRef] = tpe match { + def matchParamRef(tpe: TypeOrBounds) given Context: Option[ParamRef] = tpe match { case tpe: Types.TypeParamRef => Some(tpe) case tpe: Types.TermParamRef => Some(tpe) case _ => None } - def ParamRef_binder(self: ParamRef) given (ctx: Context): LambdaType[TypeOrBounds] = + def ParamRef_binder(self: ParamRef) given Context: LambdaType[TypeOrBounds] = self.binder.asInstanceOf[LambdaType[TypeOrBounds]] // Cast to tpd - def ParamRef_paramNum(self: ParamRef) given (ctx: Context): Int = self.paramNum + def ParamRef_paramNum(self: ParamRef) given Context: Int = self.paramNum type ThisType = Types.ThisType - def matchThisType(tpe: TypeOrBounds) given (ctx: Context): Option[ThisType] = tpe match { + def matchThisType(tpe: TypeOrBounds) given Context: Option[ThisType] = tpe match { case tpe: Types.ThisType => Some(tpe) case _ => None } - def ThisType_tref(self: ThisType) given (ctx: Context): Type = self.tref + def ThisType_tref(self: ThisType) given Context: Type = self.tref type RecursiveThis = Types.RecThis - def matchRecursiveThis(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveThis] = tpe match { + def matchRecursiveThis(tpe: TypeOrBounds) given Context: Option[RecursiveThis] = tpe match { case tpe: Types.RecThis => Some(tpe) case _ => None } - def RecursiveThis_binder(self: RecursiveThis) given (ctx: Context): RecursiveType = self.binder + def RecursiveThis_binder(self: RecursiveThis) given Context: RecursiveType = self.binder type RecursiveType = Types.RecType - def matchRecursiveType(tpe: TypeOrBounds) given (ctx: Context): Option[RecursiveType] = tpe match { + def matchRecursiveType(tpe: TypeOrBounds) given Context: Option[RecursiveType] = tpe match { case tpe: Types.RecType => Some(tpe) case _ => None } - def RecursiveType_underlying(self: RecursiveType) given (ctx: Context): Type = self.underlying.stripTypeVar + def RecursiveType_underlying(self: RecursiveType) given Context: Type = self.underlying.stripTypeVar type LambdaType[ParamInfo] = Types.LambdaType { type PInfo = ParamInfo } type MethodType = Types.MethodType - def matchMethodType(tpe: TypeOrBounds) given (ctx: Context): Option[MethodType] = tpe match { + def matchMethodType(tpe: TypeOrBounds) given Context: Option[MethodType] = tpe match { case tpe: Types.MethodType => Some(tpe) case _ => None } def MethodType_isErased(self: MethodType): Boolean = self.isErasedMethod def MethodType_isImplicit(self: MethodType): Boolean = self.isImplicitMethod - def MethodType_paramNames(self: MethodType) given (ctx: Context): List[String] = self.paramNames.map(_.toString) - def MethodType_paramTypes(self: MethodType) given (ctx: Context): List[Type] = self.paramInfos - def MethodType_resType(self: MethodType) given (ctx: Context): Type = self.resType + def MethodType_paramNames(self: MethodType) given Context: List[String] = self.paramNames.map(_.toString) + def MethodType_paramTypes(self: MethodType) given Context: List[Type] = self.paramInfos + def MethodType_resType(self: MethodType) given Context: Type = self.resType type PolyType = Types.PolyType - def matchPolyType(tpe: TypeOrBounds) given (ctx: Context): Option[PolyType] = tpe match { + def matchPolyType(tpe: TypeOrBounds) given Context: Option[PolyType] = tpe match { case tpe: Types.PolyType => Some(tpe) case _ => None } - def PolyType_paramNames(self: PolyType) given (ctx: Context): List[String] = self.paramNames.map(_.toString) - def PolyType_paramBounds(self: PolyType) given (ctx: Context): List[TypeBounds] = self.paramInfos - def PolyType_resType(self: PolyType) given (ctx: Context): Type = self.resType + def PolyType_paramNames(self: PolyType) given Context: List[String] = self.paramNames.map(_.toString) + def PolyType_paramBounds(self: PolyType) given Context: List[TypeBounds] = self.paramInfos + def PolyType_resType(self: PolyType) given Context: Type = self.resType type TypeLambda = Types.TypeLambda - def matchTypeLambda(tpe: TypeOrBounds) given (ctx: Context): Option[TypeLambda] = tpe match { + def matchTypeLambda(tpe: TypeOrBounds) given Context: Option[TypeLambda] = tpe match { case tpe: Types.TypeLambda => Some(tpe) case _ => None } - def TypeLambda_paramNames(self: TypeLambda) given (ctx: Context): List[String] = self.paramNames.map(_.toString) - def TypeLambda_paramBounds(self: TypeLambda) given (ctx: Context): List[TypeBounds] = self.paramInfos - def TypeLambda_resType(self: TypeLambda) given (ctx: Context): Type = self.resType + def TypeLambda_paramNames(self: TypeLambda) given Context: List[String] = self.paramNames.map(_.toString) + def TypeLambda_paramBounds(self: TypeLambda) given Context: List[TypeBounds] = self.paramInfos + def TypeLambda_resType(self: TypeLambda) given Context: Type = self.resType // // IMPORT SELECTORS @@ -1349,33 +1349,33 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type SimpleSelector = untpd.Ident - def matchSimpleSelector(self: ImportSelector) given (ctx: Context): Option[SimpleSelector] = self match { + def matchSimpleSelector(self: ImportSelector) given Context: Option[SimpleSelector] = self match { case self: untpd.Ident => Some(self) case _ => None } - def SimpleSelector_selection(self: SimpleSelector) given (ctx: Context): Id = self + def SimpleSelector_selection(self: SimpleSelector) given Context: Id = self type RenameSelector = untpd.Thicket - def matchRenameSelector(self: ImportSelector) given (ctx: Context): Option[RenameSelector] = self match { + def matchRenameSelector(self: ImportSelector) given Context: Option[RenameSelector] = self match { case self @ Trees.Thicket((id1: untpd.Ident) :: (id2: untpd.Ident) :: Nil) if id2.name != nme.WILDCARD => Some(self) case _ => None } - def RenameSelector_from(self: RenameSelector) given (ctx: Context): Id = + def RenameSelector_from(self: RenameSelector) given Context: Id = self.trees.head.asInstanceOf[untpd.Ident] - def RenameSelector_to(self: RenameSelector) given (ctx: Context): Id = + def RenameSelector_to(self: RenameSelector) given Context: Id = self.trees.last.asInstanceOf[untpd.Ident] type OmitSelector = untpd.Thicket - def matchOmitSelector(self: ImportSelector) given (ctx: Context): Option[OmitSelector] = self match { + def matchOmitSelector(self: ImportSelector) given Context: Option[OmitSelector] = self match { case self @ Trees.Thicket((id: untpd.Ident) :: Trees.Ident(nme.WILDCARD) :: Nil) => Some(self) case _ => None } - def SimpleSelector_omited(self: OmitSelector) given (ctx: Context): Id = + def SimpleSelector_omited(self: OmitSelector) given Context: Id = self.trees.head.asInstanceOf[untpd.Ident] // @@ -1384,9 +1384,9 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Id = untpd.Ident - def Id_pos(self: Id) given (ctx: Context): Position = self.sourcePos + def Id_pos(self: Id) given Context: Position = self.sourcePos - def Id_name(self: Id) given (ctx: Context): String = self.name.toString + def Id_name(self: Id) given Context: String = self.name.toString // // SIGNATURES @@ -1470,27 +1470,27 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. type Symbol = core.Symbols.Symbol - def Symbol_owner(self: Symbol) given (ctx: Context): Symbol = self.owner + def Symbol_owner(self: Symbol) given Context: Symbol = self.owner - def Symbol_flags(self: Symbol) given (ctx: Context): Flags = self.flags + def Symbol_flags(self: Symbol) given Context: Flags = self.flags - def Symbol_privateWithin(self: Symbol) given (ctx: Context): Option[Type] = { + def Symbol_privateWithin(self: Symbol) given Context: Option[Type] = { val within = self.privateWithin if (within.exists && !self.is(core.Flags.Protected)) Some(within.typeRef) else None } - def Symbol_protectedWithin(self: Symbol) given (ctx: Context): Option[Type] = { + def Symbol_protectedWithin(self: Symbol) given Context: Option[Type] = { val within = self.privateWithin if (within.exists && self.is(core.Flags.Protected)) Some(within.typeRef) else None } - def Symbol_name(self: Symbol) given (ctx: Context): String = self.name.toString + def Symbol_name(self: Symbol) given Context: String = self.name.toString - def Symbol_fullName(self: Symbol) given (ctx: Context): String = self.fullName.toString + def Symbol_fullName(self: Symbol) given Context: String = self.fullName.toString - def Symbol_pos(self: Symbol) given (ctx: Context): Position = self.sourcePos + def Symbol_pos(self: Symbol) given Context: Position = self.sourcePos def Symbol_localContext(self: Symbol) given (ctx: Context): Context = { if (self.exists) ctx.withOwner(self) @@ -1506,60 +1506,60 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. } docCtx.docstring(self) } - def Symbol_annots(self: Symbol) given (ctx: Context): List[Term] = { + def Symbol_annots(self: Symbol) given Context: List[Term] = { self.annotations.flatMap { case _: core.Annotations.LazyBodyAnnotation => Nil case annot => annot.tree :: Nil } } - def Symbol_isDefinedInCurrentRun(self: Symbol) given (ctx: Context): Boolean = + def Symbol_isDefinedInCurrentRun(self: Symbol) given Context: Boolean = self.topLevelClass.asClass.isDefinedInCurrentRun - def Symbol_isLocalDummy(self: Symbol) given (ctx: Context): Boolean = self.isLocalDummy - def Symbol_isRefinementClass(self: Symbol) given (ctx: Context): Boolean = self.isRefinementClass - def Symbol_isAliasType(self: Symbol) given (ctx: Context): Boolean = self.isAliasType - def Symbol_isAnonymousClass(self: Symbol) given (ctx: Context): Boolean = self.isAnonymousClass - def Symbol_isAnonymousFunction(self: Symbol) given (ctx: Context): Boolean = self.isAnonymousFunction - def Symbol_isAbstractType(self: Symbol) given (ctx: Context): Boolean = self.isAbstractType - def Symbol_isClassConstructor(self: Symbol) given (ctx: Context): Boolean = self.isClassConstructor + def Symbol_isLocalDummy(self: Symbol) given Context: Boolean = self.isLocalDummy + def Symbol_isRefinementClass(self: Symbol) given Context: Boolean = self.isRefinementClass + def Symbol_isAliasType(self: Symbol) given Context: Boolean = self.isAliasType + def Symbol_isAnonymousClass(self: Symbol) given Context: Boolean = self.isAnonymousClass + def Symbol_isAnonymousFunction(self: Symbol) given Context: Boolean = self.isAnonymousFunction + def Symbol_isAbstractType(self: Symbol) given Context: Boolean = self.isAbstractType + def Symbol_isClassConstructor(self: Symbol) given Context: Boolean = self.isClassConstructor type PackageDefSymbol = core.Symbols.Symbol - def matchPackageDefSymbol(symbol: Symbol) given (ctx: Context): Option[PackageDefSymbol] = + def matchPackageDefSymbol(symbol: Symbol) given Context: Option[PackageDefSymbol] = if (symbol.is(core.Flags.Package)) Some(symbol) else None - def PackageDefSymbol_tree(self: PackageDefSymbol) given (ctx: Context): PackageDef = + def PackageDefSymbol_tree(self: PackageDefSymbol) given Context: PackageDef = FromSymbol.packageDefFromSym(self) type TypeSymbol = core.Symbols.TypeSymbol - def matchTypeSymbol(symbol: Symbol) given (ctx: Context): Option[TypeSymbol] = + def matchTypeSymbol(symbol: Symbol) given Context: Option[TypeSymbol] = if (symbol.isType) Some(symbol.asType) else None type ClassDefSymbol = core.Symbols.ClassSymbol - def matchClassDefSymbol(symbol: Symbol) given (ctx: Context): Option[ClassDefSymbol] = + def matchClassDefSymbol(symbol: Symbol) given Context: Option[ClassDefSymbol] = if (symbol.isClass) Some(symbol.asClass) else None - def ClassDefSymbol_tree(self: ClassDefSymbol) given (ctx: Context): ClassDef = + def ClassDefSymbol_tree(self: ClassDefSymbol) given Context: ClassDef = FromSymbol.classDef(self) - def ClassDefSymbol_fields(self: Symbol) given (ctx: Context): List[Symbol] = + def ClassDefSymbol_fields(self: Symbol) given Context: List[Symbol] = self.unforcedDecls.filter(isField) - def ClassDefSymbol_field(self: Symbol)(name: String) given (ctx: Context): Option[Symbol] = { + def ClassDefSymbol_field(self: Symbol)(name: String) given Context: Option[Symbol] = { val sym = self.unforcedDecls.find(sym => sym.name == name.toTermName) if (sym.exists && isField(sym)) Some(sym) else None } - def ClassDefSymbol_classMethod(self: Symbol)(name: String) given (ctx: Context): List[DefDefSymbol] = { + def ClassDefSymbol_classMethod(self: Symbol)(name: String) given Context: List[DefDefSymbol] = { self.typeRef.decls.iterator.collect { case sym if isMethod(sym) && sym.name.toString == name => sym.asTerm }.toList } - def ClassDefSymbol_classMethods(self: Symbol) given (ctx: Context): List[DefDefSymbol] = { + def ClassDefSymbol_classMethods(self: Symbol) given Context: List[DefDefSymbol] = { self.typeRef.decls.iterator.collect { case sym if isMethod(sym) => sym.asTerm }.toList @@ -1567,110 +1567,110 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. private def appliedTypeRef(sym: Symbol): Type = sym.typeRef.appliedTo(sym.typeParams.map(_.typeRef)) - def ClassDefSymbol_method(self: Symbol)(name: String) given (ctx: Context): List[DefDefSymbol] = { + def ClassDefSymbol_method(self: Symbol)(name: String) given Context: List[DefDefSymbol] = { appliedTypeRef(self).allMembers.iterator.map(_.symbol).collect { case sym if isMethod(sym) && sym.name.toString == name => sym.asTerm }.toList } - def ClassDefSymbol_methods(self: Symbol) given (ctx: Context): List[DefDefSymbol] = { + def ClassDefSymbol_methods(self: Symbol) given Context: List[DefDefSymbol] = { appliedTypeRef(self).allMembers.iterator.map(_.symbol).collect { case sym if isMethod(sym) => sym.asTerm }.toList } - private def isMethod(sym: Symbol) given (ctx: Context): Boolean = + private def isMethod(sym: Symbol) given Context: Boolean = sym.isTerm && sym.is(Flags.Method) && !sym.isConstructor - def ClassDefSymbol_caseFields(self: Symbol) given (ctx: Context): List[ValDefSymbol] = { + def ClassDefSymbol_caseFields(self: Symbol) given Context: List[ValDefSymbol] = { if (!self.isClass) Nil else self.asClass.paramAccessors.collect { case sym if sym.is(Flags.CaseAccessor) => sym.asTerm } } - def ClassDefSymbol_companionClass(self: Symbol) given (ctx: Context): Option[ClassDefSymbol] = { + def ClassDefSymbol_companionClass(self: Symbol) given Context: Option[ClassDefSymbol] = { val sym = self.companionModule.companionClass if (sym.exists) Some(sym.asClass) else None } - def ClassDefSymbol_companionModule(self: Symbol) given (ctx: Context): Option[ValDefSymbol] = { + def ClassDefSymbol_companionModule(self: Symbol) given Context: Option[ValDefSymbol] = { val sym = self.companionModule if (sym.exists) Some(sym.asTerm) else None } - def ClassDefSymbol_moduleClass(self: Symbol) given (ctx: Context): Option[Symbol] = { + def ClassDefSymbol_moduleClass(self: Symbol) given Context: Option[Symbol] = { val sym = self.moduleClass if (sym.exists) Some(sym.asTerm) else None } - private def isField(sym: Symbol) given (ctx: Context): Boolean = sym.isTerm && !sym.is(Flags.Method) + private def isField(sym: Symbol) given Context: Boolean = sym.isTerm && !sym.is(Flags.Method) def ClassDefSymbol_of(fullName: String) given (ctx: Context): ClassDefSymbol = ctx.requiredClass(fullName) type TypeDefSymbol = core.Symbols.TypeSymbol - def matchTypeDefSymbol(symbol: Symbol) given (ctx: Context): Option[TypeDefSymbol] = + def matchTypeDefSymbol(symbol: Symbol) given Context: Option[TypeDefSymbol] = if (symbol.isType) Some(symbol.asType) else None - def TypeDefSymbol_tree(self: TypeDefSymbol) given (ctx: Context): TypeDef = + def TypeDefSymbol_tree(self: TypeDefSymbol) given Context: TypeDef = FromSymbol.typeDefFromSym(self) - def TypeDefSymbol_isTypeParam(self: TypeDefSymbol) given (ctx: Context): Boolean = + def TypeDefSymbol_isTypeParam(self: TypeDefSymbol) given Context: Boolean = self.isTypeParam type TypeBindSymbol = core.Symbols.TypeSymbol - def matchTypeBindSymbol(symbol: Symbol) given (ctx: Context): Option[TypeBindSymbol] = + def matchTypeBindSymbol(symbol: Symbol) given Context: Option[TypeBindSymbol] = if (symbol.isType && symbol.is(core.Flags.Case)) Some(symbol.asType) else None - def TypeBindSymbol_tree(self: TypeBindSymbol) given (ctx: Context): TypeBind = + def TypeBindSymbol_tree(self: TypeBindSymbol) given Context: TypeBind = FromSymbol.typeBindFromSym(self) type TermSymbol = core.Symbols.TermSymbol - def matchTermSymbol(symbol: Symbol) given (ctx: Context): Option[TermSymbol] = + def matchTermSymbol(symbol: Symbol) given Context: Option[TermSymbol] = if (symbol.isTerm) Some(symbol.asTerm) else None type DefDefSymbol = core.Symbols.TermSymbol - def matchDefDefSymbol(symbol: Symbol) given (ctx: Context): Option[DefDefSymbol] = + def matchDefDefSymbol(symbol: Symbol) given Context: Option[DefDefSymbol] = if (symbol.isTerm && symbol.is(core.Flags.Method)) Some(symbol.asTerm) else None - def DefDefSymbol_tree(self: DefDefSymbol) given (ctx: Context): DefDef = + def DefDefSymbol_tree(self: DefDefSymbol) given Context: DefDef = FromSymbol.defDefFromSym(self) - def DefDefSymbol_signature(self: DefDefSymbol) given (ctx: Context): Signature = + def DefDefSymbol_signature(self: DefDefSymbol) given Context: Signature = self.signature type ValDefSymbol = core.Symbols.TermSymbol - def matchValDefSymbol(symbol: Symbol) given (ctx: Context): Option[ValDefSymbol] = + def matchValDefSymbol(symbol: Symbol) given Context: Option[ValDefSymbol] = if (symbol.isTerm && !symbol.is(core.Flags.Method) && !symbol.is(core.Flags.Case)) Some(symbol.asTerm) else None - def ValDefSymbol_tree(self: ValDefSymbol) given (ctx: Context): ValDef = + def ValDefSymbol_tree(self: ValDefSymbol) given Context: ValDef = FromSymbol.valDefFromSym(self) - def ValDefSymbol_moduleClass(self: ValDefSymbol) given (ctx: Context): Option[ClassDefSymbol] = { + def ValDefSymbol_moduleClass(self: ValDefSymbol) given Context: Option[ClassDefSymbol] = { val sym = self.moduleClass if (sym.exists) Some(sym.asClass) else None } - def ValDefSymbol_companionClass(self: ValDefSymbol) given (ctx: Context): Option[ClassDefSymbol] = { + def ValDefSymbol_companionClass(self: ValDefSymbol) given Context: Option[ClassDefSymbol] = { val sym = self.companionClass if (sym.exists) Some(sym.asClass) else None } type BindSymbol = core.Symbols.TermSymbol - def matchBindSymbol(symbol: Symbol) given (ctx: Context): Option[BindSymbol] = + def matchBindSymbol(symbol: Symbol) given Context: Option[BindSymbol] = if (symbol.isTerm && symbol.is(core.Flags.Case)) Some(symbol.asTerm) else None - def BindSymbol_tree(self: BindSymbol) given (ctx: Context): Bind = + def BindSymbol_tree(self: BindSymbol) given Context: Bind = FromSymbol.bindFromSym(self) type NoSymbol = core.Symbols.NoSymbol.type - def matchNoSymbol(symbol: Symbol) given (ctx: Context): Boolean = symbol eq core.Symbols.NoSymbol + def matchNoSymbol(symbol: Symbol) given Context: Boolean = symbol eq core.Symbols.NoSymbol // // FLAGS @@ -1728,11 +1728,11 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. // /** View this expression `quoted.Expr[_]` as a `Term` */ - def QuotedExpr_unseal(self: scala.quoted.Expr[_]) given (ctx: Context): Term = + def QuotedExpr_unseal(self: scala.quoted.Expr[_]) given Context: Term = PickledQuotes.quotedExprToTree(self) /** View this expression `quoted.Type[_]` as a `TypeTree` */ - def QuotedType_unseal(self: scala.quoted.Type[_]) given (ctx: Context): TypeTree = + def QuotedType_unseal(self: scala.quoted.Type[_]) given Context: TypeTree = PickledQuotes.quotedTypeToTree(self) /** Convert `Term` to an `quoted.Expr[Any]` */ @@ -1859,34 +1859,34 @@ class KernelImpl(val rootContext: core.Contexts.Context, val rootPosition: util. ctx.typer.inferImplicitArg(tpe, rootPosition.span) type ImplicitSearchSuccess = Tree - def matchImplicitSearchSuccess(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchSuccess] = isr.tpe match { + def matchImplicitSearchSuccess(isr: ImplicitSearchResult) given Context: Option[ImplicitSearchSuccess] = isr.tpe match { case _: SearchFailureType => None case _ => Some(isr) } - def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess) given (ctx: Context): Term = self + def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess) given Context: Term = self type ImplicitSearchFailure = Tree - def matchImplicitSearchFailure(isr: ImplicitSearchResult) given (ctx: Context): Option[ImplicitSearchFailure] = isr.tpe match { + def matchImplicitSearchFailure(isr: ImplicitSearchResult) given Context: Option[ImplicitSearchFailure] = isr.tpe match { case _: SearchFailureType => Some(isr) case _ => None } - def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure) given (ctx: Context): String = + def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure) given Context: String = self.tpe.asInstanceOf[SearchFailureType].explanation type DivergingImplicit = Tree - def matchDivergingImplicit(isr: ImplicitSearchResult) given (ctx: Context): Option[DivergingImplicit] = isr.tpe match { + def matchDivergingImplicit(isr: ImplicitSearchResult) given Context: Option[DivergingImplicit] = isr.tpe match { case _: Implicits.DivergingImplicit => Some(isr) case _ => None } type NoMatchingImplicits = Tree - def matchNoMatchingImplicits(isr: ImplicitSearchResult) given (ctx: Context): Option[NoMatchingImplicits] = isr.tpe match { + def matchNoMatchingImplicits(isr: ImplicitSearchResult) given Context: Option[NoMatchingImplicits] = isr.tpe match { case _: Implicits.NoMatchingImplicits => Some(isr) case _ => None } type AmbiguousImplicits = Tree - def matchAmbiguousImplicits(isr: ImplicitSearchResult) given (ctx: Context): Option[AmbiguousImplicits] = isr.tpe match { + def matchAmbiguousImplicits(isr: ImplicitSearchResult) given Context: Option[AmbiguousImplicits] = isr.tpe match { case _: Implicits.AmbiguousImplicits => Some(isr) case _ => None }