diff --git a/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionCompilerInterface.scala b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionCompilerInterface.scala index a9e555953819..201d18e558e9 100644 --- a/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionCompilerInterface.scala +++ b/compiler/src/dotty/tools/dotc/tastyreflect/ReflectionCompilerInterface.scala @@ -23,7 +23,7 @@ import scala.tasty.reflect.IsInstanceOf class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extends CompilerInterface { import tpd._ - private implicit def ctx: core.Contexts.Context = rootContext + private given core.Contexts.Context = rootContext def settings: Settings = rootContext.settings @@ -71,16 +71,16 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend // REPORTING // /////////////// - def error(msg: => String, pos: Position)(given ctx: Context): Unit = + def error(msg: => String, pos: Position)(using ctx: Context): Unit = ctx.error(msg, pos) - def error(msg: => String, sourceFile: SourceFile, start: Int, end: Int)(given ctx: Context): Unit = + def error(msg: => String, sourceFile: SourceFile, start: Int, end: Int)(using ctx: Context): Unit = ctx.error(msg, util.SourcePosition(sourceFile, util.Spans.Span(start, end))) - def warning(msg: => String, pos: Position)(given ctx: Context): Unit = + def warning(msg: => String, pos: Position)(using ctx: Context): Unit = ctx.warning(msg, pos) - def warning(msg: => String, sourceFile: SourceFile, start: Int, end: Int)(given ctx: Context): Unit = + def warning(msg: => String, sourceFile: SourceFile, start: Int, end: Int)(using ctx: Context): Unit = ctx.error(msg, util.SourcePosition(sourceFile, util.Spans.Span(start, end))) @@ -99,30 +99,30 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type Tree = tpd.Tree - def Tree_pos(self: Tree)(given Context): Position = self.sourcePos - def Tree_symbol(self: Tree)(given Context): Symbol = self.symbol + def Tree_pos(self: Tree)(using ctx: Context): Position = self.sourcePos + def Tree_symbol(self: Tree)(using ctx: Context): Symbol = self.symbol type PackageClause = tpd.PackageDef - def isInstanceOfPackageClause(given ctx: Context): IsInstanceOf[PackageClause] = new { + def isInstanceOfPackageClause(using ctx: Context): IsInstanceOf[PackageClause] = new { def runtimeClass: Class[?] = classOf[PackageClause] override def unapply(x: Any): Option[PackageClause] = x match case x: tpd.PackageDef => Some(x) case _ => None } - def PackageClause_pid(self: PackageClause)(given Context): Ref = self.pid - def PackageClause_stats(self: PackageClause)(given Context): List[Tree] = self.stats + def PackageClause_pid(self: PackageClause)(using ctx: Context): Ref = self.pid + def PackageClause_stats(self: PackageClause)(using ctx: Context): List[Tree] = self.stats - def PackageClause_apply(pid: Ref, stats: List[Tree])(given Context): PackageClause = + def PackageClause_apply(pid: Ref, stats: List[Tree])(using ctx: Context): PackageClause = withDefaultPos(tpd.PackageDef(pid.asInstanceOf[tpd.RefTree], stats)) - def PackageClause_copy(original: Tree)(pid: Ref, stats: List[Tree])(given Context): PackageClause = + def PackageClause_copy(original: Tree)(pid: Ref, stats: List[Tree])(using ctx: Context): PackageClause = tpd.cpy.PackageDef(original)(pid, stats) type Statement = tpd.Tree - def isInstanceOfStatement(given ctx: Context): IsInstanceOf[Statement] = new { + def isInstanceOfStatement(using ctx: Context): IsInstanceOf[Statement] = new { def runtimeClass: Class[?] = classOf[Statement] override def unapply(x: Any): Option[Statement] = x match case _: PatternTree => None @@ -133,7 +133,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type Import = tpd.Import - def isInstanceOfImport(given ctx: Context): IsInstanceOf[Import] = new { + def isInstanceOfImport(using ctx: Context): IsInstanceOf[Import] = new { def runtimeClass: Class[?] = classOf[Import] override def unapply(x: Any): Option[Import] = x match case tree: tpd.Import => Some(tree) @@ -141,18 +141,18 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend } def Import_implied(self: Import): Boolean = false // TODO: adapt to new import scheme - def Import_expr(self: Import)(given Context): Tree = self.expr - def Import_selectors(self: Import)(given Context): List[ImportSelector] = self.selectors + def Import_expr(self: Import)(using ctx: Context): Tree = self.expr + def Import_selectors(self: Import)(using ctx: Context): List[ImportSelector] = self.selectors - def Import_apply(expr: Term, selectors: List[ImportSelector])(given Context): Import = + def Import_apply(expr: Term, selectors: List[ImportSelector])(using ctx: Context): Import = withDefaultPos(tpd.Import(expr, selectors)) - def Import_copy(original: Tree)(expr: Term, selectors: List[ImportSelector])(given Context): Import = + def Import_copy(original: Tree)(expr: Term, selectors: List[ImportSelector])(using ctx: Context): Import = tpd.cpy.Import(original)(expr, selectors) type Definition = tpd.Tree - def isInstanceOfDefinition(given ctx: Context): IsInstanceOf[Definition] = new { + def isInstanceOfDefinition(using ctx: Context): IsInstanceOf[Definition] = new { def runtimeClass: Class[?] = classOf[Definition] override def unapply(x: Any): Option[Definition] = x match case x: tpd.MemberDef => Some(x) @@ -160,103 +160,103 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - def Definition_name(self: Definition)(given Context): String = self match { + def Definition_name(self: Definition)(using 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 isInstanceOfPackageDef(given ctx: Context): IsInstanceOf[PackageDef] = new { + def isInstanceOfPackageDef(using ctx: Context): IsInstanceOf[PackageDef] = new { def runtimeClass: Class[?] = classOf[PackageDef] override def unapply(x: Any): Option[PackageDef] = x match case x: PackageDefinition => Some(x) case _ => None } - def PackageDef_owner(self: PackageDef)(given Context): PackageDef = packageDefFromSym(self.symbol.owner) + def PackageDef_owner(self: PackageDef)(using ctx: Context): PackageDef = packageDefFromSym(self.symbol.owner) - def PackageDef_members(self: PackageDef)(given Context): List[Statement] = + def PackageDef_members(self: PackageDef)(using 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 type ClassDef = tpd.TypeDef - def isInstanceOfClassDef(given ctx: Context): IsInstanceOf[ClassDef] = new { + def isInstanceOfClassDef(using ctx: Context): IsInstanceOf[ClassDef] = new { def runtimeClass: Class[?] = classOf[ClassDef] override def unapply(x: Any): Option[ClassDef] = x match case x: tpd.TypeDef if x.isClassDef => Some(x) case _ => None } - 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_constructor(self: ClassDef)(using ctx: Context): DefDef = ClassDef_rhs(self).constr + def ClassDef_parents(self: ClassDef)(using ctx: Context): List[Term | TypeTree] = ClassDef_rhs(self).parents + def ClassDef_derived(self: ClassDef)(using ctx: Context): List[TypeTree] = ClassDef_rhs(self).derived.asInstanceOf[List[TypeTree]] + def ClassDef_self(self: ClassDef)(using ctx: Context): Option[ValDef] = optional(ClassDef_rhs(self).self) + def ClassDef_body(self: ClassDef)(using ctx: Context): List[Statement] = ClassDef_rhs(self).body private def ClassDef_rhs(self: ClassDef) = self.rhs.asInstanceOf[tpd.Template] - def ClassDef_copy(original: Tree)(name: String, constr: DefDef, parents: List[Term | TypeTree], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement])(given Context): ClassDef = { + def ClassDef_copy(original: Tree)(name: String, constr: DefDef, parents: List[Term | TypeTree], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement])(using 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 isInstanceOfTypeDef(given ctx: Context): IsInstanceOf[TypeDef] = new { + def isInstanceOfTypeDef(using ctx: Context): IsInstanceOf[TypeDef] = new { def runtimeClass: Class[?] = classOf[TypeDef] override def unapply(x: Any): Option[TypeDef] = x match case x: tpd.TypeDef if !x.isClassDef => Some(x) case _ => None } - def TypeDef_rhs(self: TypeDef)(given Context): TypeTree | TypeBoundsTree = self.rhs + def TypeDef_rhs(self: TypeDef)(using ctx: Context): TypeTree | TypeBoundsTree = self.rhs - def TypeDef_apply(symbol: Symbol)(given Context): TypeDef = withDefaultPos(tpd.TypeDef(symbol.asType)) - def TypeDef_copy(original: Tree)(name: String, rhs: TypeTree | TypeBoundsTree)(given Context): TypeDef = + def TypeDef_apply(symbol: Symbol)(using ctx: Context): TypeDef = withDefaultPos(tpd.TypeDef(symbol.asType)) + def TypeDef_copy(original: Tree)(name: String, rhs: TypeTree | TypeBoundsTree)(using ctx: Context): TypeDef = tpd.cpy.TypeDef(original)(name.toTypeName, rhs) type DefDef = tpd.DefDef - def isInstanceOfDefDef(given ctx: Context): IsInstanceOf[DefDef] = new { + def isInstanceOfDefDef(using ctx: Context): IsInstanceOf[DefDef] = new { def runtimeClass: Class[?] = classOf[DefDef] override def unapply(x: Any): Option[DefDef] = x match case x: tpd.DefDef => Some(x) case _ => None } - 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_typeParams(self: DefDef)(using ctx: Context): List[TypeDef] = self.tparams + def DefDef_paramss(self: DefDef)(using ctx: Context): List[List[ValDef]] = self.vparamss + def DefDef_returnTpt(self: DefDef)(using ctx: Context): TypeTree = self.tpt + def DefDef_rhs(self: DefDef)(using ctx: Context): Option[Tree] = optional(self.rhs) - def DefDef_apply(symbol: Symbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(given Context): DefDef = + def DefDef_apply(symbol: Symbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(using ctx: Context): DefDef = withDefaultPos(tpd.polyDefDef(symbol.asTerm, tparams => vparamss => rhsFn(tparams)(vparamss).getOrElse(tpd.EmptyTree))) - def DefDef_copy(original: Tree)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term])(given Context): DefDef = + def DefDef_copy(original: Tree)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term])(using ctx: Context): DefDef = tpd.cpy.DefDef(original)(name.toTermName, typeParams, paramss, tpt, rhs.getOrElse(tpd.EmptyTree)) type ValDef = tpd.ValDef - def isInstanceOfValDef(given ctx: Context): IsInstanceOf[ValDef] = new { + def isInstanceOfValDef(using ctx: Context): IsInstanceOf[ValDef] = new { def runtimeClass: Class[?] = classOf[ValDef] override def unapply(x: Any): Option[ValDef] = x match case x: tpd.ValDef => Some(x) case _ => None } - def ValDef_tpt(self: ValDef)(given Context): TypeTree = self.tpt - def ValDef_rhs(self: ValDef)(given Context): Option[Tree] = optional(self.rhs) + def ValDef_tpt(self: ValDef)(using ctx: Context): TypeTree = self.tpt + def ValDef_rhs(self: ValDef)(using ctx: Context): Option[Tree] = optional(self.rhs) - def ValDef_apply(symbol: Symbol, rhs: Option[Term])(given Context): ValDef = + def ValDef_apply(symbol: Symbol, rhs: Option[Term])(using ctx: Context): ValDef = tpd.ValDef(symbol.asTerm, rhs.getOrElse(tpd.EmptyTree)) - def ValDef_copy(original: Tree)(name: String, tpt: TypeTree, rhs: Option[Term])(given Context): ValDef = + def ValDef_copy(original: Tree)(name: String, tpt: TypeTree, rhs: Option[Term])(using ctx: Context): ValDef = tpd.cpy.ValDef(original)(name.toTermName, tpt, rhs.getOrElse(tpd.EmptyTree)) type Term = tpd.Tree - def isInstanceOfTerm(given ctx: Context): IsInstanceOf[Term] = new { + def isInstanceOfTerm(using ctx: Context): IsInstanceOf[Term] = new { def runtimeClass: Class[?] = classOf[Term] override def unapply(x: Any): Option[Term] = x match case _ if isInstanceOfUnapply.unapply(x).isDefined => None @@ -266,11 +266,11 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - 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 + def Term_tpe(self: Term)(using ctx: Context): Type = self.tpe + def Term_underlyingArgument(self: Term)(using ctx: Context): Term = self.underlyingArgument + def Term_underlying(self: Term)(using ctx: Context): Term = self.underlying - def Term_etaExpand(term: Term): Term = term.tpe.widen match { + def Term_etaExpand(term: Term)(using ctx: Context): Term = term.tpe.widen match { case mtpe: Types.MethodType if !mtpe.isParamDependent => val closureResType = mtpe.resType match { case t: Types.MethodType => t.toFunctionType() @@ -282,235 +282,235 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => term } - def TypeRef_apply(sym: Symbol)(given Context): TypeTree = { + def TypeRef_apply(sym: Symbol)(using ctx: Context): TypeTree = { assert(sym.isType) withDefaultPos(tpd.ref(sym).asInstanceOf[tpd.TypeTree]) } type Ref = tpd.RefTree - def isInstanceOfRef(given ctx: Context): IsInstanceOf[Ref] = new { + def isInstanceOfRef(using ctx: Context): IsInstanceOf[Ref] = new { def runtimeClass: Class[?] = classOf[Ref] override def unapply(x: Any): Option[Ref] = x match case x: tpd.RefTree if x.isTerm => Some(x) case _ => None } - def Ref_apply(sym: Symbol)(given Context): Ref = { + def Ref_apply(sym: Symbol)(using ctx: Context): Ref = { assert(sym.isTerm) withDefaultPos(tpd.ref(sym).asInstanceOf[tpd.RefTree]) } type Ident = tpd.Ident - def isInstanceOfIdent(given ctx: Context): IsInstanceOf[Ident] = new { + def isInstanceOfIdent(using ctx: Context): IsInstanceOf[Ident] = new { def runtimeClass: Class[?] = classOf[Ident] override def unapply(x: Any): Option[Ident] = x match case x: tpd.Ident if x.isTerm => Some(x) case _ => None } - def Ident_name(self: Ident)(given Context): String = self.name.show + def Ident_name(self: Ident)(using ctx: Context): String = self.name.show - def Ident_apply(tmref: TermRef)(given Context): Term = + def Ident_apply(tmref: TermRef)(using ctx: Context): Term = withDefaultPos(tpd.ref(tmref).asInstanceOf[Term]) - def Ident_copy(original: Tree)(name: String)(given Context): Ident = + def Ident_copy(original: Tree)(name: String)(using ctx: Context): Ident = tpd.cpy.Ident(original)(name.toTermName) type Select = tpd.Select - def isInstanceOfSelect(given ctx: Context): IsInstanceOf[Select] = new { + def isInstanceOfSelect(using ctx: Context): IsInstanceOf[Select] = new { def runtimeClass: Class[?] = classOf[Select] override def unapply(x: Any): Option[Select] = x match case x: tpd.Select if x.isTerm => Some(x) case _ => None } - 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] = + def Select_qualifier(self: Select)(using ctx: Context): Term = self.qualifier + def Select_name(self: Select)(using ctx: Context): String = self.name.toString + def Select_signature(self: Select)(using ctx: Context): Option[Signature] = if (self.symbol.signature == core.Signature.NotAMethod) None else Some(self.symbol.signature) - def Select_apply(qualifier: Term, symbol: Symbol)(given Context): Select = + def Select_apply(qualifier: Term, symbol: Symbol)(using ctx: Context): Select = withDefaultPos(tpd.Select(qualifier, Types.TermRef(qualifier.tpe, symbol))) - def Select_unique(qualifier: Term, name: String)(given Context): Select = { + def Select_unique(qualifier: Term, name: String)(using 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(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 Context): Apply = + def Select_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term])(using ctx: Context): Apply = withDefaultPos(tpd.applyOverloaded(qualifier, name.toTermName, args, targs, Types.WildcardType).asInstanceOf[Apply]) - def Select_copy(original: Tree)(qualifier: Term, name: String)(given Context): Select = + def Select_copy(original: Tree)(qualifier: Term, name: String)(using ctx: Context): Select = tpd.cpy.Select(original)(qualifier, name.toTermName) type Literal = tpd.Literal - def isInstanceOfLiteral(given ctx: Context): IsInstanceOf[Literal] = new { + def isInstanceOfLiteral(using ctx: Context): IsInstanceOf[Literal] = new { def runtimeClass: Class[?] = classOf[Literal] override def unapply(x: Any): Option[Literal] = x match case x: tpd.Literal => Some(x) case _ => None } - def Literal_constant(self: Literal)(given Context): Constant = self.const + def Literal_constant(self: Literal)(using ctx: Context): Constant = self.const - def Literal_apply(constant: Constant)(given Context): Literal = + def Literal_apply(constant: Constant)(using ctx: Context): Literal = withDefaultPos(tpd.Literal(constant)) - def Literal_copy(original: Tree)(constant: Constant)(given Context): Literal = + def Literal_copy(original: Tree)(constant: Constant)(using ctx: Context): Literal = tpd.cpy.Literal(original)(constant) type This = tpd.This - def isInstanceOfThis(given ctx: Context): IsInstanceOf[This] = new { + def isInstanceOfThis(using ctx: Context): IsInstanceOf[This] = new { def runtimeClass: Class[?] = classOf[This] override def unapply(x: Any): Option[This] = x match case x: tpd.This => Some(x) case _ => None } - def This_id(self: This)(given Context): Option[Id] = optional(self.qual) + def This_id(self: This)(using ctx: Context): Option[Id] = optional(self.qual) - def This_apply(cls: Symbol)(given Context): This = + def This_apply(cls: Symbol)(using ctx: Context): This = withDefaultPos(tpd.This(cls.asClass)) - def This_copy(original: Tree)(qual: Option[Id])(given Context): This = + def This_copy(original: Tree)(qual: Option[Id])(using ctx: Context): This = tpd.cpy.This(original)(qual.getOrElse(untpd.EmptyTypeIdent)) type New = tpd.New - def isInstanceOfNew(given ctx: Context): IsInstanceOf[New] = new { + def isInstanceOfNew(using ctx: Context): IsInstanceOf[New] = new { def runtimeClass: Class[?] = classOf[New] override def unapply(x: Any): Option[New] = x match case x: tpd.New => Some(x) case _ => None } - def New_tpt(self: New)(given Context): TypeTree = self.tpt + def New_tpt(self: New)(using ctx: Context): TypeTree = self.tpt - def New_apply(tpt: TypeTree)(given Context): New = withDefaultPos(tpd.New(tpt)) + def New_apply(tpt: TypeTree)(using ctx: Context): New = withDefaultPos(tpd.New(tpt)) - def New_copy(original: Tree)(tpt: TypeTree)(given Context): New = + def New_copy(original: Tree)(tpt: TypeTree)(using ctx: Context): New = tpd.cpy.New(original)(tpt) type NamedArg = tpd.NamedArg - def isInstanceOfNamedArg(given ctx: Context): IsInstanceOf[NamedArg] = new { + def isInstanceOfNamedArg(using ctx: Context): IsInstanceOf[NamedArg] = new { def runtimeClass: Class[?] = classOf[NamedArg] override def unapply(x: Any): 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 Context): String = self.name.toString - def NamedArg_value(self: NamedArg)(given Context): Term = self.arg + def NamedArg_name(self: NamedArg)(using ctx: Context): String = self.name.toString + def NamedArg_value(self: NamedArg)(using ctx: Context): Term = self.arg - def NamedArg_apply(name: String, arg: Term)(given Context): NamedArg = + def NamedArg_apply(name: String, arg: Term)(using ctx: Context): NamedArg = withDefaultPos(tpd.NamedArg(name.toTermName, arg)) - def NamedArg_copy(original: Tree)(name: String, arg: Term)(given Context): NamedArg = + def NamedArg_copy(original: Tree)(name: String, arg: Term)(using ctx: Context): NamedArg = tpd.cpy.NamedArg(original)(name.toTermName, arg) type Apply = tpd.Apply - def isInstanceOfApply(given ctx: Context): IsInstanceOf[Apply] = new { + def isInstanceOfApply(using ctx: Context): IsInstanceOf[Apply] = new { def runtimeClass: Class[?] = classOf[Apply] override def unapply(x: Any): Option[Apply] = x match case x: tpd.Apply => Some(x) case _ => None } - def Apply_fun(self: Apply)(given Context): Term = self.fun - def Apply_args(self: Apply)(given Context): List[Term] = self.args + def Apply_fun(self: Apply)(using ctx: Context): Term = self.fun + def Apply_args(self: Apply)(using ctx: Context): List[Term] = self.args - def Apply_apply(fn: Term, args: List[Term])(given Context): Apply = + def Apply_apply(fn: Term, args: List[Term])(using ctx: Context): Apply = withDefaultPos(tpd.Apply(fn, args)) - def Apply_copy(original: Tree)(fun: Term, args: List[Term])(given Context): Apply = + def Apply_copy(original: Tree)(fun: Term, args: List[Term])(using ctx: Context): Apply = tpd.cpy.Apply(original)(fun, args) type TypeApply = tpd.TypeApply - def isInstanceOfTypeApply(given ctx: Context): IsInstanceOf[TypeApply] = new { + def isInstanceOfTypeApply(using ctx: Context): IsInstanceOf[TypeApply] = new { def runtimeClass: Class[?] = classOf[TypeApply] override def unapply(x: Any): Option[TypeApply] = x match case x: tpd.TypeApply => Some(x) case _ => None } - def TypeApply_fun(self: TypeApply)(given Context): Term = self.fun - def TypeApply_args(self: TypeApply)(given Context): List[TypeTree] = self.args + def TypeApply_fun(self: TypeApply)(using ctx: Context): Term = self.fun + def TypeApply_args(self: TypeApply)(using ctx: Context): List[TypeTree] = self.args - def TypeApply_apply(fn: Term, args: List[TypeTree])(given Context): TypeApply = + def TypeApply_apply(fn: Term, args: List[TypeTree])(using ctx: Context): TypeApply = withDefaultPos(tpd.TypeApply(fn, args)) - def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree])(given Context): TypeApply = + def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree])(using ctx: Context): TypeApply = tpd.cpy.TypeApply(original)(fun, args) type Super = tpd.Super - def isInstanceOfSuper(given ctx: Context): IsInstanceOf[Super] = new { + def isInstanceOfSuper(using ctx: Context): IsInstanceOf[Super] = new { def runtimeClass: Class[?] = classOf[Super] override def unapply(x: Any): Option[Super] = x match case x: tpd.Super => Some(x) case _ => None } - def Super_qualifier(self: Super)(given Context): Term = self.qual - def Super_id(self: Super)(given Context): Option[Id] = optional(self.mix) + def Super_qualifier(self: Super)(using ctx: Context): Term = self.qual + def Super_id(self: Super)(using ctx: Context): Option[Id] = optional(self.mix) - def Super_apply(qual: Term, mix: Option[Id])(given Context): Super = + def Super_apply(qual: Term, mix: Option[Id])(using ctx: Context): Super = withDefaultPos(tpd.Super(qual, mix.getOrElse(untpd.EmptyTypeIdent), false, NoSymbol)) - def Super_copy(original: Tree)(qual: Term, mix: Option[Id])(given Context): Super = + def Super_copy(original: Tree)(qual: Term, mix: Option[Id])(using ctx: Context): Super = tpd.cpy.Super(original)(qual, mix.getOrElse(untpd.EmptyTypeIdent)) type Typed = tpd.Typed - def isInstanceOfTyped(given ctx: Context): IsInstanceOf[Typed] = new { + def isInstanceOfTyped(using ctx: Context): IsInstanceOf[Typed] = new { def runtimeClass: Class[?] = classOf[Typed] override def unapply(x: Any): Option[Typed] = x match case x: tpd.Typed => Some(x) case _ => None } - def Typed_expr(self: Typed)(given Context): Term = self.expr - def Typed_tpt(self: Typed)(given Context): TypeTree = self.tpt + def Typed_expr(self: Typed)(using ctx: Context): Term = self.expr + def Typed_tpt(self: Typed)(using ctx: Context): TypeTree = self.tpt - def Typed_apply(expr: Term, tpt: TypeTree)(given Context): Typed = + def Typed_apply(expr: Term, tpt: TypeTree)(using ctx: Context): Typed = withDefaultPos(tpd.Typed(expr, tpt)) - def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree)(given Context): Typed = + def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree)(using ctx: Context): Typed = tpd.cpy.Typed(original)(expr, tpt) type Assign = tpd.Assign - def isInstanceOfAssign(given ctx: Context): IsInstanceOf[Assign] = new { + def isInstanceOfAssign(using ctx: Context): IsInstanceOf[Assign] = new { def runtimeClass: Class[?] = classOf[Assign] override def unapply(x: Any): Option[Assign] = x match case x: tpd.Assign => Some(x) case _ => None } - def Assign_lhs(self: Assign)(given Context): Term = self.lhs - def Assign_rhs(self: Assign)(given Context): Term = self.rhs + def Assign_lhs(self: Assign)(using ctx: Context): Term = self.lhs + def Assign_rhs(self: Assign)(using ctx: Context): Term = self.rhs - def Assign_apply(lhs: Term, rhs: Term)(given Context): Assign = + def Assign_apply(lhs: Term, rhs: Term)(using ctx: Context): Assign = withDefaultPos(tpd.Assign(lhs, rhs)) - def Assign_copy(original: Tree)(lhs: Term, rhs: Term)(given Context): Assign = + def Assign_copy(original: Tree)(lhs: Term, rhs: Term)(using ctx: Context): Assign = tpd.cpy.Assign(original)(lhs, rhs) type Block = tpd.Block - def isInstanceOfBlock(given ctx: Context): IsInstanceOf[Block] = new { + def isInstanceOfBlock(using ctx: Context): IsInstanceOf[Block] = new { def runtimeClass: Class[?] = classOf[Block] override def unapply(x: Any): Option[Block] = x match @@ -525,7 +525,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend * i) Put `while` 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 Context): tpd.Tree = tree match { + private def normalizedLoops(tree: tpd.Tree)(using 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) => @@ -546,171 +546,171 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend } /** If it is the second statement of a closure. See: `normalizedLoops` */ - private def needsNormalization(tree: tpd.Tree)(given Context): Boolean = tree match { + private def needsNormalization(tree: tpd.Tree)(using ctx: Context): Boolean = tree match { case _: tpd.Closure => true case _ => false } - def Block_statements(self: Block)(given Context): List[Statement] = self.stats - def Block_expr(self: Block)(given Context): Term = self.expr + def Block_statements(self: Block)(using ctx: Context): List[Statement] = self.stats + def Block_expr(self: Block)(using ctx: Context): Term = self.expr - def Block_apply(stats: List[Statement], expr: Term)(given Context): Block = + def Block_apply(stats: List[Statement], expr: Term)(using ctx: Context): Block = withDefaultPos(tpd.Block(stats, expr)) - def Block_copy(original: Tree)(stats: List[Statement], expr: Term)(given Context): Block = + def Block_copy(original: Tree)(stats: List[Statement], expr: Term)(using ctx: Context): Block = tpd.cpy.Block(original)(stats, expr) type Inlined = tpd.Inlined - def isInstanceOfInlined(given ctx: Context): IsInstanceOf[Inlined] = new { + def isInstanceOfInlined(using ctx: Context): IsInstanceOf[Inlined] = new { def runtimeClass: Class[?] = classOf[Inlined] override def unapply(x: Any): Option[Inlined] = x match case x: tpd.Inlined => Some(x) case _ => None } - 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_call(self: Inlined)(using ctx: Context): Option[Term | TypeTree] = optional(self.call) + def Inlined_bindings(self: Inlined)(using ctx: Context): List[Definition] = self.bindings + def Inlined_body(self: Inlined)(using ctx: Context): Term = self.expansion - def Inlined_apply(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term)(given Context): Inlined = + def Inlined_apply(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term)(using ctx: 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 Context): Inlined = + def Inlined_copy(original: Tree)(call: Option[Term | TypeTree], bindings: List[Definition], expansion: Term)(using ctx: Context): Inlined = tpd.cpy.Inlined(original)(call.getOrElse(tpd.EmptyTree), bindings.asInstanceOf[List[tpd.MemberDef]], expansion) type Closure = tpd.Closure - def isInstanceOfClosure(given ctx: Context): IsInstanceOf[Closure] = new { + def isInstanceOfClosure(using ctx: Context): IsInstanceOf[Closure] = new { def runtimeClass: Class[?] = classOf[Closure] override def unapply(x: Any): Option[Closure] = x match case x: tpd.Closure => Some(x) case _ => None } - 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_meth(self: Closure)(using ctx: Context): Term = self.meth + def Closure_tpeOpt(self: Closure)(using ctx: Context): Option[Type] = optional(self.tpt).map(_.tpe) - def Closure_apply(meth: Term, tpe: Option[Type])(given Context): Closure = + def Closure_apply(meth: Term, tpe: Option[Type])(using ctx: 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 Context): Closure = + def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type])(using ctx: Context): Closure = tpd.cpy.Closure(original)(Nil, meth, tpe.map(tpd.TypeTree(_)).getOrElse(tpd.EmptyTree)) - def Lambda_apply(tpe: MethodType, rhsFn: List[Tree] => Tree)(given ctx: Context): Block = + def Lambda_apply(tpe: MethodType, rhsFn: List[Tree] => Tree)(using ctx: Context): Block = tpd.Lambda(tpe, rhsFn) type If = tpd.If - def isInstanceOfIf(given ctx: Context): IsInstanceOf[If] = new { + def isInstanceOfIf(using ctx: Context): IsInstanceOf[If] = new { def runtimeClass: Class[?] = classOf[If] override def unapply(x: Any): Option[If] = x match case x: tpd.If => Some(x) case _ => None } - 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_cond(self: If)(using ctx: Context): Term = self.cond + def If_thenp(self: If)(using ctx: Context): Term = self.thenp + def If_elsep(self: If)(using ctx: Context): Term = self.elsep - def If_apply(cond: Term, thenp: Term, elsep: Term)(given Context): If = + def If_apply(cond: Term, thenp: Term, elsep: Term)(using ctx: Context): If = withDefaultPos(tpd.If(cond, thenp, elsep)) - def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(given Context): If = + def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(using ctx: Context): If = tpd.cpy.If(original)(cond, thenp, elsep) type Match = tpd.Match - def isInstanceOfMatch(given ctx: Context): IsInstanceOf[Match] = new { + def isInstanceOfMatch(using ctx: Context): IsInstanceOf[Match] = new { def runtimeClass: Class[?] = classOf[Match] override def unapply(x: Any): Option[Match] = x match case x: tpd.Match if !x.selector.isEmpty => Some(x) case _ => None } - def Match_scrutinee(self: Match)(given Context): Term = self.selector - def Match_cases(self: Match)(given Context): List[CaseDef] = self.cases + def Match_scrutinee(self: Match)(using ctx: Context): Term = self.selector + def Match_cases(self: Match)(using ctx: Context): List[CaseDef] = self.cases - def Match_apply(selector: Term, cases: List[CaseDef])(given Context): Match = + def Match_apply(selector: Term, cases: List[CaseDef])(using ctx: Context): Match = withDefaultPos(tpd.Match(selector, cases)) - def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef])(given Context): Match = + def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef])(using ctx: Context): Match = tpd.cpy.Match(original)(selector, cases) type GivenMatch = tpd.Match - def isInstanceOfGivenMatch(given ctx: Context): IsInstanceOf[GivenMatch] = new { + def isInstanceOfGivenMatch(using ctx: Context): IsInstanceOf[GivenMatch] = new { def runtimeClass: Class[?] = classOf[GivenMatch] override def unapply(x: Any): Option[GivenMatch] = x match case x: tpd.Match if x.selector.isEmpty => Some(x) case _ => None } - def GivenMatch_cases(self: Match)(given Context): List[CaseDef] = self.cases + def GivenMatch_cases(self: Match)(using ctx: Context): List[CaseDef] = self.cases - def GivenMatch_apply(cases: List[CaseDef])(given Context): GivenMatch = + def GivenMatch_apply(cases: List[CaseDef])(using ctx: Context): GivenMatch = withDefaultPos(tpd.Match(tpd.EmptyTree, cases)) - def GivenMatch_copy(original: Tree)(cases: List[CaseDef])(given Context): GivenMatch = + def GivenMatch_copy(original: Tree)(cases: List[CaseDef])(using ctx: Context): GivenMatch = tpd.cpy.Match(original)(tpd.EmptyTree, cases) type Try = tpd.Try - def isInstanceOfTry(given ctx: Context): IsInstanceOf[Try] = new { + def isInstanceOfTry(using ctx: Context): IsInstanceOf[Try] = new { def runtimeClass: Class[?] = classOf[Try] override def unapply(x: Any): Option[Try] = x match case x: tpd.Try => Some(x) case _ => None } - 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_body(self: Try)(using ctx: Context): Term = self.expr + def Try_cases(self: Try)(using ctx: Context): List[CaseDef] = self.cases + def Try_finalizer(self: Try)(using ctx: Context): Option[Term] = optional(self.finalizer) - def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(given Context): Try = + def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(using ctx: 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 Context): Try = + def Try_copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(using ctx: Context): Try = tpd.cpy.Try(original)(expr, cases, finalizer.getOrElse(tpd.EmptyTree)) type Return = tpd.Return - def isInstanceOfReturn(given ctx: Context): IsInstanceOf[Return] = new { + def isInstanceOfReturn(using ctx: Context): IsInstanceOf[Return] = new { def runtimeClass: Class[?] = classOf[Return] override def unapply(x: Any): Option[Return] = x match case x: tpd.Return => Some(x) case _ => None } - def Return_expr(self: Return)(given Context): Term = self.expr + def Return_expr(self: Return)(using ctx: Context): Term = self.expr - def Return_apply(expr: Term)(given ctx: Context): Return = + def Return_apply(expr: Term)(using ctx: Context): Return = withDefaultPos(tpd.Return(expr, ctx.owner)) - def Return_copy(original: Tree)(expr: Term)(given ctx: Context): Return = + def Return_copy(original: Tree)(expr: Term)(using ctx: Context): Return = tpd.cpy.Return(original)(expr, tpd.ref(ctx.owner)) type Repeated = tpd.SeqLiteral - def isInstanceOfRepeated(given ctx: Context): IsInstanceOf[Repeated] = new { + def isInstanceOfRepeated(using ctx: Context): IsInstanceOf[Repeated] = new { def runtimeClass: Class[?] = classOf[Repeated] override def unapply(x: Any): Option[Repeated] = x match case x: tpd.SeqLiteral => Some(x) case _ => None } - def Repeated_elems(self: Repeated)(given Context): List[Term] = self.elems - def Repeated_elemtpt(self: Repeated)(given Context): TypeTree = self.elemtpt + def Repeated_elems(self: Repeated)(using ctx: Context): List[Term] = self.elems + def Repeated_elemtpt(self: Repeated)(using ctx: Context): TypeTree = self.elemtpt - def Repeated_apply(elems: List[Term], elemtpt: TypeTree)(given Context): Repeated = + def Repeated_apply(elems: List[Term], elemtpt: TypeTree)(using ctx: Context): Repeated = withDefaultPos(tpd.SeqLiteral(elems, elemtpt)) - def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree)(given Context): Repeated = + def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree)(using ctx: Context): Repeated = tpd.cpy.SeqLiteral(original)(elems, elemtpt) type SelectOuter = tpd.Select - def isInstanceOfSelectOuter(given ctx: Context): IsInstanceOf[SelectOuter] = new { + def isInstanceOfSelectOuter(using ctx: Context): IsInstanceOf[SelectOuter] = new { def runtimeClass: Class[?] = classOf[SelectOuter] override def unapply(x: Any): Option[SelectOuter] = x match case x: tpd.Select => @@ -720,39 +720,39 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - def SelectOuter_qualifier(self: SelectOuter)(given Context): Term = self.qualifier - def SelectOuter_level(self: SelectOuter)(given Context): Int = { + def SelectOuter_qualifier(self: SelectOuter)(using ctx: Context): Term = self.qualifier + def SelectOuter_level(self: SelectOuter)(using ctx: Context): Int = { val NameKinds.OuterSelectName(_, levels) = self.name levels } - def SelectOuter_apply(qualifier: Term, name: String, levels: Int)(given Context): SelectOuter = + def SelectOuter_apply(qualifier: Term, name: String, levels: Int)(using ctx: Context): SelectOuter = withDefaultPos(tpd.Select(qualifier, NameKinds.OuterSelectName(name.toTermName, levels))) - def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int)(given Context): SelectOuter = + def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int)(using ctx: Context): SelectOuter = tpd.cpy.Select(original)(qualifier, NameKinds.OuterSelectName(name.toTermName, levels)) type While = tpd.WhileDo - def isInstanceOfWhile(given ctx: Context): IsInstanceOf[While] = new { + def isInstanceOfWhile(using ctx: Context): IsInstanceOf[While] = new { def runtimeClass: Class[?] = classOf[While] override def unapply(x: Any): Option[While] = x match case x: tpd.WhileDo => Some(x) case _ => None } - def While_cond(self: While)(given Context): Term = self.cond - def While_body(self: While)(given Context): Term = self.body + def While_cond(self: While)(using ctx: Context): Term = self.cond + def While_body(self: While)(using ctx: Context): Term = self.body - def While_apply(cond: Term, body: Term)(given Context): While = + def While_apply(cond: Term, body: Term)(using ctx: Context): While = withDefaultPos(tpd.WhileDo(cond, body)) - def While_copy(original: Tree)(cond: Term, body: Term)(given Context): While = + def While_copy(original: Tree)(cond: Term, body: Term)(using ctx: Context): While = tpd.cpy.WhileDo(original)(cond, body) type TypeTree = tpd.Tree - def isInstanceOfTypeTree(given ctx: Context): IsInstanceOf[TypeTree] = new { + def isInstanceOfTypeTree(using ctx: Context): IsInstanceOf[TypeTree] = new { def runtimeClass: Class[?] = classOf[TypeTree] override def unapply(x: Any): Option[TypeTree] = x match case x: tpd.TypeBoundsTree => None @@ -760,225 +760,225 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - def TypeTree_tpe(self: TypeTree)(given Context): Type = self.tpe.stripTypeVar + def TypeTree_tpe(self: TypeTree)(using ctx: Context): Type = self.tpe.stripTypeVar type Inferred = tpd.TypeTree - def isInstanceOfInferred(given ctx: Context): IsInstanceOf[Inferred] = new { + def isInstanceOfInferred(using ctx: Context): IsInstanceOf[Inferred] = new { def runtimeClass: Class[?] = classOf[Inferred] override def unapply(x: Any): Option[Inferred] = x match case tpt: tpd.TypeTree if !tpt.tpe.isInstanceOf[Types.TypeBounds] => Some(tpt) case _ => None } - def Inferred_apply(tpe: Type)(given Context): Inferred = withDefaultPos(tpd.TypeTree(tpe)) + def Inferred_apply(tpe: Type)(using ctx: Context): Inferred = withDefaultPos(tpd.TypeTree(tpe)) type TypeIdent = tpd.Ident - def isInstanceOfTypeIdent(given ctx: Context): IsInstanceOf[TypeIdent] = new { + def isInstanceOfTypeIdent(using ctx: Context): IsInstanceOf[TypeIdent] = new { def runtimeClass: Class[?] = classOf[TypeIdent] override def unapply(x: Any): Option[TypeIdent] = x match case tpt: tpd.Ident if tpt.isType => Some(tpt) case _ => None } - def TypeIdent_name(self: TypeIdent)(given Context): String = self.name.toString + def TypeIdent_name(self: TypeIdent)(using ctx: Context): String = self.name.toString - def TypeIdent_copy(original: Tree)(name: String)(given Context): TypeIdent = + def TypeIdent_copy(original: Tree)(name: String)(using ctx: Context): TypeIdent = tpd.cpy.Ident(original)(name.toTypeName) type TypeSelect = tpd.Select - def isInstanceOfTypeSelect(given ctx: Context): IsInstanceOf[TypeSelect] = new { + def isInstanceOfTypeSelect(using ctx: Context): IsInstanceOf[TypeSelect] = new { def runtimeClass: Class[?] = classOf[TypeSelect] override def unapply(x: Any): Option[TypeSelect] = x match case tpt: tpd.Select if tpt.isType && tpt.qualifier.isTerm => Some(tpt) case _ => None } - def TypeSelect_qualifier(self: TypeSelect)(given Context): Term = self.qualifier - def TypeSelect_name(self: TypeSelect)(given Context): String = self.name.toString + def TypeSelect_qualifier(self: TypeSelect)(using ctx: Context): Term = self.qualifier + def TypeSelect_name(self: TypeSelect)(using ctx: Context): String = self.name.toString - def TypeSelect_apply(qualifier: Term, name: String)(given Context): TypeSelect = + def TypeSelect_apply(qualifier: Term, name: String)(using ctx: Context): TypeSelect = withDefaultPos(tpd.Select(qualifier, name.toTypeName)) - def TypeSelect_copy(original: Tree)(qualifier: Term, name: String)(given Context): TypeSelect = + def TypeSelect_copy(original: Tree)(qualifier: Term, name: String)(using ctx: Context): TypeSelect = tpd.cpy.Select(original)(qualifier, name.toTypeName) type Projection = tpd.Select - def isInstanceOfProjection(given ctx: Context): IsInstanceOf[Projection] = new { + def isInstanceOfProjection(using ctx: Context): IsInstanceOf[Projection] = new { def runtimeClass: Class[?] = classOf[Projection] override def unapply(x: Any): Option[Projection] = x match case tpt: tpd.Select if tpt.isType && tpt.qualifier.isType => Some(tpt) case _ => None } - def Projection_qualifier(self: Projection)(given Context): TypeTree = self.qualifier - def Projection_name(self: Projection)(given Context): String = self.name.toString + def Projection_qualifier(self: Projection)(using ctx: Context): TypeTree = self.qualifier + def Projection_name(self: Projection)(using ctx: Context): String = self.name.toString - def Projection_copy(original: Tree)(qualifier: TypeTree, name: String)(given Context): Projection = + def Projection_copy(original: Tree)(qualifier: TypeTree, name: String)(using ctx: Context): Projection = tpd.cpy.Select(original)(qualifier, name.toTypeName) type Singleton = tpd.SingletonTypeTree - def isInstanceOfSingleton(given ctx: Context): IsInstanceOf[Singleton] = new { + def isInstanceOfSingleton(using ctx: Context): IsInstanceOf[Singleton] = new { def runtimeClass: Class[?] = classOf[Singleton] override def unapply(x: Any): Option[Singleton] = x match case tpt: tpd.SingletonTypeTree => Some(tpt) case _ => None } - def Singleton_ref(self: Singleton)(given Context): Term = self.ref + def Singleton_ref(self: Singleton)(using ctx: Context): Term = self.ref - def Singleton_apply(ref: Term)(given Context): Singleton = + def Singleton_apply(ref: Term)(using ctx: Context): Singleton = withDefaultPos(tpd.SingletonTypeTree(ref)) - def Singleton_copy(original: Tree)(ref: Term)(given Context): Singleton = + def Singleton_copy(original: Tree)(ref: Term)(using ctx: Context): Singleton = tpd.cpy.SingletonTypeTree(original)(ref) type Refined = tpd.RefinedTypeTree - def isInstanceOfRefined(given ctx: Context): IsInstanceOf[Refined] = new { + def isInstanceOfRefined(using ctx: Context): IsInstanceOf[Refined] = new { def runtimeClass: Class[?] = classOf[Refined] override def unapply(x: Any): Option[Refined] = x match case tpt: tpd.RefinedTypeTree => Some(tpt) case _ => None } - def Refined_tpt(self: Refined)(given Context): TypeTree = self.tpt - def Refined_refinements(self: Refined)(given Context): List[Definition] = self.refinements + def Refined_tpt(self: Refined)(using ctx: Context): TypeTree = self.tpt + def Refined_refinements(self: Refined)(using ctx: Context): List[Definition] = self.refinements - def Refined_copy(original: Tree)(tpt: TypeTree, refinements: List[Definition])(given Context): Refined = + def Refined_copy(original: Tree)(tpt: TypeTree, refinements: List[Definition])(using ctx: Context): Refined = tpd.cpy.RefinedTypeTree(original)(tpt, refinements) type Applied = tpd.AppliedTypeTree - def isInstanceOfApplied(given ctx: Context): IsInstanceOf[Applied] = new { + def isInstanceOfApplied(using ctx: Context): IsInstanceOf[Applied] = new { def runtimeClass: Class[?] = classOf[Applied] override def unapply(x: Any): Option[Applied] = x match case tpt: tpd.AppliedTypeTree => Some(tpt) case _ => None } - def Applied_tpt(self: Applied)(given Context): TypeTree = self.tpt - def Applied_args(self: Applied)(given Context): List[TypeTree | TypeBoundsTree] = self.args + def Applied_tpt(self: Applied)(using ctx: Context): TypeTree = self.tpt + def Applied_args(self: Applied)(using ctx: Context): List[TypeTree | TypeBoundsTree] = self.args - def Applied_apply(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree])(given Context): Applied = + def Applied_apply(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree])(using ctx: Context): Applied = withDefaultPos(tpd.AppliedTypeTree(tpt, args)) - def Applied_copy(original: Tree)(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree])(given Context): Applied = + def Applied_copy(original: Tree)(tpt: TypeTree, args: List[TypeTree | TypeBoundsTree])(using ctx: Context): Applied = tpd.cpy.AppliedTypeTree(original)(tpt, args) type Annotated = tpd.Annotated - def isInstanceOfAnnotated(given ctx: Context): IsInstanceOf[Annotated] = new { + def isInstanceOfAnnotated(using ctx: Context): IsInstanceOf[Annotated] = new { def runtimeClass: Class[?] = classOf[Annotated] override def unapply(x: Any): Option[Annotated] = x match case tpt: tpd.Annotated => Some(tpt) case _ => None } - def Annotated_arg(self: Annotated)(given Context): TypeTree = self.arg - def Annotated_annotation(self: Annotated)(given Context): Term = self.annot + def Annotated_arg(self: Annotated)(using ctx: Context): TypeTree = self.arg + def Annotated_annotation(self: Annotated)(using ctx: Context): Term = self.annot - def Annotated_apply(arg: TypeTree, annotation: Term)(given Context): Annotated = + def Annotated_apply(arg: TypeTree, annotation: Term)(using ctx: Context): Annotated = withDefaultPos(tpd.Annotated(arg, annotation)) - def Annotated_copy(original: Tree)(arg: TypeTree, annotation: Term)(given Context): Annotated = + def Annotated_copy(original: Tree)(arg: TypeTree, annotation: Term)(using ctx: Context): Annotated = tpd.cpy.Annotated(original)(arg, annotation) type MatchTypeTree = tpd.MatchTypeTree - def isInstanceOfMatchTypeTree(given ctx: Context): IsInstanceOf[MatchTypeTree] = new { + def isInstanceOfMatchTypeTree(using ctx: Context): IsInstanceOf[MatchTypeTree] = new { def runtimeClass: Class[?] = classOf[MatchTypeTree] override def unapply(x: Any): Option[MatchTypeTree] = x match case tpt: tpd.MatchTypeTree => Some(tpt) case _ => None } - 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_bound(self: MatchTypeTree)(using ctx: Context): Option[TypeTree] = if (self.bound == tpd.EmptyTree) None else Some(self.bound) + def MatchTypeTree_selector(self: MatchTypeTree)(using ctx: Context): TypeTree = self.selector + def MatchTypeTree_cases(self: MatchTypeTree)(using ctx: Context): List[CaseDef] = self.cases - def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(given Context): MatchTypeTree = + def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(using ctx: Context): MatchTypeTree = withDefaultPos(tpd.MatchTypeTree(bound.getOrElse(tpd.EmptyTree), selector, cases)) - def MatchTypeTree_copy(original: Tree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(given Context): MatchTypeTree = + def MatchTypeTree_copy(original: Tree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(using ctx: Context): MatchTypeTree = tpd.cpy.MatchTypeTree(original)(bound.getOrElse(tpd.EmptyTree), selector, cases) type ByName = tpd.ByNameTypeTree - def isInstanceOfByName(given ctx: Context): IsInstanceOf[ByName] = new { + def isInstanceOfByName(using ctx: Context): IsInstanceOf[ByName] = new { def runtimeClass: Class[?] = classOf[ByName] override def unapply(x: Any): Option[ByName] = x match case tpt: tpd.ByNameTypeTree => Some(tpt) case _ => None } - def ByName_result(self: ByName)(given Context): TypeTree = self.result + def ByName_result(self: ByName)(using ctx: Context): TypeTree = self.result - def ByName_apply(result: TypeTree)(given Context): ByName = + def ByName_apply(result: TypeTree)(using ctx: Context): ByName = withDefaultPos(tpd.ByNameTypeTree(result)) - def ByName_copy(original: Tree)(result: TypeTree)(given Context): ByName = + def ByName_copy(original: Tree)(result: TypeTree)(using ctx: Context): ByName = tpd.cpy.ByNameTypeTree(original)(result) type LambdaTypeTree = tpd.LambdaTypeTree - def isInstanceOfLambdaTypeTree(given ctx: Context): IsInstanceOf[LambdaTypeTree] = new { + def isInstanceOfLambdaTypeTree(using ctx: Context): IsInstanceOf[LambdaTypeTree] = new { def runtimeClass: Class[?] = classOf[LambdaTypeTree] override def unapply(x: Any): Option[LambdaTypeTree] = x match case tpt: tpd.LambdaTypeTree => Some(tpt) case _ => None } - def Lambdatparams(self: LambdaTypeTree)(given Context): List[TypeDef] = self.tparams - def Lambdabody(self: LambdaTypeTree)(given Context): TypeTree | TypeBoundsTree = self.body + def Lambdatparams(self: LambdaTypeTree)(using ctx: Context): List[TypeDef] = self.tparams + def Lambdabody(self: LambdaTypeTree)(using ctx: Context): TypeTree | TypeBoundsTree = self.body - def Lambdaapply(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree)(given Context): LambdaTypeTree = + def Lambdaapply(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree)(using ctx: Context): LambdaTypeTree = withDefaultPos(tpd.LambdaTypeTree(tparams, body)) - def Lambdacopy(original: Tree)(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree)(given Context): LambdaTypeTree = + def Lambdacopy(original: Tree)(tparams: List[TypeDef], body: TypeTree | TypeBoundsTree)(using ctx: Context): LambdaTypeTree = tpd.cpy.LambdaTypeTree(original)(tparams, body) type TypeBind = tpd.Bind - def isInstanceOfTypeBind(given ctx: Context): IsInstanceOf[TypeBind] = new { + def isInstanceOfTypeBind(using ctx: Context): IsInstanceOf[TypeBind] = new { def runtimeClass: Class[?] = classOf[TypeBind] override def unapply(x: Any): Option[TypeBind] = x match case tpt: tpd.Bind if tpt.name.isTypeName => Some(tpt) case _ => None } - def TypeBind_name(self: TypeBind)(given Context): String = self.name.toString - def TypeBind_body(self: TypeBind)(given Context): TypeTree | TypeBoundsTree = self.body + def TypeBind_name(self: TypeBind)(using ctx: Context): String = self.name.toString + def TypeBind_body(self: TypeBind)(using ctx: Context): TypeTree | TypeBoundsTree = self.body - def TypeBind_copy(original: Tree)(name: String, tpt: TypeTree | TypeBoundsTree)(given Context): TypeBind = + def TypeBind_copy(original: Tree)(name: String, tpt: TypeTree | TypeBoundsTree)(using ctx: Context): TypeBind = tpd.cpy.Bind(original)(name.toTypeName, tpt) type TypeBlock = tpd.Block - def isInstanceOfTypeBlock(given ctx: Context): IsInstanceOf[TypeBlock] = new { + def isInstanceOfTypeBlock(using ctx: Context): IsInstanceOf[TypeBlock] = new { def runtimeClass: Class[?] = classOf[TypeBlock] override def unapply(x: Any): Option[TypeBlock] = x match case tpt: tpd.Block => Some(tpt) case _ => None } - 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_aliases(self: TypeBlock)(using ctx: Context): List[TypeDef] = self.stats.map { case alias: TypeDef => alias } + def TypeBlock_tpt(self: TypeBlock)(using ctx: Context): TypeTree = self.expr - def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree)(given Context): TypeBlock = + def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree)(using ctx: Context): TypeBlock = withDefaultPos(tpd.Block(aliases, tpt)) - def TypeBlock_copy(original: Tree)(aliases: List[TypeDef], tpt: TypeTree)(given Context): TypeBlock = + def TypeBlock_copy(original: Tree)(aliases: List[TypeDef], tpt: TypeTree)(using ctx: Context): TypeBlock = tpd.cpy.Block(original)(aliases, tpt) type TypeBoundsTree = tpd.TypeBoundsTree - def isInstanceOfTypeBoundsTree(given ctx: Context): IsInstanceOf[TypeBoundsTree] = new { + def isInstanceOfTypeBoundsTree(using ctx: Context): IsInstanceOf[TypeBoundsTree] = new { def runtimeClass: Class[?] = classOf[TypeBoundsTree] override def unapply(x: Any): Option[TypeBoundsTree] = x match case x: tpd.TypeBoundsTree => Some(x) @@ -992,77 +992,77 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - 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 + def TypeBoundsTree_tpe(self: TypeBoundsTree)(using ctx: Context): TypeBounds = self.tpe.asInstanceOf[Types.TypeBounds] + def TypeBoundsTree_low(self: TypeBoundsTree)(using ctx: Context): TypeTree = self.lo + def TypeBoundsTree_hi(self: TypeBoundsTree)(using ctx: Context): TypeTree = self.hi type WildcardTypeTree = tpd.Ident - def isInstanceOfWildcardTypeTree(given ctx: Context): IsInstanceOf[WildcardTypeTree] = new { + def isInstanceOfWildcardTypeTree(using ctx: Context): IsInstanceOf[WildcardTypeTree] = new { def runtimeClass: Class[?] = classOf[WildcardTypeTree] override def unapply(x: Any): Option[WildcardTypeTree] = x match case x: tpd.Ident if x.name == nme.WILDCARD => Some(x) case _ => None } - def WildcardTypeTree_tpe(self: WildcardTypeTree)(given Context): TypeOrBounds = self.tpe.stripTypeVar + def WildcardTypeTree_tpe(self: WildcardTypeTree)(using ctx: Context): TypeOrBounds = self.tpe.stripTypeVar type CaseDef = tpd.CaseDef - def isInstanceOfCaseDef(given ctx: Context): IsInstanceOf[CaseDef] = new { + def isInstanceOfCaseDef(using ctx: Context): IsInstanceOf[CaseDef] = new { def runtimeClass: Class[?] = classOf[CaseDef] override def unapply(x: Any): Option[CaseDef] = x match case tree: tpd.CaseDef if tree.body.isTerm => Some(tree) case _ => None } - def CaseDef_pattern(self: CaseDef)(given Context): Tree = 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_pattern(self: CaseDef)(using ctx: Context): Tree = self.pat + def CaseDef_guard(self: CaseDef)(using ctx: Context): Option[Term] = optional(self.guard) + def CaseDef_rhs(self: CaseDef)(using ctx: Context): Term = self.body - def CaseDef_module_apply(pattern: Tree, guard: Option[Term], body: Term)(given Context): CaseDef = + def CaseDef_module_apply(pattern: Tree, guard: Option[Term], body: Term)(using ctx: Context): CaseDef = tpd.CaseDef(pattern, guard.getOrElse(tpd.EmptyTree), body) - def CaseDef_module_copy(original: Tree)(pattern: Tree, guard: Option[Term], body: Term)(given Context): CaseDef = + def CaseDef_module_copy(original: Tree)(pattern: Tree, guard: Option[Term], body: Term)(using ctx: Context): CaseDef = tpd.cpy.CaseDef(original)(pattern, guard.getOrElse(tpd.EmptyTree), body) type TypeCaseDef = tpd.CaseDef - def isInstanceOfTypeCaseDef(given ctx: Context): IsInstanceOf[TypeCaseDef] = new { + def isInstanceOfTypeCaseDef(using ctx: Context): IsInstanceOf[TypeCaseDef] = new { def runtimeClass: Class[?] = classOf[TypeCaseDef] override def unapply(x: Any): Option[TypeCaseDef] = x match case tree: tpd.CaseDef if tree.body.isType => Some(tree) case _ => None } - def TypeCaseDef_pattern(self: TypeCaseDef)(given Context): TypeTree = self.pat - def TypeCaseDef_rhs(self: TypeCaseDef)(given Context): TypeTree = self.body + def TypeCaseDef_pattern(self: TypeCaseDef)(using ctx: Context): TypeTree = self.pat + def TypeCaseDef_rhs(self: TypeCaseDef)(using ctx: Context): TypeTree = self.body - def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree)(given Context): TypeCaseDef = + def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree)(using ctx: Context): TypeCaseDef = tpd.CaseDef(pattern, tpd.EmptyTree, body) - def TypeCaseDef_module_copy(original: Tree)(pattern: TypeTree, body: TypeTree)(given Context): TypeCaseDef = + def TypeCaseDef_module_copy(original: Tree)(pattern: TypeTree, body: TypeTree)(using ctx: Context): TypeCaseDef = tpd.cpy.CaseDef(original)(pattern, tpd.EmptyTree, body) type Bind = tpd.Bind - def isInstanceOfBind(given ctx: Context): IsInstanceOf[Bind] = new { + def isInstanceOfBind(using ctx: Context): IsInstanceOf[Bind] = new { def runtimeClass: Class[?] = classOf[Bind] override def unapply(x: Any): Option[Bind] = x match case x: tpd.Bind if x.name.isTermName => Some(x) case _ => None } - def Tree_Bind_name(self: Bind)(given Context): String = self.name.toString + def Tree_Bind_name(self: Bind)(using ctx: Context): String = self.name.toString - def Tree_Bind_pattern(self: Bind)(given Context): Tree = self.body + def Tree_Bind_pattern(self: Bind)(using ctx: Context): Tree = self.body - def Tree_Bind_module_copy(original: Tree)(name: String, pattern: Tree)(given Context): Bind = + def Tree_Bind_module_copy(original: Tree)(name: String, pattern: Tree)(using ctx: Context): Bind = withDefaultPos(tpd.cpy.Bind(original)(name.toTermName, pattern)) type Unapply = tpd.UnApply - def isInstanceOfUnapply(given ctx: Context): IsInstanceOf[Unapply] = new { + def isInstanceOfUnapply(using ctx: Context): IsInstanceOf[Unapply] = new { def runtimeClass: Class[?] = classOf[Unapply] override def unapply(x: Any): Option[Unapply] = x match case pattern: tpd.UnApply => Some(pattern) @@ -1070,11 +1070,11 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - def Tree_Unapply_fun(self: Unapply)(given Context): Term = self.fun - def Tree_Unapply_implicits(self: Unapply)(given Context): List[Term] = self.implicits - def Tree_Unapply_patterns(self: Unapply)(given Context): List[Tree] = effectivePatterns(self.patterns) + def Tree_Unapply_fun(self: Unapply)(using ctx: Context): Term = self.fun + def Tree_Unapply_implicits(self: Unapply)(using ctx: Context): List[Term] = self.implicits + def Tree_Unapply_patterns(self: Unapply)(using ctx: Context): List[Tree] = effectivePatterns(self.patterns) - def Tree_Unapply_module_copy(original: Tree)(fun: Term, implicits: List[Term], patterns: List[Tree])(given Context): Unapply = + def Tree_Unapply_module_copy(original: Tree)(fun: Term, implicits: List[Term], patterns: List[Tree])(using ctx: Context): Unapply = withDefaultPos(tpd.cpy.UnApply(original)(fun, implicits, patterns)) private def effectivePatterns(patterns: List[Tree]): List[Tree] = patterns match { @@ -1084,19 +1084,19 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type Alternatives = tpd.Alternative - def isInstanceOfAlternatives(given ctx: Context): IsInstanceOf[Alternatives] = new { + def isInstanceOfAlternatives(using ctx: Context): IsInstanceOf[Alternatives] = new { def runtimeClass: Class[?] = classOf[Alternatives] override def unapply(x: Any): Option[Alternatives] = x match case x: tpd.Alternative => Some(x) case _ => None } - def Tree_Alternatives_patterns(self: Alternatives)(given Context): List[Tree] = self.trees + def Tree_Alternatives_patterns(self: Alternatives)(using ctx: Context): List[Tree] = self.trees - def Tree_Alternatives_module_apply(patterns: List[Tree])(given Context): Alternatives = + def Tree_Alternatives_module_apply(patterns: List[Tree])(using ctx: Context): Alternatives = withDefaultPos(tpd.Alternative(patterns)) - def Tree_Alternatives_module_copy(original: Tree)(patterns: List[Tree])(given Context): Alternatives = + def Tree_Alternatives_module_copy(original: Tree)(patterns: List[Tree])(using ctx: Context): Alternatives = tpd.cpy.Alternative(original)(patterns) @@ -1108,7 +1108,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type NoPrefix = Types.NoPrefix.type - def isInstanceOfNoPrefix(given ctx: Context): IsInstanceOf[NoPrefix] = new { + def isInstanceOfNoPrefix(using ctx: Context): IsInstanceOf[NoPrefix] = new { def runtimeClass: Class[?] = classOf[Types.NoPrefix.type] override def unapply(x: Any): Option[NoPrefix] = if (x == Types.NoPrefix) Some(Types.NoPrefix) else None @@ -1116,22 +1116,22 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type TypeBounds = Types.TypeBounds - def isInstanceOfTypeBounds(given ctx: Context): IsInstanceOf[TypeBounds] = new { + def isInstanceOfTypeBounds(using ctx: Context): IsInstanceOf[TypeBounds] = new { def runtimeClass: Class[?] = classOf[TypeBounds] override def unapply(x: Any): Option[TypeBounds] = x match case x: Types.TypeBounds => Some(x) case _ => None } - def TypeBounds_apply(low: Type, hi: Type)(given ctx: Context): TypeBounds = + def TypeBounds_apply(low: Type, hi: Type)(using ctx: Context): TypeBounds = Types.TypeBounds(low, hi) - def TypeBounds_low(self: TypeBounds)(given Context): Type = self.lo - def TypeBounds_hi(self: TypeBounds)(given Context): Type = self.hi + def TypeBounds_low(self: TypeBounds)(using ctx: Context): Type = self.lo + def TypeBounds_hi(self: TypeBounds)(using ctx: Context): Type = self.hi type Type = Types.Type - def isInstanceOfType(given ctx: Context): IsInstanceOf[Type] = new { + def isInstanceOfType(using ctx: Context): IsInstanceOf[Type] = new { def runtimeClass: Class[?] = classOf[Type] override def unapply(x: Any): Option[Type] = x match case x: TypeBounds => None @@ -1139,7 +1139,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - def Type_apply(clazz: Class[?])(given ctx: Context): Type = + def Type_apply(clazz: Class[?])(using ctx: Context): Type = if (clazz.isPrimitive) if (clazz == classOf[Boolean]) defn.BooleanType else if (clazz == classOf[Byte]) defn.ByteType @@ -1161,97 +1161,97 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend } else ctx.getClassIfDefined(clazz.getCanonicalName).typeRef - def Type_isTypeEq(self: Type)(that: Type)(given Context): Boolean = self =:= that + def Type_isTypeEq(self: Type)(that: Type)(using ctx: Context): Boolean = self =:= that - def Type_isSubType(self: Type)(that: Type)(given Context): Boolean = self <:< that + def Type_isSubType(self: Type)(that: Type)(using ctx: Context): Boolean = self <:< that - def Type_widen(self: Type)(given Context): Type = self.widen + def Type_widen(self: Type)(using ctx: Context): Type = self.widen - def Type_widenTermRefExpr(self: Type)(given Context): Type = self.widenTermRefExpr + def Type_widenTermRefExpr(self: Type)(using ctx: Context): Type = self.widenTermRefExpr - def Type_dealias(self: Type)(given Context): Type = self.dealias + def Type_dealias(self: Type)(using ctx: Context): Type = self.dealias - def Type_simplified(self: Type)(given Context): Type = self.simplified + def Type_simplified(self: Type)(using ctx: Context): Type = self.simplified - def Type_classSymbol(self: Type)(given Context): Option[Symbol] = + def Type_classSymbol(self: Type)(using ctx: Context): Option[Symbol] = if (self.classSymbol.exists) Some(self.classSymbol.asClass) else None - def Type_typeSymbol(self: Type)(given Context): Symbol = self.typeSymbol + def Type_typeSymbol(self: Type)(using ctx: Context): Symbol = self.typeSymbol - def Type_termSymbol(self: Type)(given Context): Symbol = self.termSymbol + def Type_termSymbol(self: Type)(using ctx: Context): Symbol = self.termSymbol - def Type_isSingleton(self: Type)(given Context): Boolean = self.isSingleton + def Type_isSingleton(self: Type)(using ctx: Context): Boolean = self.isSingleton - def Type_memberType(self: Type)(member: Symbol)(given Context): Type = + def Type_memberType(self: Type)(member: Symbol)(using ctx: Context): Type = member.info.asSeenFrom(self, member.owner) - def Type_derivesFrom(self: Type)(cls: Symbol)(given Context): Boolean = + def Type_derivesFrom(self: Type)(cls: Symbol)(using ctx: Context): Boolean = self.derivesFrom(cls) - def Type_isFunctionType(self: Type)(given Context): Boolean = + def Type_isFunctionType(self: Type)(using ctx: Context): Boolean = defn.isFunctionType(self) - def Type_isContextFunctionType(self: Type)(given Context): Boolean = + def Type_isContextFunctionType(self: Type)(using ctx: Context): Boolean = defn.isContextFunctionType(self) - def Type_isErasedFunctionType(self: Type)(given Context): Boolean = + def Type_isErasedFunctionType(self: Type)(using ctx: Context): Boolean = defn.isErasedFunctionType(self) - def Type_isDependentFunctionType(self: Type)(given Context): Boolean = { + def Type_isDependentFunctionType(self: Type)(using ctx: Context): Boolean = { val tpNoRefinement = self.dropDependentRefinement tpNoRefinement != self && defn.isNonRefinedFunction(tpNoRefinement) } type ConstantType = Types.ConstantType - def isInstanceOfConstantType(given ctx: Context): IsInstanceOf[ConstantType] = new { + def isInstanceOfConstantType(using ctx: Context): IsInstanceOf[ConstantType] = new { def runtimeClass: Class[?] = classOf[ConstantType] override def unapply(x: Any): Option[ConstantType] = x match case tpe: Types.ConstantType => Some(tpe) case _ => None } - def ConstantType_apply(const: Constant)(given Context): ConstantType = + def ConstantType_apply(const: Constant)(using ctx: Context): ConstantType = Types.ConstantType(const) - def ConstantType_constant(self: ConstantType)(given Context): Constant = self.value + def ConstantType_constant(self: ConstantType)(using ctx: Context): Constant = self.value type TermRef = Types.NamedType - def isInstanceOfTermRef(given ctx: Context): IsInstanceOf[TermRef] = new { + def isInstanceOfTermRef(using ctx: Context): IsInstanceOf[TermRef] = new { def runtimeClass: Class[?] = classOf[TermRef] override def unapply(x: Any): Option[TermRef] = x match case tp: Types.TermRef => Some(tp) case _ => None } - def TermRef_apply(qual: TypeOrBounds, name: String)(given Context): TermRef = + def TermRef_apply(qual: TypeOrBounds, name: String)(using ctx: Context): TermRef = Types.TermRef(qual, name.toTermName) - def TermRef_qualifier(self: TermRef)(given Context): TypeOrBounds = self.prefix + def TermRef_qualifier(self: TermRef)(using ctx: Context): TypeOrBounds = self.prefix - def TermRef_name(self: TermRef)(given Context): String = self.name.toString + def TermRef_name(self: TermRef)(using ctx: Context): String = self.name.toString type TypeRef = Types.NamedType - def isInstanceOfTypeRef(given ctx: Context): IsInstanceOf[TypeRef] = new { + def isInstanceOfTypeRef(using ctx: Context): IsInstanceOf[TypeRef] = new { def runtimeClass: Class[?] = classOf[TypeRef] override def unapply(x: Any): Option[TypeRef] = x match case tp: Types.TypeRef => Some(tp) case _ => None } - def TypeRef_qualifier(self: TypeRef)(given Context): TypeOrBounds = self.prefix + def TypeRef_qualifier(self: TypeRef)(using ctx: Context): TypeOrBounds = self.prefix - def TypeRef_name(self: TypeRef)(given Context): String = self.name.toString + def TypeRef_name(self: TypeRef)(using ctx: Context): String = self.name.toString - def TypeRef_isOpaqueAlias(self: TypeRef)(given Context): Boolean = self.symbol.isOpaqueAlias + def TypeRef_isOpaqueAlias(self: TypeRef)(using ctx: Context): Boolean = self.symbol.isOpaqueAlias - def TypeRef_translucentSuperType(self: TypeRef)(given Context): Type = self.translucentSuperType + def TypeRef_translucentSuperType(self: TypeRef)(using ctx: Context): Type = self.translucentSuperType type NamedTermRef = Types.NamedType - def isInstanceOfNamedTermRef(given ctx: Context): IsInstanceOf[NamedTermRef] = new { + def isInstanceOfNamedTermRef(using ctx: Context): IsInstanceOf[NamedTermRef] = new { def runtimeClass: Class[?] = classOf[NamedTermRef] override def unapply(x: Any): Option[NamedTermRef] = x match case tpe: Types.NamedType => @@ -1262,34 +1262,34 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - def NamedTermRef_name(self: NamedTermRef)(given Context): String = self.name.toString - def NamedTermRef_qualifier(self: NamedTermRef)(given Context): TypeOrBounds = self.prefix + def NamedTermRef_name(self: NamedTermRef)(using ctx: Context): String = self.name.toString + def NamedTermRef_qualifier(self: NamedTermRef)(using ctx: Context): TypeOrBounds = self.prefix type SuperType = Types.SuperType - def isInstanceOfSuperType(given ctx: Context): IsInstanceOf[SuperType] = new { + def isInstanceOfSuperType(using ctx: Context): IsInstanceOf[SuperType] = new { def runtimeClass: Class[?] = classOf[SuperType] override def unapply(x: Any): Option[SuperType] = x match case tpe: Types.SuperType => Some(tpe) case _ => None } - def SuperType_apply(thistpe: Type, supertpe: Type)(given ctx: Context): SuperType = + def SuperType_apply(thistpe: Type, supertpe: Type)(using ctx: Context): SuperType = Types.SuperType(thistpe, supertpe) - def SuperType_thistpe(self: SuperType)(given Context): Type = self.thistpe - def SuperType_supertpe(self: SuperType)(given Context): Type = self.supertpe + def SuperType_thistpe(self: SuperType)(using ctx: Context): Type = self.thistpe + def SuperType_supertpe(self: SuperType)(using ctx: Context): Type = self.supertpe type Refinement = Types.RefinedType - def isInstanceOfRefinement(given ctx: Context): IsInstanceOf[Refinement] = new { + def isInstanceOfRefinement(using ctx: Context): IsInstanceOf[Refinement] = new { def runtimeClass: Class[?] = classOf[Refinement] override def unapply(x: Any): Option[Refinement] = x match case tpe: Types.RefinedType => Some(tpe) case _ => None } - def Refinement_apply(parent: Type, name: String, info: TypeOrBounds /* Type | TypeBounds */)(given ctx: Context): Refinement = { + def Refinement_apply(parent: Type, name: String, info: TypeOrBounds /* Type | TypeBounds */)(using ctx: Context): Refinement = { val name1 = info match case _: TypeBounds => name.toTypeName @@ -1297,101 +1297,101 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend Types.RefinedType(parent, name1, info) } - 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 + def Refinement_parent(self: Refinement)(using ctx: Context): Type = self.parent + def Refinement_name(self: Refinement)(using ctx: Context): String = self.refinedName.toString + def Refinement_info(self: Refinement)(using ctx: Context): TypeOrBounds = self.refinedInfo type AppliedType = Types.AppliedType - def isInstanceOfAppliedType(given ctx: Context): IsInstanceOf[AppliedType] = new { + def isInstanceOfAppliedType(using ctx: Context): IsInstanceOf[AppliedType] = new { def runtimeClass: Class[?] = classOf[AppliedType] override def unapply(x: Any): Option[AppliedType] = x match case tpe: Types.AppliedType => Some(tpe) case _ => None } - def AppliedType_tycon(self: AppliedType)(given Context): Type = self.tycon - def AppliedType_args(self: AppliedType)(given Context): List[TypeOrBounds] = self.args + def AppliedType_tycon(self: AppliedType)(using ctx: Context): Type = self.tycon + def AppliedType_args(self: AppliedType)(using ctx: Context): List[TypeOrBounds] = self.args - def AppliedType_apply(tycon: Type, args: List[TypeOrBounds])(given Context): AppliedType = Types.AppliedType(tycon, args) + def AppliedType_apply(tycon: Type, args: List[TypeOrBounds])(using ctx: Context): AppliedType = Types.AppliedType(tycon, args) type AnnotatedType = Types.AnnotatedType - def isInstanceOfAnnotatedType(given ctx: Context): IsInstanceOf[AnnotatedType] = new { + def isInstanceOfAnnotatedType(using ctx: Context): IsInstanceOf[AnnotatedType] = new { def runtimeClass: Class[?] = classOf[AnnotatedType] override def unapply(x: Any): Option[AnnotatedType] = x match case tpe: Types.AnnotatedType => Some(tpe) case _ => None } - def AnnotatedType_apply(underlying: Type, annot: Term)(given Context): AnnotatedType = + def AnnotatedType_apply(underlying: Type, annot: Term)(using ctx: Context): AnnotatedType = Types.AnnotatedType(underlying, Annotations.Annotation(annot)) - def AnnotatedType_underlying(self: AnnotatedType)(given Context): Type = self.underlying.stripTypeVar - def AnnotatedType_annot(self: AnnotatedType)(given Context): Term = self.annot.tree + def AnnotatedType_underlying(self: AnnotatedType)(using ctx: Context): Type = self.underlying.stripTypeVar + def AnnotatedType_annot(self: AnnotatedType)(using ctx: Context): Term = self.annot.tree type AndType = Types.AndType - def isInstanceOfAndType(given ctx: Context): IsInstanceOf[AndType] = new { + def isInstanceOfAndType(using ctx: Context): IsInstanceOf[AndType] = new { def runtimeClass: Class[?] = classOf[AndType] override def unapply(x: Any): Option[AndType] = x match case tpe: Types.AndType => Some(tpe) case _ => None } - def AndType_apply(lhs: Type, rhs: Type)(given Context): AndType = + def AndType_apply(lhs: Type, rhs: Type)(using ctx: Context): AndType = Types.AndType(lhs, rhs) - def AndType_left(self: AndType)(given Context): Type = self.tp1.stripTypeVar - def AndType_right(self: AndType)(given Context): Type = self.tp2.stripTypeVar + def AndType_left(self: AndType)(using ctx: Context): Type = self.tp1.stripTypeVar + def AndType_right(self: AndType)(using ctx: Context): Type = self.tp2.stripTypeVar type OrType = Types.OrType - def isInstanceOfOrType(given ctx: Context): IsInstanceOf[OrType] = new { + def isInstanceOfOrType(using ctx: Context): IsInstanceOf[OrType] = new { def runtimeClass: Class[?] = classOf[OrType] override def unapply(x: Any): Option[OrType] = x match case tpe: Types.OrType => Some(tpe) case _ => None } - def OrType_apply(lhs: Type, rhs: Type)(given Context): OrType = + def OrType_apply(lhs: Type, rhs: Type)(using ctx: Context): OrType = Types.OrType(lhs, rhs) - def OrType_left(self: OrType)(given Context): Type = self.tp1.stripTypeVar - def OrType_right(self: OrType)(given Context): Type = self.tp2.stripTypeVar + def OrType_left(self: OrType)(using ctx: Context): Type = self.tp1.stripTypeVar + def OrType_right(self: OrType)(using ctx: Context): Type = self.tp2.stripTypeVar type MatchType = Types.MatchType - def isInstanceOfMatchType(given ctx: Context): IsInstanceOf[MatchType] = new { + def isInstanceOfMatchType(using ctx: Context): IsInstanceOf[MatchType] = new { def runtimeClass: Class[?] = classOf[MatchType] override def unapply(x: Any): Option[MatchType] = x match case tpe: Types.MatchType => Some(tpe) case _ => None } - def MatchType_apply(bound: Type, scrutinee: Type, cases: List[Type])(given Context): MatchType = + def MatchType_apply(bound: Type, scrutinee: Type, cases: List[Type])(using ctx: Context): MatchType = Types.MatchType(bound, scrutinee, 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 + def MatchType_bound(self: MatchType)(using ctx: Context): Type = self.bound + def MatchType_scrutinee(self: MatchType)(using ctx: Context): Type = self.scrutinee + def MatchType_cases(self: MatchType)(using ctx: Context): List[Type] = self.cases type ByNameType = Types.ExprType - def isInstanceOfByNameType(given ctx: Context): IsInstanceOf[ByNameType] = new { + def isInstanceOfByNameType(using ctx: Context): IsInstanceOf[ByNameType] = new { def runtimeClass: Class[?] = classOf[ByNameType] override def unapply(x: Any): Option[ByNameType] = x match case tpe: Types.ExprType => Some(tpe) case _ => None } - def ByNameType_apply(underlying: Type)(given Context): Type = Types.ExprType(underlying) + def ByNameType_apply(underlying: Type)(using ctx: Context): Type = Types.ExprType(underlying) - def ByNameType_underlying(self: ByNameType)(given Context): Type = self.resType.stripTypeVar + def ByNameType_underlying(self: ByNameType)(using ctx: Context): Type = self.resType.stripTypeVar type ParamRef = Types.ParamRef - def isInstanceOfParamRef(given ctx: Context): IsInstanceOf[ParamRef] = new { + def isInstanceOfParamRef(using ctx: Context): IsInstanceOf[ParamRef] = new { def runtimeClass: Class[?] = classOf[ParamRef] override def unapply(x: Any): Option[ParamRef] = x match case tpe: Types.TypeParamRef => Some(tpe) @@ -1399,53 +1399,53 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - def ParamRef_binder(self: ParamRef)(given Context): LambdaType[TypeOrBounds] = + def ParamRef_binder(self: ParamRef)(using ctx: Context): LambdaType[TypeOrBounds] = self.binder.asInstanceOf[LambdaType[TypeOrBounds]] // Cast to tpd - def ParamRef_paramNum(self: ParamRef)(given Context): Int = self.paramNum + def ParamRef_paramNum(self: ParamRef)(using ctx: Context): Int = self.paramNum type ThisType = Types.ThisType - def isInstanceOfThisType(given ctx: Context): IsInstanceOf[ThisType] = new { + def isInstanceOfThisType(using ctx: Context): IsInstanceOf[ThisType] = new { def runtimeClass: Class[?] = classOf[ThisType] override def unapply(x: Any): Option[ThisType] = x match case tpe: Types.ThisType => Some(tpe) case _ => None } - def ThisType_tref(self: ThisType)(given Context): Type = self.tref + def ThisType_tref(self: ThisType)(using ctx: Context): Type = self.tref type RecursiveThis = Types.RecThis - def isInstanceOfRecursiveThis(given ctx: Context): IsInstanceOf[RecursiveThis] = new { + def isInstanceOfRecursiveThis(using ctx: Context): IsInstanceOf[RecursiveThis] = new { def runtimeClass: Class[?] = classOf[RecursiveThis] override def unapply(x: Any): Option[RecursiveThis] = x match case tpe: Types.RecThis => Some(tpe) case _ => None } - def RecursiveThis_binder(self: RecursiveThis)(given Context): RecursiveType = self.binder + def RecursiveThis_binder(self: RecursiveThis)(using ctx: Context): RecursiveType = self.binder type RecursiveType = Types.RecType - def isInstanceOfRecursiveType(given ctx: Context): IsInstanceOf[RecursiveType] = new { + def isInstanceOfRecursiveType(using ctx: Context): IsInstanceOf[RecursiveType] = new { def runtimeClass: Class[?] = classOf[RecursiveType] override def unapply(x: Any): Option[RecursiveType] = x match case tpe: Types.RecType => Some(tpe) case _ => None } - def RecursiveType_apply(parentExp: RecursiveType => Type)(given ctx: Context): RecursiveType = + def RecursiveType_apply(parentExp: RecursiveType => Type)(using ctx: Context): RecursiveType = Types.RecType(parentExp) - def RecursiveType_underlying(self: RecursiveType)(given Context): Type = self.underlying.stripTypeVar + def RecursiveType_underlying(self: RecursiveType)(using ctx: Context): Type = self.underlying.stripTypeVar - def RecursiveThis_recThis(self: RecursiveType)(given Context): RecursiveThis = self.recThis + def RecursiveThis_recThis(self: RecursiveType)(using ctx: Context): RecursiveThis = self.recThis type LambdaType[ParamInfo] = Types.LambdaType { type PInfo = ParamInfo } type MethodType = Types.MethodType - def isInstanceOfMethodType(given ctx: Context): IsInstanceOf[MethodType] = new { + def isInstanceOfMethodType(using ctx: Context): IsInstanceOf[MethodType] = new { def runtimeClass: Class[?] = classOf[MethodType] override def unapply(x: Any): Option[MethodType] = x match case tpe: Types.MethodType => Some(tpe) @@ -1457,31 +1457,31 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend def MethodType_isErased(self: MethodType): Boolean = self.isErasedMethod def MethodType_isImplicit(self: MethodType): Boolean = self.isImplicitMethod - def MethodType_param(self: MethodType, idx: Int)(given Context): Type = self.newParamRef(idx) - 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 + def MethodType_param(self: MethodType, idx: Int)(using ctx: Context): Type = self.newParamRef(idx) + def MethodType_paramNames(self: MethodType)(using ctx: Context): List[String] = self.paramNames.map(_.toString) + def MethodType_paramTypes(self: MethodType)(using ctx: Context): List[Type] = self.paramInfos + def MethodType_resType(self: MethodType)(using ctx: Context): Type = self.resType type PolyType = Types.PolyType - def isInstanceOfPolyType(given ctx: Context): IsInstanceOf[PolyType] = new { + def isInstanceOfPolyType(using ctx: Context): IsInstanceOf[PolyType] = new { def runtimeClass: Class[?] = classOf[PolyType] override def unapply(x: Any): Option[PolyType] = x match case tpe: Types.PolyType => Some(tpe) case _ => None } - def PolyType_apply(paramNames: List[String])(paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)(given Context): PolyType = + def PolyType_apply(paramNames: List[String])(paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)(using ctx: Context): PolyType = Types.PolyType(paramNames.map(_.toTypeName))(paramBoundsExp, resultTypeExp) - def PolyType_param(self: PolyType, idx: Int)(given Context): Type = self.newParamRef(idx) - 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 + def PolyType_param(self: PolyType, idx: Int)(using ctx: Context): Type = self.newParamRef(idx) + def PolyType_paramNames(self: PolyType)(using ctx: Context): List[String] = self.paramNames.map(_.toString) + def PolyType_paramBounds(self: PolyType)(using ctx: Context): List[TypeBounds] = self.paramInfos + def PolyType_resType(self: PolyType)(using ctx: Context): Type = self.resType type TypeLambda = Types.TypeLambda - def isInstanceOfTypeLambda(given ctx: Context): IsInstanceOf[TypeLambda] = new { + def isInstanceOfTypeLambda(using ctx: Context): IsInstanceOf[TypeLambda] = new { def runtimeClass: Class[?] = classOf[TypeLambda] override def unapply(x: Any): Option[TypeLambda] = x match case tpe: Types.TypeLambda => Some(tpe) @@ -1491,11 +1491,11 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend def TypeLambda_apply(paramNames: List[String], boundsFn: TypeLambda => List[TypeBounds], bodyFn: TypeLambda => Type): TypeLambda = Types.HKTypeLambda(paramNames.map(_.toTypeName))(boundsFn, bodyFn) - 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_param(self: TypeLambda, idx: Int)(given Context): Type = + def TypeLambda_paramNames(self: TypeLambda)(using ctx: Context): List[String] = self.paramNames.map(_.toString) + def TypeLambda_paramBounds(self: TypeLambda)(using ctx: Context): List[TypeBounds] = self.paramInfos + def TypeLambda_param(self: TypeLambda, idx: Int)(using ctx: Context): Type = self.newParamRef(idx) - def TypeLambda_resType(self: TypeLambda)(given Context): Type = self.resType + def TypeLambda_resType(self: TypeLambda)(using ctx: Context): Type = self.resType ////////////////////// @@ -1506,32 +1506,32 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type SimpleSelector = untpd.ImportSelector - def isInstanceOfSimpleSelector(given ctx: Context): IsInstanceOf[SimpleSelector] = new { + def isInstanceOfSimpleSelector(using ctx: Context): IsInstanceOf[SimpleSelector] = new { def runtimeClass: Class[?] = classOf[SimpleSelector] override def unapply(x: Any): Option[SimpleSelector] = x match case x: untpd.ImportSelector if x.renamed.isEmpty => Some(x) case _ => None // TODO: handle import bounds } - def SimpleSelector_selection(self: SimpleSelector)(given Context): Id = self.imported + def SimpleSelector_selection(self: SimpleSelector)(using ctx: Context): Id = self.imported type RenameSelector = untpd.ImportSelector - def isInstanceOfRenameSelector(given ctx: Context): IsInstanceOf[RenameSelector] = new { + def isInstanceOfRenameSelector(using ctx: Context): IsInstanceOf[RenameSelector] = new { def runtimeClass: Class[?] = classOf[RenameSelector] override def unapply(x: Any): Option[RenameSelector] = x match case x: untpd.ImportSelector if !x.renamed.isEmpty => Some(x) case _ => None } - def RenameSelector_from(self: RenameSelector)(given Context): Id = + def RenameSelector_from(self: RenameSelector)(using ctx: Context): Id = self.imported - def RenameSelector_to(self: RenameSelector)(given Context): Id = + def RenameSelector_to(self: RenameSelector)(using ctx: Context): Id = self.renamed.asInstanceOf[untpd.Ident] type OmitSelector = untpd.ImportSelector - def isInstanceOfOmitSelector(given ctx: Context): IsInstanceOf[OmitSelector] = new { + def isInstanceOfOmitSelector(using ctx: Context): IsInstanceOf[OmitSelector] = new { def runtimeClass: Class[?] = classOf[OmitSelector] override def unapply(x: Any): Option[OmitSelector] = x match { case self: untpd.ImportSelector => @@ -1543,7 +1543,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend } - def SimpleSelector_omitted(self: OmitSelector)(given Context): Id = + def SimpleSelector_omitted(self: OmitSelector)(using ctx: Context): Id = self.imported @@ -1553,9 +1553,9 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type Id = untpd.Ident - def Id_pos(self: Id)(given Context): Position = self.sourcePos + def Id_pos(self: Id)(using ctx: Context): Position = self.sourcePos - def Id_name(self: Id)(given Context): String = self.name.toString + def Id_name(self: Id)(using ctx: Context): String = self.name.toString //////////////// @@ -1650,37 +1650,37 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type Symbol = core.Symbols.Symbol - def Symbol_owner(self: Symbol)(given Context): Symbol = self.owner - def Symbol_maybeOwner(self: Symbol)(given Context): Symbol = self.maybeOwner + def Symbol_owner(self: Symbol)(using ctx: Context): Symbol = self.owner + def Symbol_maybeOwner(self: Symbol)(using ctx: Context): Symbol = self.maybeOwner - def Symbol_flags(self: Symbol)(given Context): Flags = self.flags + def Symbol_flags(self: Symbol)(using ctx: Context): Flags = self.flags - def Symbol_tree(self: Symbol)(given Context): Tree = + def Symbol_tree(self: Symbol)(using ctx: Context): Tree = FromSymbol.definitionFromSym(self) - def Symbol_privateWithin(self: Symbol)(given Context): Option[Type] = { + def Symbol_privateWithin(self: Symbol)(using 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)(given Context): Option[Type] = { + def Symbol_protectedWithin(self: Symbol)(using 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)(given Context): String = self.name.toString + def Symbol_name(self: Symbol)(using ctx: Context): String = self.name.toString - def Symbol_fullName(self: Symbol)(given Context): String = self.fullName.toString + def Symbol_fullName(self: Symbol)(using ctx: Context): String = self.fullName.toString - def Symbol_pos(self: Symbol)(given Context): Position = self.sourcePos + def Symbol_pos(self: Symbol)(using ctx: Context): Position = self.sourcePos - def Symbol_localContext(self: Symbol)(given ctx: Context): Context = + def Symbol_localContext(self: Symbol)(using ctx: Context): Context = if (self.exists) ctx.withOwner(self) else ctx - def Symbol_comment(self: Symbol)(given ctx: Context): Option[Comment] = { + def Symbol_comment(self: Symbol)(using ctx: Context): Option[Comment] = { import dotty.tools.dotc.core.Comments.CommentsContext val docCtx = ctx.docCtx.getOrElse { throw new RuntimeException( @@ -1689,110 +1689,110 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend } docCtx.docstring(self) } - def Symbol_annots(self: Symbol)(given Context): List[Term] = + def Symbol_annots(self: Symbol)(using ctx: Context): List[Term] = self.annotations.flatMap { case _: core.Annotations.LazyBodyAnnotation => Nil case annot => annot.tree :: Nil } - def Symbol_isDefinedInCurrentRun(self: Symbol)(given Context): Boolean = + def Symbol_isDefinedInCurrentRun(self: Symbol)(using ctx: Context): Boolean = self.topLevelClass.asClass.isDefinedInCurrentRun - 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 + def Symbol_isLocalDummy(self: Symbol)(using ctx: Context): Boolean = self.isLocalDummy + def Symbol_isRefinementClass(self: Symbol)(using ctx: Context): Boolean = self.isRefinementClass + def Symbol_isAliasType(self: Symbol)(using ctx: Context): Boolean = self.isAliasType + def Symbol_isAnonymousClass(self: Symbol)(using ctx: Context): Boolean = self.isAnonymousClass + def Symbol_isAnonymousFunction(self: Symbol)(using ctx: Context): Boolean = self.isAnonymousFunction + def Symbol_isAbstractType(self: Symbol)(using ctx: Context): Boolean = self.isAbstractType + def Symbol_isClassConstructor(self: Symbol)(using ctx: Context): Boolean = self.isClassConstructor - def Symbol_fields(self: Symbol)(given Context): List[Symbol] = + def Symbol_fields(self: Symbol)(using ctx: Context): List[Symbol] = self.unforcedDecls.filter(isField) - def Symbol_field(self: Symbol)(name: String)(given Context): Symbol = { + def Symbol_field(self: Symbol)(name: String)(using ctx: Context): Symbol = { val sym = self.unforcedDecls.find(sym => sym.name == name.toTermName) if (isField(sym)) sym else core.Symbols.NoSymbol } - def Symbol_classMethod(self: Symbol)(name: String)(given Context): List[Symbol] = + def Symbol_classMethod(self: Symbol)(name: String)(using ctx: Context): List[Symbol] = self.typeRef.decls.iterator.collect { case sym if isMethod(sym) && sym.name.toString == name => sym.asTerm }.toList - def Symbol_classMethods(self: Symbol)(given Context): List[Symbol] = + def Symbol_classMethods(self: Symbol)(using ctx: Context): List[Symbol] = self.typeRef.decls.iterator.collect { case sym if isMethod(sym) => sym.asTerm }.toList private def appliedTypeRef(sym: Symbol): Type = sym.typeRef.appliedTo(sym.typeParams.map(_.typeRef)) - def Symbol_method(self: Symbol)(name: String)(given Context): List[Symbol] = + def Symbol_method(self: Symbol)(name: String)(using ctx: Context): List[Symbol] = appliedTypeRef(self).allMembers.iterator.map(_.symbol).collect { case sym if isMethod(sym) && sym.name.toString == name => sym.asTerm }.toList - def Symbol_methods(self: Symbol)(given Context): List[Symbol] = + def Symbol_methods(self: Symbol)(using ctx: Context): List[Symbol] = appliedTypeRef(self).allMembers.iterator.map(_.symbol).collect { case sym if isMethod(sym) => sym.asTerm }.toList - private def isMethod(sym: Symbol)(given Context): Boolean = + private def isMethod(sym: Symbol)(using ctx: Context): Boolean = sym.isTerm && sym.is(Flags.Method) && !sym.isConstructor - def Symbol_caseFields(self: Symbol)(given Context): List[Symbol] = + def Symbol_caseFields(self: Symbol)(using ctx: Context): List[Symbol] = if (!self.isClass) Nil else self.asClass.paramAccessors.collect { case sym if sym.is(Flags.CaseAccessor) => sym.asTerm } - private def isField(sym: Symbol)(given Context): Boolean = sym.isTerm && !sym.is(Flags.Method) + private def isField(sym: Symbol)(using ctx: Context): Boolean = sym.isTerm && !sym.is(Flags.Method) - def Symbol_of(fullName: String)(given ctx: Context): Symbol = + def Symbol_of(fullName: String)(using ctx: Context): Symbol = ctx.requiredClass(fullName) - def Symbol_newMethod(parent: Symbol, name: String, flags: Flags, tpe: Type, privateWithin: Symbol)(given ctx: Context): Symbol = { + def Symbol_newMethod(parent: Symbol, name: String, flags: Flags, tpe: Type, privateWithin: Symbol)(using ctx: Context): Symbol = { val computedFlags = flags | Flags.Method ctx.newSymbol(parent, name.toTermName, computedFlags, tpe, privateWithin) } - def Symbol_isTypeParam(self: Symbol)(given Context): Boolean = + def Symbol_isTypeParam(self: Symbol)(using ctx: Context): Boolean = self.isTypeParam - def Symbol_isType(symbol: Symbol)(given Context): Boolean = + def Symbol_isType(symbol: Symbol)(using ctx: Context): Boolean = symbol.isType - def Symbol_isTerm(symbol: Symbol)(given Context): Boolean = + def Symbol_isTerm(symbol: Symbol)(using ctx: Context): Boolean = symbol.isTerm - def Symbol_isPackageDef(symbol: Symbol)(given ctx: Context): Boolean = + def Symbol_isPackageDef(symbol: Symbol)(using ctx: Context): Boolean = symbol.is(Flags.Package) - def Symbol_isClassDef(symbol: Symbol)(given Context): Boolean = + def Symbol_isClassDef(symbol: Symbol)(using ctx: Context): Boolean = symbol.isClass - def Symbol_isTypeDef(symbol: Symbol)(given ctx: Context): Boolean = + def Symbol_isTypeDef(symbol: Symbol)(using ctx: Context): Boolean = symbol.isType && !symbol.isClass && !symbol.is(Flags.Case) - def Symbol_isValDef(symbol: Symbol)(given Context): Boolean = + def Symbol_isValDef(symbol: Symbol)(using ctx: Context): Boolean = symbol.isTerm && !symbol.is(core.Flags.Method) && !symbol.is(core.Flags.Case/*, FIXME add this check and fix sourcecode butNot = Enum | Module*/) - def Symbol_isDefDef(symbol: Symbol)(given Context): Boolean = + def Symbol_isDefDef(symbol: Symbol)(using ctx: Context): Boolean = symbol.is(core.Flags.Method) - def Symbol_isBind(symbol: Symbol)(given Context): Boolean = + def Symbol_isBind(symbol: Symbol)(using ctx: Context): Boolean = symbol.is(core.Flags.Case, butNot = Enum | Module) && !symbol.isClass - def Symbol_signature(self: Symbol)(given Context): Signature = + def Symbol_signature(self: Symbol)(using ctx: Context): Signature = self.signature - def Symbol_moduleClass(self: Symbol)(given Context): Symbol = self.moduleClass + def Symbol_moduleClass(self: Symbol)(using ctx: Context): Symbol = self.moduleClass - def Symbol_companionClass(self: Symbol)(given Context): Symbol = self.companionClass + def Symbol_companionClass(self: Symbol)(using ctx: Context): Symbol = self.companionClass - def Symbol_companionModule(self: Symbol)(given Context): Symbol = self.companionModule + def Symbol_companionModule(self: Symbol)(using ctx: Context): Symbol = self.companionModule - def Symbol_noSymbol(given ctx: Context): Symbol = core.Symbols.NoSymbol + def Symbol_noSymbol(using ctx: Context): Symbol = core.Symbols.NoSymbol /////////// @@ -1853,21 +1853,21 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend //////////////////////// /** View this expression `quoted.Expr[?]` as a `Term` */ - def QuotedExpr_unseal(self: scala.quoted.Expr[?])(given Context): Term = + def QuotedExpr_unseal(self: scala.quoted.Expr[?])(using ctx: Context): Term = PickledQuotes.quotedExprToTree(self) /** View this expression `quoted.Type[?]` as a `TypeTree` */ - def QuotedType_unseal(self: scala.quoted.Type[?])(given Context): TypeTree = + def QuotedType_unseal(self: scala.quoted.Type[?])(using ctx: Context): TypeTree = PickledQuotes.quotedTypeToTree(self) /** Convert `Term` to an `quoted.Expr[Any]` */ - def QuotedExpr_seal(self: Term)(given ctx: Context): scala.quoted.Expr[Any] = self.tpe.widen match { + def QuotedExpr_seal(self: Term)(using ctx: Context): scala.quoted.Expr[Any] = self.tpe.widen match { case _: Types.MethodType | _: Types.PolyType => throw new Exception("Cannot seal a partially applied Term. Try eta-expanding the term first.") case _ => new TastyTreeExpr(self, compilerId) } /** Checked cast to a `quoted.Expr[U]` */ - def QuotedExpr_cast[U](self: scala.quoted.Expr[?])(given tp: scala.quoted.Type[U], ctx: Context): scala.quoted.Expr[U] = { + def QuotedExpr_cast[U](self: scala.quoted.Expr[?])(using 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) @@ -1881,7 +1881,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend } /** Convert `Type` to an `quoted.Type[?]` */ - def QuotedType_seal(self: Type)(given ctx: Context): scala.quoted.Type[?] = { + def QuotedType_seal(self: Type)(using ctx: Context): scala.quoted.Type[?] = { val dummySpan = ctx.owner.span // FIXME new TreeType(tpd.TypeTree(self).withSpan(dummySpan), compilerId) } @@ -1972,11 +1972,11 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend type ImplicitSearchResult = Tree - def searchImplicit(tpe: Type)(given ctx: Context): ImplicitSearchResult = + def searchImplicit(tpe: Type)(using ctx: Context): ImplicitSearchResult = ctx.typer.inferImplicitArg(tpe, rootPosition.span) type ImplicitSearchSuccess = Tree - def isInstanceOfImplicitSearchSuccess(given ctx: Context): IsInstanceOf[ImplicitSearchSuccess] = new { + def isInstanceOfImplicitSearchSuccess(using ctx: Context): IsInstanceOf[ImplicitSearchSuccess] = new { def runtimeClass: Class[?] = classOf[ImplicitSearchSuccess] override def unapply(x: Any): Option[ImplicitSearchSuccess] = x match case x: Tree => @@ -1985,10 +1985,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => Some(x) case _ => None } - def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess)(given Context): Term = self + def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess)(using ctx: Context): Term = self type ImplicitSearchFailure = Tree - def isInstanceOfImplicitSearchFailure(given ctx: Context): IsInstanceOf[ImplicitSearchFailure] = new { + def isInstanceOfImplicitSearchFailure(using ctx: Context): IsInstanceOf[ImplicitSearchFailure] = new { def runtimeClass: Class[?] = classOf[ImplicitSearchFailure] override def unapply(x: Any): Option[ImplicitSearchFailure] = x match case x: Tree => @@ -1997,11 +1997,11 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None case _ => None } - def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure)(given Context): String = + def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure)(using ctx: Context): String = self.tpe.asInstanceOf[SearchFailureType].explanation type DivergingImplicit = Tree - def isInstanceOfDivergingImplicit(given ctx: Context): IsInstanceOf[DivergingImplicit] = new { + def isInstanceOfDivergingImplicit(using ctx: Context): IsInstanceOf[DivergingImplicit] = new { def runtimeClass: Class[?] = classOf[DivergingImplicit] override def unapply(x: Any): Option[DivergingImplicit] = x match case x: Tree => @@ -2012,7 +2012,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend } type NoMatchingImplicits = Tree - def isInstanceOfNoMatchingImplicits(given ctx: Context): IsInstanceOf[NoMatchingImplicits] = new { + def isInstanceOfNoMatchingImplicits(using ctx: Context): IsInstanceOf[NoMatchingImplicits] = new { def runtimeClass: Class[?] = classOf[NoMatchingImplicits] override def unapply(x: Any): Option[NoMatchingImplicits] = x match case x: Tree => @@ -2023,7 +2023,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend } type AmbiguousImplicits = Tree - def isInstanceOfAmbiguousImplicits(given ctx: Context): IsInstanceOf[AmbiguousImplicits] = new { + def isInstanceOfAmbiguousImplicits(using ctx: Context): IsInstanceOf[AmbiguousImplicits] = new { def runtimeClass: Class[?] = classOf[AmbiguousImplicits] override def unapply(x: Any): Option[AmbiguousImplicits] = x match case x: Tree => @@ -2033,7 +2033,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend case _ => None } - def betaReduce(fn: Term, args: List[Term])(given ctx: Context): Term = { + def betaReduce(fn: Term, args: List[Term])(using ctx: Context): Term = { val (argVals0, argRefs0) = args.foldLeft((List.empty[ValDef], List.empty[Tree])) { case ((acc1, acc2), arg) => arg.tpe match { case tpe: SingletonType if isIdempotentExpr(arg) => (acc1, arg :: acc2) case _ => @@ -2069,7 +2069,7 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend private def optional[T <: Trees.Tree[?]](tree: T): Option[tree.type] = if (tree.isEmpty) None else Some(tree) - private def withDefaultPos[T <: Tree](fn: (given Context) => T)(given ctx: Context): T = + private def withDefaultPos[T <: Tree](fn: Context ?=> T)(using ctx: Context): T = fn(given ctx.withSource(rootPosition.source)).withSpan(rootPosition.span) private def compilerId: Int = rootContext.outersIterator.toList.last.hashCode() diff --git a/library/src/scala/tasty/Reflection.scala b/library/src/scala/tasty/Reflection.scala index 3f2d7b9cd9ef..dfdf138bdb0c 100644 --- a/library/src/scala/tasty/Reflection.scala +++ b/library/src/scala/tasty/Reflection.scala @@ -421,29 +421,29 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => given QuotedExprOps: extension (expr: scala.quoted.Expr[?]) { /** View this expression `quoted.Expr[T]` as a `Term` */ - def unseal(given ctx: Context): Term = + def unseal(using ctx: Context): Term = internal.QuotedExpr_unseal(expr) /** Checked cast to a `quoted.Expr[U]` */ - def cast[U](given tp: scala.quoted.Type[U], ctx: Context): scala.quoted.Expr[U] = + def cast[U](using tp: scala.quoted.Type[U], ctx: Context): scala.quoted.Expr[U] = internal.QuotedExpr_cast[U](expr) } extension QuotedTypeAPI on [T <: AnyKind](tpe: scala.quoted.Type[T]) { /** View this expression `quoted.Type[T]` as a `TypeTree` */ - def unseal(given ctx: Context): TypeTree = + def unseal(using ctx: Context): TypeTree = internal.QuotedType_unseal(tpe) } extension TermToQuotedOps on (term: Term) { /** Convert `Term` to an `quoted.Expr[Any]` */ - def seal(given ctx: Context): scala.quoted.Expr[Any] = + def seal(using ctx: Context): scala.quoted.Expr[Any] = internal.QuotedExpr_seal(term) } extension TypeToQuotedOps on (tpe: Type) { /** Convert `Type` to an `quoted.Type[_]` */ - def seal(given ctx: Context): scala.quoted.Type[_] = + def seal(using ctx: Context): scala.quoted.Type[_] = internal.QuotedType_seal(tpe) } @@ -485,206 +485,206 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => /** Members of Tree */ extension TreeOps on (tree: Tree) { /** Position in the source code */ - def pos(given ctx: Context): Position = internal.Tree_pos(tree) + def pos(using ctx: Context): Position = internal.Tree_pos(tree) /** Symbol of defined or refered by this tree */ - def symbol(given ctx: Context): Symbol = internal.Tree_symbol(tree) + def symbol(using ctx: Context): Symbol = internal.Tree_symbol(tree) /** Shows the tree as extractors */ - def showExtractors(given ctx: Context): String = + def showExtractors(using ctx: Context): String = new ExtractorsPrinter[self.type](self).showTree(tree) /** Shows the tree as fully typed source code */ - def show(given ctx: Context): String = + def show(using ctx: Context): String = tree.showWith(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String = + def showWith(syntaxHighlight: SyntaxHighlight)(using ctx: Context): String = new SourceCodePrinter[self.type](self)(syntaxHighlight).showTree(tree) } - given (given Context): IsInstanceOf[PackageClause] = internal.isInstanceOfPackageClause + given (using ctx: Context): IsInstanceOf[PackageClause] = internal.isInstanceOfPackageClause object PackageClause { - def apply(pid: Ref, stats: List[Tree])(given ctx: Context): PackageClause = + def apply(pid: Ref, stats: List[Tree])(using ctx: Context): PackageClause = internal.PackageClause_apply(pid, stats) - def copy(original: Tree)(pid: Ref, stats: List[Tree])(given ctx: Context): PackageClause = + def copy(original: Tree)(pid: Ref, stats: List[Tree])(using ctx: Context): PackageClause = internal.PackageClause_copy(original)(pid, stats) - def unapply(tree: PackageClause)(given ctx: Context): Some[(Ref, List[Tree])] = + def unapply(tree: PackageClause)(using ctx: Context): Some[(Ref, List[Tree])] = Some((tree.pid, tree.stats)) } extension PackageClauseOps on (self: PackageClause) { - def pid(given ctx: Context): Ref = internal.PackageClause_pid(self) - def stats(given ctx: Context): List[Tree] = internal.PackageClause_stats(self) + def pid(using ctx: Context): Ref = internal.PackageClause_pid(self) + def stats(using ctx: Context): List[Tree] = internal.PackageClause_stats(self) } - given (given Context): IsInstanceOf[Import] = internal.isInstanceOfImport + given (using ctx: Context): IsInstanceOf[Import] = internal.isInstanceOfImport object Import { - def apply(expr: Term, selectors: List[ImportSelector])(given ctx: Context): Import = + def apply(expr: Term, selectors: List[ImportSelector])(using ctx: Context): Import = internal.Import_apply(expr, selectors) - def copy(original: Tree)(expr: Term, selectors: List[ImportSelector])(given ctx: Context): Import = + def copy(original: Tree)(expr: Term, selectors: List[ImportSelector])(using ctx: Context): Import = internal.Import_copy(original)(expr, selectors) - def unapply(tree: Import)(given ctx: Context): Option[(Term, List[ImportSelector])] = + def unapply(tree: Import)(using ctx: Context): Option[(Term, List[ImportSelector])] = Some((tree.expr, tree.selectors)) } extension ImportOps on (self: Import) { - def expr(given ctx: Context): Term = internal.Import_expr(self) - def selectors(given ctx: Context): List[ImportSelector] = + def expr(using ctx: Context): Term = internal.Import_expr(self) + def selectors(using ctx: Context): List[ImportSelector] = internal.Import_selectors(self) } - given (given Context): IsInstanceOf[Statement] = internal.isInstanceOfStatement + given (using ctx: Context): IsInstanceOf[Statement] = internal.isInstanceOfStatement // ----- Definitions ---------------------------------------------- - given (given Context): IsInstanceOf[Definition] = internal.isInstanceOfDefinition + given (using ctx: Context): IsInstanceOf[Definition] = internal.isInstanceOfDefinition extension DefinitionOps on (self: Definition) { - def name(given ctx: Context): String = internal.Definition_name(self) + def name(using ctx: Context): String = internal.Definition_name(self) } // ClassDef - given (given Context): IsInstanceOf[ClassDef] = internal.isInstanceOfClassDef + given (using ctx: Context): IsInstanceOf[ClassDef] = internal.isInstanceOfClassDef object ClassDef { - // TODO def apply(name: String, constr: DefDef, parents: List[TermOrTypeTree], selfOpt: Option[ValDef], body: List[Statement])(given ctx: Context): ClassDef - def copy(original: Tree)(name: String, constr: DefDef, parents: List[Tree /* Term | TypeTree */], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement])(given ctx: Context): ClassDef = + // TODO def apply(name: String, constr: DefDef, parents: List[TermOrTypeTree], selfOpt: Option[ValDef], body: List[Statement])(using ctx: Context): ClassDef + def copy(original: Tree)(name: String, constr: DefDef, parents: List[Tree /* Term | TypeTree */], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement])(using ctx: Context): ClassDef = internal.ClassDef_copy(original)(name, constr, parents, derived, selfOpt, body) - def unapply(cdef: ClassDef)(given ctx: Context): Option[(String, DefDef, List[Tree /* Term | TypeTree */], List[TypeTree], Option[ValDef], List[Statement])] = + def unapply(cdef: ClassDef)(using ctx: Context): Option[(String, DefDef, List[Tree /* Term | TypeTree */], List[TypeTree], Option[ValDef], List[Statement])] = Some((cdef.name, cdef.constructor, cdef.parents, cdef.derived, cdef.self, cdef.body)) } extension ClassDefOps on (self: ClassDef) { - def constructor(given ctx: Context): DefDef = internal.ClassDef_constructor(self) - def parents(given ctx: Context): List[Tree /* Term | TypeTree */] = internal.ClassDef_parents(self) - def derived(given ctx: Context): List[TypeTree] = internal.ClassDef_derived(self) - def self(given ctx: Context): Option[ValDef] = internal.ClassDef_self(self) - def body(given ctx: Context): List[Statement] = internal.ClassDef_body(self) + def constructor(using ctx: Context): DefDef = internal.ClassDef_constructor(self) + def parents(using ctx: Context): List[Tree /* Term | TypeTree */] = internal.ClassDef_parents(self) + def derived(using ctx: Context): List[TypeTree] = internal.ClassDef_derived(self) + def self(using ctx: Context): Option[ValDef] = internal.ClassDef_self(self) + def body(using ctx: Context): List[Statement] = internal.ClassDef_body(self) } // DefDef - given (given Context): IsInstanceOf[DefDef] = internal.isInstanceOfDefDef + given (using ctx: Context): IsInstanceOf[DefDef] = internal.isInstanceOfDefDef object DefDef { - def apply(symbol: Symbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(given ctx: Context): DefDef = + def apply(symbol: Symbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(using ctx: Context): DefDef = internal.DefDef_apply(symbol, rhsFn) - def copy(original: Tree)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term])(given ctx: Context): DefDef = + def copy(original: Tree)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term])(using ctx: Context): DefDef = internal.DefDef_copy(original)(name, typeParams, paramss, tpt, rhs) - def unapply(ddef: DefDef)(given ctx: Context): Option[(String, List[TypeDef], List[List[ValDef]], TypeTree, Option[Term])] = + def unapply(ddef: DefDef)(using ctx: Context): Option[(String, List[TypeDef], List[List[ValDef]], TypeTree, Option[Term])] = Some((ddef.name, ddef.typeParams, ddef.paramss, ddef.returnTpt, ddef.rhs)) } extension DefDefOps on (self: DefDef) { - def typeParams(given ctx: Context): List[TypeDef] = internal.DefDef_typeParams(self) - def paramss(given ctx: Context): List[List[ValDef]] = internal.DefDef_paramss(self) - def returnTpt(given ctx: Context): TypeTree = internal.DefDef_returnTpt(self) // TODO rename to tpt - def rhs(given ctx: Context): Option[Term] = internal.DefDef_rhs(self) + def typeParams(using ctx: Context): List[TypeDef] = internal.DefDef_typeParams(self) + def paramss(using ctx: Context): List[List[ValDef]] = internal.DefDef_paramss(self) + def returnTpt(using ctx: Context): TypeTree = internal.DefDef_returnTpt(self) // TODO rename to tpt + def rhs(using ctx: Context): Option[Term] = internal.DefDef_rhs(self) } // ValDef - given (given Context): IsInstanceOf[ValDef] = internal.isInstanceOfValDef + given (using ctx: Context): IsInstanceOf[ValDef] = internal.isInstanceOfValDef object ValDef { - def apply(symbol: Symbol, rhs: Option[Term])(given ctx: Context): ValDef = + def apply(symbol: Symbol, rhs: Option[Term])(using ctx: Context): ValDef = internal.ValDef_apply(symbol, rhs) - def copy(original: Tree)(name: String, tpt: TypeTree, rhs: Option[Term])(given ctx: Context): ValDef = + def copy(original: Tree)(name: String, tpt: TypeTree, rhs: Option[Term])(using ctx: Context): ValDef = internal.ValDef_copy(original)(name, tpt, rhs) - def unapply(vdef: ValDef)(given ctx: Context): Option[(String, TypeTree, Option[Term])] = + def unapply(vdef: ValDef)(using ctx: Context): Option[(String, TypeTree, Option[Term])] = Some((vdef.name, vdef.tpt, vdef.rhs)) } extension ValDefOps on (self: ValDef) { - def tpt(given ctx: Context): TypeTree = internal.ValDef_tpt(self) - def rhs(given ctx: Context): Option[Term] = internal.ValDef_rhs(self) + def tpt(using ctx: Context): TypeTree = internal.ValDef_tpt(self) + def rhs(using ctx: Context): Option[Term] = internal.ValDef_rhs(self) } // TypeDef - given (given Context): IsInstanceOf[TypeDef] = internal.isInstanceOfTypeDef + given (using ctx: Context): IsInstanceOf[TypeDef] = internal.isInstanceOfTypeDef object TypeDef { - def apply(symbol: Symbol)(given ctx: Context): TypeDef = + def apply(symbol: Symbol)(using ctx: Context): TypeDef = internal.TypeDef_apply(symbol) - def copy(original: Tree)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/)(given ctx: Context): TypeDef = + def copy(original: Tree)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/)(using ctx: Context): TypeDef = internal.TypeDef_copy(original)(name, rhs) - def unapply(tdef: TypeDef)(given ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/ /* TypeTree | TypeBoundsTree */)] = + def unapply(tdef: TypeDef)(using ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/ /* TypeTree | TypeBoundsTree */)] = Some((tdef.name, tdef.rhs)) } extension TypeDefOps on (self: TypeDef) { - def rhs(given ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.TypeDef_rhs(self) + def rhs(using ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.TypeDef_rhs(self) } // PackageDef - given (given Context): IsInstanceOf[PackageDef] = internal.isInstanceOfPackageDef + given (using ctx: Context): IsInstanceOf[PackageDef] = internal.isInstanceOfPackageDef extension PackageDefOps on (self: PackageDef) { - def owner(given ctx: Context): PackageDef = internal.PackageDef_owner(self) - def members(given ctx: Context): List[Statement] = internal.PackageDef_members(self) + def owner(using ctx: Context): PackageDef = internal.PackageDef_owner(self) + def members(using ctx: Context): List[Statement] = internal.PackageDef_members(self) } object PackageDef { - def unapply(tree: PackageDef)(given ctx: Context): Option[(String, PackageDef)] = + def unapply(tree: PackageDef)(using ctx: Context): Option[(String, PackageDef)] = Some((tree.name, tree.owner)) } // ----- Terms ---------------------------------------------------- extension TermOps on (self: Term) { - def tpe(given ctx: Context): Type = internal.Term_tpe(self) - def underlyingArgument(given ctx: Context): Term = internal.Term_underlyingArgument(self) - def underlying(given ctx: Context): Term = internal.Term_underlying(self) - def etaExpand(given ctx: Context): Term = internal.Term_etaExpand(self) + def tpe(using ctx: Context): Type = internal.Term_tpe(self) + def underlyingArgument(using ctx: Context): Term = internal.Term_underlyingArgument(self) + def underlying(using ctx: Context): Term = internal.Term_underlying(self) + def etaExpand(using ctx: Context): Term = internal.Term_etaExpand(self) /** A unary apply node with given argument: `tree(arg)` */ - def appliedTo(arg: Term)(given ctx: Context): Term = + def appliedTo(arg: Term)(using ctx: Context): Term = self.appliedToArgs(arg :: Nil) /** An apply node with given arguments: `tree(arg, args0, ..., argsN)` */ - def appliedTo(arg: Term, args: Term*)(given ctx: Context): Term = + def appliedTo(arg: Term, args: Term*)(using ctx: Context): Term = self.appliedToArgs(arg :: args.toList) /** An apply node with given argument list `tree(args(0), ..., args(args.length - 1))` */ - def appliedToArgs(args: List[Term])(given ctx: Context): Apply = + def appliedToArgs(args: List[Term])(using ctx: Context): Apply = Apply(self, args) /** The current tree applied to given argument lists: * `tree (argss(0)) ... (argss(argss.length -1))` */ - def appliedToArgss(argss: List[List[Term]])(given ctx: Context): Term = + def appliedToArgss(argss: List[List[Term]])(using ctx: Context): Term = argss.foldLeft(self: Term)(Apply(_, _)) /** The current tree applied to (): `tree()` */ - def appliedToNone(given ctx: Context): Apply = + def appliedToNone(using ctx: Context): Apply = self.appliedToArgs(Nil) /** The current tree applied to given type argument: `tree[targ]` */ - def appliedToType(targ: Type)(given ctx: Context): Term = + def appliedToType(targ: Type)(using ctx: Context): Term = self.appliedToTypes(targ :: Nil) /** The current tree applied to given type arguments: `tree[targ0, ..., targN]` */ - def appliedToTypes(targs: List[Type])(given ctx: Context): Term = + def appliedToTypes(targs: List[Type])(using ctx: Context): Term = self.appliedToTypeTrees(targs map (Inferred(_))) /** The current tree applied to given type argument list: `tree[targs(0), ..., targs(targs.length - 1)]` */ - def appliedToTypeTrees(targs: List[TypeTree])(given ctx: Context): Term = + def appliedToTypeTrees(targs: List[TypeTree])(using ctx: Context): Term = if (targs.isEmpty) self else TypeApply(self, targs) /** A select node that selects the given symbol. */ - def select(sym: Symbol)(given ctx: Context): Select = Select(self, sym) + def select(sym: Symbol)(using ctx: Context): Select = Select(self, sym) } - given (given Context): IsInstanceOf[Term] = internal.isInstanceOfTerm + given (using ctx: Context): IsInstanceOf[Term] = internal.isInstanceOfTerm - given (given Context): IsInstanceOf[Ref] = internal.isInstanceOfRef + given (using ctx: Context): IsInstanceOf[Ref] = internal.isInstanceOfRef object Ref { @@ -702,35 +702,35 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * the class body of `C`, or have `foo` outside the lexical * scope for the definition of `foo`. */ - def apply(sym: Symbol)(given ctx: Context): Ref = + def apply(sym: Symbol)(using ctx: Context): Ref = internal.Ref_apply(sym) } - given (given Context): IsInstanceOf[Ident] = internal.isInstanceOfIdent + given (using ctx: Context): IsInstanceOf[Ident] = internal.isInstanceOfIdent extension IdentOps on (self: Ident) { - def name(given ctx: Context): String = internal.Ident_name(self) + def name(using ctx: Context): String = internal.Ident_name(self) } /** Scala term identifier */ object Ident { - def apply(tmref: TermRef)(given ctx: Context): Term = + def apply(tmref: TermRef)(using ctx: Context): Term = internal.Ident_apply(tmref) - def copy(original: Tree)(name: String)(given ctx: Context): Ident = + def copy(original: Tree)(name: String)(using ctx: Context): Ident = internal.Ident_copy(original)(name) /** Matches a term identifier and returns its name */ - def unapply(tree: Ident)(given ctx: Context): Option[String] = + def unapply(tree: Ident)(using ctx: Context): Option[String] = Some(tree.name) } - given (given Context): IsInstanceOf[Select] = internal.isInstanceOfSelect + given (using ctx: Context): IsInstanceOf[Select] = internal.isInstanceOfSelect /** Scala term selection */ object Select { /** Select a term member by symbol */ - def apply(qualifier: Term, symbol: Symbol)(given ctx: Context): Select = + def apply(qualifier: Term, symbol: Symbol)(using ctx: Context): Select = internal.Select_apply(qualifier, symbol) /** Select a field or a non-overloaded method by name @@ -739,267 +739,267 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * method is overloaded. The method `overloaded` should be used * in that case. */ - def unique(qualifier: Term, name: String)(given ctx: Context): Select = + def unique(qualifier: Term, name: String)(using ctx: Context): Select = internal.Select_unique(qualifier, name) // TODO rename, this returns an Apply and not a Select /** Call an overloaded method with the given type and term parameters */ - def overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term])(given ctx: Context): Apply = + def overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term])(using ctx: Context): Apply = internal.Select_overloaded(qualifier, name, targs, args) - def copy(original: Tree)(qualifier: Term, name: String)(given ctx: Context): Select = + def copy(original: Tree)(qualifier: Term, name: String)(using ctx: Context): Select = internal.Select_copy(original)(qualifier, name) /** Matches `.` */ - def unapply(x: Select)(given ctx: Context): Option[(Term, String)] = + def unapply(x: Select)(using ctx: Context): Option[(Term, String)] = Some((x.qualifier, x.name)) } extension SelectOps on (self: Select) { - def qualifier(given ctx: Context): Term = internal.Select_qualifier(self) - def name(given ctx: Context): String = internal.Select_name(self) - def signature(given ctx: Context): Option[Signature] = internal.Select_signature(self) + def qualifier(using ctx: Context): Term = internal.Select_qualifier(self) + def name(using ctx: Context): String = internal.Select_name(self) + def signature(using ctx: Context): Option[Signature] = internal.Select_signature(self) } - given (given Context): IsInstanceOf[Literal] = + given (using ctx: Context): IsInstanceOf[Literal] = internal.isInstanceOfLiteral /** Scala literal constant */ object Literal { /** Create a literal constant */ - def apply(constant: Constant)(given ctx: Context): Literal = + def apply(constant: Constant)(using ctx: Context): Literal = internal.Literal_apply(constant) - def copy(original: Tree)(constant: Constant)(given ctx: Context): Literal = + def copy(original: Tree)(constant: Constant)(using ctx: Context): Literal = internal.Literal_copy(original)(constant) /** Matches a literal constant */ - def unapply(x: Literal)(given ctx: Context): Option[Constant] = + def unapply(x: Literal)(using ctx: Context): Option[Constant] = Some(x.constant) } extension LiteralOps on (self: Literal) { - def constant(given ctx: Context): Constant = internal.Literal_constant(self) + def constant(using ctx: Context): Constant = internal.Literal_constant(self) } - given (given Context): IsInstanceOf[This] = internal.isInstanceOfThis + given (using ctx: Context): IsInstanceOf[This] = internal.isInstanceOfThis /** Scala `this` or `this[id]` */ object This { /** Create a `this[` */ - def apply(cls: Symbol)(given ctx: Context): This = + def apply(cls: Symbol)(using ctx: Context): This = internal.This_apply(cls) - def copy(original: Tree)(qual: Option[Id])(given ctx: Context): This = + def copy(original: Tree)(qual: Option[Id])(using ctx: Context): This = internal.This_copy(original)(qual) /** Matches `this[` */ - def unapply(x: This)(given ctx: Context): Option[Option[Id]] = Some(x.id) + def unapply(x: This)(using ctx: Context): Option[Option[Id]] = Some(x.id) } extension ThisOps on (self: This) { - def id(given ctx: Context): Option[Id] = internal.This_id(self) + def id(using ctx: Context): Option[Id] = internal.This_id(self) } - given (given Context): IsInstanceOf[New] = internal.isInstanceOfNew + given (using ctx: Context): IsInstanceOf[New] = internal.isInstanceOfNew /** Scala `new` */ object New { /** Create a `new ` */ - def apply(tpt: TypeTree)(given ctx: Context): New = + def apply(tpt: TypeTree)(using ctx: Context): New = internal.New_apply(tpt) - def copy(original: Tree)(tpt: TypeTree)(given ctx: Context): New = + def copy(original: Tree)(tpt: TypeTree)(using ctx: Context): New = internal.New_copy(original)(tpt) /** Matches a `new ` */ - def unapply(x: New)(given ctx: Context): Option[TypeTree] = Some(x.tpt) + def unapply(x: New)(using ctx: Context): Option[TypeTree] = Some(x.tpt) } extension NewOps on (self: New) { - def tpt(given ctx: Context): TypeTree = internal.New_tpt(self) + def tpt(using ctx: Context): TypeTree = internal.New_tpt(self) } - given (given Context): IsInstanceOf[NamedArg] = internal.isInstanceOfNamedArg + given (using ctx: Context): IsInstanceOf[NamedArg] = internal.isInstanceOfNamedArg /** Scala named argument `x = y` in argument position */ object NamedArg { /** Create a named argument ` = ` */ - def apply(name: String, arg: Term)(given ctx: Context): NamedArg = + def apply(name: String, arg: Term)(using ctx: Context): NamedArg = internal.NamedArg_apply(name, arg) - def copy(original: Tree)(name: String, arg: Term)(given ctx: Context): NamedArg = + def copy(original: Tree)(name: String, arg: Term)(using ctx: Context): NamedArg = internal.NamedArg_copy(original)(name, arg) /** Matches a named argument ` = ` */ - def unapply(x: NamedArg)(given ctx: Context): Option[(String, Term)] = + def unapply(x: NamedArg)(using ctx: Context): Option[(String, Term)] = Some((x.name, x.value)) } extension NamedArgOps on (self: NamedArg) { - def name(given ctx: Context): String = internal.NamedArg_name(self) - def value(given ctx: Context): Term = internal.NamedArg_value(self) + def name(using ctx: Context): String = internal.NamedArg_name(self) + def value(using ctx: Context): Term = internal.NamedArg_value(self) } - given (given Context): IsInstanceOf[Apply] = internal.isInstanceOfApply + given (using ctx: Context): IsInstanceOf[Apply] = internal.isInstanceOfApply /** Scala parameter application */ object Apply { /** Create a function application `()` */ - def apply(fun: Term, args: List[Term])(given ctx: Context): Apply = + def apply(fun: Term, args: List[Term])(using ctx: Context): Apply = internal.Apply_apply(fun, args) - def copy(original: Tree)(fun: Term, args: List[Term])(given ctx: Context): Apply = + def copy(original: Tree)(fun: Term, args: List[Term])(using ctx: Context): Apply = internal.Apply_copy(original)(fun, args) /** Matches a function application `()` */ - def unapply(x: Apply)(given ctx: Context): Option[(Term, List[Term])] = + def unapply(x: Apply)(using ctx: Context): Option[(Term, List[Term])] = Some((x.fun, x.args)) } extension ApplyOps on (self: Apply) { - def fun(given ctx: Context): Term = internal.Apply_fun(self) - def args(given ctx: Context): List[Term] = internal.Apply_args(self) + def fun(using ctx: Context): Term = internal.Apply_fun(self) + def args(using ctx: Context): List[Term] = internal.Apply_args(self) } - given (given Context): IsInstanceOf[TypeApply] = internal.isInstanceOfTypeApply + given (using ctx: Context): IsInstanceOf[TypeApply] = internal.isInstanceOfTypeApply /** Scala type parameter application */ object TypeApply { /** Create a function type application `[]` */ - def apply(fun: Term, args: List[TypeTree])(given ctx: Context): TypeApply = + def apply(fun: Term, args: List[TypeTree])(using ctx: Context): TypeApply = internal.TypeApply_apply(fun, args) - def copy(original: Tree)(fun: Term, args: List[TypeTree])(given ctx: Context): TypeApply = + def copy(original: Tree)(fun: Term, args: List[TypeTree])(using ctx: Context): TypeApply = internal.TypeApply_copy(original)(fun, args) /** Matches a function type application `[]` */ - def unapply(x: TypeApply)(given ctx: Context): Option[(Term, List[TypeTree])] = + def unapply(x: TypeApply)(using ctx: Context): Option[(Term, List[TypeTree])] = Some((x.fun, x.args)) } extension TypeApplyOps on (self: TypeApply) { - def fun(given ctx: Context): Term = internal.TypeApply_fun(self) - def args(given ctx: Context): List[TypeTree] = internal.TypeApply_args(self) + def fun(using ctx: Context): Term = internal.TypeApply_fun(self) + def args(using ctx: Context): List[TypeTree] = internal.TypeApply_args(self) } - given (given Context): IsInstanceOf[Super] = internal.isInstanceOfSuper + given (using ctx: Context): IsInstanceOf[Super] = internal.isInstanceOfSuper /** Scala `x.super` or `x.super[id]` */ object Super { /** Creates a `.super[` */ - def apply(qual: Term, mix: Option[Id])(given ctx: Context): Super = + def apply(qual: Term, mix: Option[Id])(using ctx: Context): Super = internal.Super_apply(qual, mix) - def copy(original: Tree)(qual: Term, mix: Option[Id])(given ctx: Context): Super = + def copy(original: Tree)(qual: Term, mix: Option[Id])(using ctx: Context): Super = internal.Super_copy(original)(qual, mix) /** Matches a `.super[` */ - def unapply(x: Super)(given ctx: Context): Option[(Term, Option[Id])] = + def unapply(x: Super)(using ctx: Context): Option[(Term, Option[Id])] = Some((x.qualifier, x.id)) } extension SuperOps on (self: Super) { - def qualifier(given ctx: Context): Term = internal.Super_qualifier(self) - def id(given ctx: Context): Option[Id] = internal.Super_id(self) + def qualifier(using ctx: Context): Term = internal.Super_qualifier(self) + def id(using ctx: Context): Option[Id] = internal.Super_id(self) } - given (given Context): IsInstanceOf[Typed] = internal.isInstanceOfTyped + given (using ctx: Context): IsInstanceOf[Typed] = internal.isInstanceOfTyped /** Scala ascription `x: T` */ object Typed { /** Create a type ascription `: ` */ - def apply(expr: Term, tpt: TypeTree)(given ctx: Context): Typed = + def apply(expr: Term, tpt: TypeTree)(using ctx: Context): Typed = internal.Typed_apply(expr, tpt) - def copy(original: Tree)(expr: Term, tpt: TypeTree)(given ctx: Context): Typed = + def copy(original: Tree)(expr: Term, tpt: TypeTree)(using ctx: Context): Typed = internal.Typed_copy(original)(expr, tpt) /** Matches `: ` */ - def unapply(x: Typed)(given ctx: Context): Option[(Term, TypeTree)] = + def unapply(x: Typed)(using ctx: Context): Option[(Term, TypeTree)] = Some((x.expr, x.tpt)) } extension TypedOps on (self: Typed) { - def expr(given ctx: Context): Term = internal.Typed_expr(self) - def tpt(given ctx: Context): TypeTree = internal.Typed_tpt(self) + def expr(using ctx: Context): Term = internal.Typed_expr(self) + def tpt(using ctx: Context): TypeTree = internal.Typed_tpt(self) } - given (given Context): IsInstanceOf[Assign] = internal.isInstanceOfAssign + given (using ctx: Context): IsInstanceOf[Assign] = internal.isInstanceOfAssign /** Scala assign `x = y` */ object Assign { /** Create an assignment ` = ` */ - def apply(lhs: Term, rhs: Term)(given ctx: Context): Assign = + def apply(lhs: Term, rhs: Term)(using ctx: Context): Assign = internal.Assign_apply(lhs, rhs) - def copy(original: Tree)(lhs: Term, rhs: Term)(given ctx: Context): Assign = + def copy(original: Tree)(lhs: Term, rhs: Term)(using ctx: Context): Assign = internal.Assign_copy(original)(lhs, rhs) /** Matches an assignment ` = ` */ - def unapply(x: Assign)(given ctx: Context): Option[(Term, Term)] = + def unapply(x: Assign)(using ctx: Context): Option[(Term, Term)] = Some((x.lhs, x.rhs)) } extension AssignOps on (self: Assign) { - def lhs(given ctx: Context): Term = internal.Assign_lhs(self) - def rhs(given ctx: Context): Term = internal.Assign_rhs(self) + def lhs(using ctx: Context): Term = internal.Assign_lhs(self) + def rhs(using ctx: Context): Term = internal.Assign_rhs(self) } - given (given Context): IsInstanceOf[Block] = internal.isInstanceOfBlock + given (using ctx: Context): IsInstanceOf[Block] = internal.isInstanceOfBlock /** Scala code block `{ stat0; ...; statN; expr }` term */ object Block { /** Creates a block `{ ; }` */ - def apply(stats: List[Statement], expr: Term)(given ctx: Context): Block = + def apply(stats: List[Statement], expr: Term)(using ctx: Context): Block = internal.Block_apply(stats, expr) - def copy(original: Tree)(stats: List[Statement], expr: Term)(given ctx: Context): Block = + def copy(original: Tree)(stats: List[Statement], expr: Term)(using ctx: Context): Block = internal.Block_copy(original)(stats, expr) /** Matches a block `{ ; }` */ - def unapply(x: Block)(given ctx: Context): Option[(List[Statement], Term)] = + def unapply(x: Block)(using ctx: Context): Option[(List[Statement], Term)] = Some((x.statements, x.expr)) } extension BlockOps on (self: Block) { - def statements(given ctx: Context): List[Statement] = internal.Block_statements(self) - def expr(given ctx: Context): Term = internal.Block_expr(self) + def statements(using ctx: Context): List[Statement] = internal.Block_statements(self) + def expr(using ctx: Context): Term = internal.Block_expr(self) } - given (given Context): IsInstanceOf[Closure] = internal.isInstanceOfClosure + given (using ctx: Context): IsInstanceOf[Closure] = internal.isInstanceOfClosure object Closure { - def apply(meth: Term, tpt: Option[Type])(given ctx: Context): Closure = + def apply(meth: Term, tpt: Option[Type])(using ctx: Context): Closure = internal.Closure_apply(meth, tpt) - def copy(original: Tree)(meth: Tree, tpt: Option[Type])(given ctx: Context): Closure = + def copy(original: Tree)(meth: Tree, tpt: Option[Type])(using ctx: Context): Closure = internal.Closure_copy(original)(meth, tpt) - def unapply(x: Closure)(given ctx: Context): Option[(Term, Option[Type])] = + def unapply(x: Closure)(using ctx: Context): Option[(Term, Option[Type])] = Some((x.meth, x.tpeOpt)) } extension ClosureOps on (self: Closure) { - def meth(given ctx: Context): Term = internal.Closure_meth(self) - def tpeOpt(given ctx: Context): Option[Type] = internal.Closure_tpeOpt(self) + def meth(using ctx: Context): Term = internal.Closure_meth(self) + def tpeOpt(using ctx: Context): Option[Type] = internal.Closure_tpeOpt(self) } /** A lambda `(...) => ...` in the source code is represented as @@ -1015,7 +1015,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * of `Lambda`. */ object Lambda { - def unapply(tree: Tree)(given ctx: Context): Option[(List[ValDef], Term)] = tree match { + def unapply(tree: Tree)(using ctx: Context): Option[(List[ValDef], Term)] = tree match { case Block((ddef @ DefDef(_, _, params :: Nil, _, Some(body))) :: Nil, Closure(meth, _)) if ddef.symbol == meth.symbol => Some(params, body) @@ -1023,530 +1023,529 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => case _ => None } - def apply(tpe: MethodType, rhsFn: List[Tree] => Tree)(given ctx: Context): Block = + def apply(tpe: MethodType, rhsFn: List[Tree] => Tree)(using ctx: Context): Block = internal.Lambda_apply(tpe, rhsFn) } - given (given Context): IsInstanceOf[If] = internal.isInstanceOfIf + given (using ctx: Context): IsInstanceOf[If] = internal.isInstanceOfIf /** Scala `if`/`else` term */ object If { /** Create an if/then/else `if () else ` */ - def apply(cond: Term, thenp: Term, elsep: Term)(given ctx: Context): If = + def apply(cond: Term, thenp: Term, elsep: Term)(using ctx: Context): If = internal.If_apply(cond, thenp, elsep) - def copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(given ctx: Context): If = + def copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(using ctx: Context): If = internal.If_copy(original)(cond, thenp, elsep) /** Matches an if/then/else `if () else ` */ - def unapply(tree: If)(given ctx: Context): Option[(Term, Term, Term)] = + def unapply(tree: If)(using ctx: Context): Option[(Term, Term, Term)] = Some((tree.cond, tree.thenp, tree.elsep)) } extension IfOps on (self: If) { - def cond(given ctx: Context): Term = internal.If_cond(self) - def thenp(given ctx: Context): Term = internal.If_thenp(self) - def elsep(given ctx: Context): Term = internal.If_elsep(self) + def cond(using ctx: Context): Term = internal.If_cond(self) + def thenp(using ctx: Context): Term = internal.If_thenp(self) + def elsep(using ctx: Context): Term = internal.If_elsep(self) } - given (given Context): IsInstanceOf[Match] = internal.isInstanceOfMatch + given (using ctx: Context): IsInstanceOf[Match] = internal.isInstanceOfMatch /** Scala `match` term */ object Match { /** Creates a pattern match ` match { }` */ - def apply(selector: Term, cases: List[CaseDef])(given ctx: Context): Match = + def apply(selector: Term, cases: List[CaseDef])(using ctx: Context): Match = internal.Match_apply(selector, cases) - def copy(original: Tree)(selector: Term, cases: List[CaseDef])(given ctx: Context): Match = + def copy(original: Tree)(selector: Term, cases: List[CaseDef])(using ctx: Context): Match = internal.Match_copy(original)(selector, cases) /** Matches a pattern match ` match { }` */ - def unapply(x: Match)(given ctx: Context): Option[(Term, List[CaseDef])] = + def unapply(x: Match)(using ctx: Context): Option[(Term, List[CaseDef])] = Some((x.scrutinee, x.cases)) } extension MatchOps on (self: Match) { - def scrutinee(given ctx: Context): Term = internal.Match_scrutinee(self) - def cases(given ctx: Context): List[CaseDef] = internal.Match_cases(self) + def scrutinee(using ctx: Context): Term = internal.Match_scrutinee(self) + def cases(using ctx: Context): List[CaseDef] = internal.Match_cases(self) } - given (given Context): IsInstanceOf[GivenMatch] = internal.isInstanceOfGivenMatch + given (using ctx: Context): IsInstanceOf[GivenMatch] = internal.isInstanceOfGivenMatch /** Scala implicit `match` term */ object GivenMatch { /** Creates a pattern match `given match { }` */ - def apply(cases: List[CaseDef])(given ctx: Context): GivenMatch = + def apply(cases: List[CaseDef])(using ctx: Context): GivenMatch = internal.GivenMatch_apply(cases) - def copy(original: Tree)(cases: List[CaseDef])(given ctx: Context): GivenMatch = + def copy(original: Tree)(cases: List[CaseDef])(using ctx: Context): GivenMatch = internal.GivenMatch_copy(original)(cases) /** Matches a pattern match `given match { }` */ - def unapply(x: GivenMatch)(given ctx: Context): Option[List[CaseDef]] = Some(x.cases) + def unapply(x: GivenMatch)(using ctx: Context): Option[List[CaseDef]] = Some(x.cases) } extension GivenMatchOps on (self: GivenMatch) { - def cases(given ctx: Context): List[CaseDef] = internal.GivenMatch_cases(self) + def cases(using ctx: Context): List[CaseDef] = internal.GivenMatch_cases(self) } - given (given Context): IsInstanceOf[Try] = internal.isInstanceOfTry + given (using ctx: Context): IsInstanceOf[Try] = internal.isInstanceOfTry /** Scala `try`/`catch`/`finally` term */ object Try { /** Create a try/catch `try catch { } finally ` */ - def apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(given ctx: Context): Try = + def apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(using ctx: Context): Try = internal.Try_apply(expr, cases, finalizer) - def copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(given ctx: Context): Try = + def copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(using ctx: Context): Try = internal.Try_copy(original)(expr, cases, finalizer) /** Matches a try/catch `try catch { } finally ` */ - def unapply(x: Try)(given ctx: Context): Option[(Term, List[CaseDef], Option[Term])] = + def unapply(x: Try)(using ctx: Context): Option[(Term, List[CaseDef], Option[Term])] = Some((x.body, x.cases, x.finalizer)) } extension TryOps on (self: Try) { - def body(given ctx: Context): Term = internal.Try_body(self) - def cases(given ctx: Context): List[CaseDef] = internal.Try_cases(self) - def finalizer(given ctx: Context): Option[Term] = internal.Try_finalizer(self) + def body(using ctx: Context): Term = internal.Try_body(self) + def cases(using ctx: Context): List[CaseDef] = internal.Try_cases(self) + def finalizer(using ctx: Context): Option[Term] = internal.Try_finalizer(self) } - given (given Context): IsInstanceOf[Return] = internal.isInstanceOfReturn + given (using ctx: Context): IsInstanceOf[Return] = internal.isInstanceOfReturn /** Scala local `return` */ object Return { /** Creates `return ` */ - def apply(expr: Term)(given ctx: Context): Return = + def apply(expr: Term)(using ctx: Context): Return = internal.Return_apply(expr) - def copy(original: Tree)(expr: Term)(given ctx: Context): Return = + def copy(original: Tree)(expr: Term)(using ctx: Context): Return = internal.Return_copy(original)(expr) /** Matches `return ` */ - def unapply(x: Return)(given ctx: Context): Option[Term] = Some(x.expr) + def unapply(x: Return)(using ctx: Context): Option[Term] = Some(x.expr) } extension ReturnOps on (self: Return) { - def expr(given ctx: Context): Term = internal.Return_expr(self) + def expr(using ctx: Context): Term = internal.Return_expr(self) } - given (given Context): IsInstanceOf[Repeated] = internal.isInstanceOfRepeated + given (using ctx: Context): IsInstanceOf[Repeated] = internal.isInstanceOfRepeated object Repeated { - def apply(elems: List[Term], tpt: TypeTree)(given ctx: Context): Repeated = + def apply(elems: List[Term], tpt: TypeTree)(using ctx: Context): Repeated = internal.Repeated_apply(elems, tpt) - def copy(original: Tree)(elems: List[Term], tpt: TypeTree)(given ctx: Context): Repeated = + def copy(original: Tree)(elems: List[Term], tpt: TypeTree)(using ctx: Context): Repeated = internal.Repeated_copy(original)(elems, tpt) - def unapply(x: Repeated)(given ctx: Context): Option[(List[Term], TypeTree)] = + def unapply(x: Repeated)(using ctx: Context): Option[(List[Term], TypeTree)] = Some((x.elems, x.elemtpt)) } extension RepeatedOps on (self: Repeated) { - def elems(given ctx: Context): List[Term] = internal.Repeated_elems(self) - def elemtpt(given ctx: Context): TypeTree = internal.Repeated_elemtpt(self) + def elems(using ctx: Context): List[Term] = internal.Repeated_elems(self) + def elemtpt(using ctx: Context): TypeTree = internal.Repeated_elemtpt(self) } - given (given Context): IsInstanceOf[Inlined] = internal.isInstanceOfInlined + given (using ctx: Context): IsInstanceOf[Inlined] = internal.isInstanceOfInlined object Inlined { - def apply(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(given ctx: Context): Inlined = + def apply(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(using ctx: Context): Inlined = internal.Inlined_apply(call, bindings, expansion) - def copy(original: Tree)(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(given ctx: Context): Inlined = + def copy(original: Tree)(call: Option[Tree /* Term | TypeTree */], bindings: List[Definition], expansion: Term)(using ctx: Context): Inlined = internal.Inlined_copy(original)(call, bindings, expansion) - def unapply(x: Inlined)(given ctx: Context): Option[(Option[Tree /* Term | TypeTree */], List[Definition], Term)] = + def unapply(x: Inlined)(using ctx: Context): Option[(Option[Tree /* Term | TypeTree */], List[Definition], Term)] = Some((x.call, x.bindings, x.body)) } extension InlinedOps on (self: Inlined) { - def call(given ctx: Context): Option[Tree /* Term | TypeTree */] = internal.Inlined_call(self) - def bindings(given ctx: Context): List[Definition] = internal.Inlined_bindings(self) - def body(given ctx: Context): Term = internal.Inlined_body(self) + def call(using ctx: Context): Option[Tree /* Term | TypeTree */] = internal.Inlined_call(self) + def bindings(using ctx: Context): List[Definition] = internal.Inlined_bindings(self) + def body(using ctx: Context): Term = internal.Inlined_body(self) } - given (given Context): IsInstanceOf[SelectOuter] = internal.isInstanceOfSelectOuter + given (using ctx: Context): IsInstanceOf[SelectOuter] = internal.isInstanceOfSelectOuter object SelectOuter { - def apply(qualifier: Term, name: String, levels: Int)(given ctx: Context): SelectOuter = + def apply(qualifier: Term, name: String, levels: Int)(using ctx: Context): SelectOuter = internal.SelectOuter_apply(qualifier, name, levels) - def copy(original: Tree)(qualifier: Term, name: String, levels: Int)(given ctx: Context): SelectOuter = + def copy(original: Tree)(qualifier: Term, name: String, levels: Int)(using ctx: Context): SelectOuter = internal.SelectOuter_copy(original)(qualifier, name, levels) - def unapply(x: SelectOuter)(given ctx: Context): Option[(Term, Int, Type)] = // TODO homogenize order of parameters + def unapply(x: SelectOuter)(using ctx: Context): Option[(Term, Int, Type)] = // TODO homogenize order of parameters Some((x.qualifier, x.level, x.tpe)) } extension SelectOuterOps on (self: SelectOuter) { - def qualifier(given ctx: Context): Term = internal.SelectOuter_qualifier(self) - def level(given ctx: Context): Int = internal.SelectOuter_level(self) + def qualifier(using ctx: Context): Term = internal.SelectOuter_qualifier(self) + def level(using ctx: Context): Int = internal.SelectOuter_level(self) } - given (given Context): IsInstanceOf[While] = internal.isInstanceOfWhile + given (using ctx: Context): IsInstanceOf[While] = internal.isInstanceOfWhile object While { /** Creates a while loop `while () ` and returns (, ) */ - def apply(cond: Term, body: Term)(given ctx: Context): While = + def apply(cond: Term, body: Term)(using ctx: Context): While = internal.While_apply(cond, body) - def copy(original: Tree)(cond: Term, body: Term)(given ctx: Context): While = + def copy(original: Tree)(cond: Term, body: Term)(using ctx: Context): While = internal.While_copy(original)(cond, body) /** Extractor for while loops. Matches `while () ` and returns (, ) */ - def unapply(x: While)(given ctx: Context): Option[(Term, Term)] = + def unapply(x: While)(using ctx: Context): Option[(Term, Term)] = Some((x.cond, x.body)) } extension WhileOps on (self: While) { - def cond(given ctx: Context): Term = internal.While_cond(self) - def body(given ctx: Context): Term = internal.While_body(self) + def cond(using ctx: Context): Term = internal.While_cond(self) + def body(using ctx: Context): Term = internal.While_body(self) } // ----- TypeTrees ------------------------------------------------ extension TypeTreeOps on (self: TypeTree) { /** Type of this type tree */ - def tpe(given ctx: Context): Type = internal.TypeTree_tpe(self) + def tpe(using ctx: Context): Type = internal.TypeTree_tpe(self) } - given (given Context): IsInstanceOf[TypeTree] = + given (using ctx: Context): IsInstanceOf[TypeTree] = internal.isInstanceOfTypeTree - given (given Context): IsInstanceOf[Inferred] = internal.isInstanceOfInferred + given (using ctx: Context): IsInstanceOf[Inferred] = internal.isInstanceOfInferred /** TypeTree containing an inferred type */ object Inferred { - def apply(tpe: Type)(given ctx: Context): Inferred = + def apply(tpe: Type)(using ctx: Context): Inferred = internal.Inferred_apply(tpe) /** Matches a TypeTree containing an inferred type */ - def unapply(x: Inferred)(given ctx: Context): Boolean = true + def unapply(x: Inferred)(using ctx: Context): Boolean = true } - given (given Context): IsInstanceOf[TypeIdent] = internal.isInstanceOfTypeIdent + given (using ctx: Context): IsInstanceOf[TypeIdent] = internal.isInstanceOfTypeIdent extension TypeIdentOps on (self: TypeIdent) { - def name(given ctx: Context): String = internal.TypeIdent_name(self) + def name(using ctx: Context): String = internal.TypeIdent_name(self) } object TypeIdent { - def apply(sym: Symbol)(given ctx: Context): TypeTree = + def apply(sym: Symbol)(using ctx: Context): TypeTree = internal.TypeRef_apply(sym) - def copy(original: Tree)(name: String)(given ctx: Context): TypeIdent = + def copy(original: Tree)(name: String)(using ctx: Context): TypeIdent = internal.TypeIdent_copy(original)(name) - def unapply(x: TypeIdent)(given ctx: Context): Option[String] = Some(x.name) + def unapply(x: TypeIdent)(using ctx: Context): Option[String] = Some(x.name) } - given (given Context): IsInstanceOf[TypeSelect] = internal.isInstanceOfTypeSelect + given (using ctx: Context): IsInstanceOf[TypeSelect] = internal.isInstanceOfTypeSelect object TypeSelect { - def apply(qualifier: Term, name: String)(given ctx: Context): TypeSelect = + def apply(qualifier: Term, name: String)(using ctx: Context): TypeSelect = internal.TypeSelect_apply(qualifier, name) - def copy(original: Tree)(qualifier: Term, name: String)(given ctx: Context): TypeSelect = + def copy(original: Tree)(qualifier: Term, name: String)(using ctx: Context): TypeSelect = internal.TypeSelect_copy(original)(qualifier, name) - def unapply(x: TypeSelect)(given ctx: Context): Option[(Term, String)] = + def unapply(x: TypeSelect)(using ctx: Context): Option[(Term, String)] = Some((x.qualifier, x.name)) } extension TypeSelectOps on (self: TypeSelect) { - def qualifier(given ctx: Context): Term = internal.TypeSelect_qualifier(self) - def name(given ctx: Context): String = internal.TypeSelect_name(self) + def qualifier(using ctx: Context): Term = internal.TypeSelect_qualifier(self) + def name(using ctx: Context): String = internal.TypeSelect_name(self) } - given (given Context): IsInstanceOf[Projection] = internal.isInstanceOfProjection + given (using ctx: Context): IsInstanceOf[Projection] = internal.isInstanceOfProjection object Projection { - // TODO def apply(qualifier: TypeTree, name: String)(given ctx: Context): Project - def copy(original: Tree)(qualifier: TypeTree, name: String)(given ctx: Context): Projection = + // TODO def apply(qualifier: TypeTree, name: String)(using ctx: Context): Project + def copy(original: Tree)(qualifier: TypeTree, name: String)(using ctx: Context): Projection = internal.Projection_copy(original)(qualifier, name) - def unapply(x: Projection)(given ctx: Context): Option[(TypeTree, String)] = + def unapply(x: Projection)(using ctx: Context): Option[(TypeTree, String)] = Some((x.qualifier, x.name)) } extension ProjectionOps on (self: Projection) { - def qualifier(given ctx: Context): TypeTree = internal.Projection_qualifier(self) - def name(given ctx: Context): String = internal.Projection_name(self) + def qualifier(using ctx: Context): TypeTree = internal.Projection_qualifier(self) + def name(using ctx: Context): String = internal.Projection_name(self) } - given (given Context): IsInstanceOf[Singleton] = - internal.isInstanceOfSingleton + given (using ctx: Context): IsInstanceOf[Singleton] = internal.isInstanceOfSingleton object Singleton { - def apply(ref: Term)(given ctx: Context): Singleton = + def apply(ref: Term)(using ctx: Context): Singleton = internal.Singleton_apply(ref) - def copy(original: Tree)(ref: Term)(given ctx: Context): Singleton = + def copy(original: Tree)(ref: Term)(using ctx: Context): Singleton = internal.Singleton_copy(original)(ref) - def unapply(x: Singleton)(given ctx: Context): Option[Term] = + def unapply(x: Singleton)(using ctx: Context): Option[Term] = Some(x.ref) } extension SingletonOps on (self: Singleton) { - def ref(given ctx: Context): Term = internal.Singleton_ref(self) + def ref(using ctx: Context): Term = internal.Singleton_ref(self) } - given (given Context): IsInstanceOf[Refined] = internal.isInstanceOfRefined + given (using ctx: Context): IsInstanceOf[Refined] = internal.isInstanceOfRefined object Refined { - // TODO def apply(tpt: TypeTree, refinements: List[Definition])(given ctx: Context): Refined - def copy(original: Tree)(tpt: TypeTree, refinements: List[Definition])(given ctx: Context): Refined = + // TODO def apply(tpt: TypeTree, refinements: List[Definition])(using ctx: Context): Refined + def copy(original: Tree)(tpt: TypeTree, refinements: List[Definition])(using ctx: Context): Refined = internal.Refined_copy(original)(tpt, refinements) - def unapply(x: Refined)(given ctx: Context): Option[(TypeTree, List[Definition])] = + def unapply(x: Refined)(using ctx: Context): Option[(TypeTree, List[Definition])] = Some((x.tpt, x.refinements)) } extension RefinedOps on (self: Refined) { - def tpt(given ctx: Context): TypeTree = internal.Refined_tpt(self) - def refinements(given ctx: Context): List[Definition] = internal.Refined_refinements(self) + def tpt(using ctx: Context): TypeTree = internal.Refined_tpt(self) + def refinements(using ctx: Context): List[Definition] = internal.Refined_refinements(self) } - given (given Context): IsInstanceOf[Applied] = internal.isInstanceOfApplied + given (using ctx: Context): IsInstanceOf[Applied] = internal.isInstanceOfApplied object Applied { - def apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(given ctx: Context): Applied = + def apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(using ctx: Context): Applied = internal.Applied_apply(tpt, args) - def copy(original: Tree)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(given ctx: Context): Applied = + def copy(original: Tree)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(using ctx: Context): Applied = internal.Applied_copy(original)(tpt, args) - def unapply(x: Applied)(given ctx: Context): Option[(TypeTree, List[Tree /*TypeTree | TypeBoundsTree*/])] = + def unapply(x: Applied)(using ctx: Context): Option[(TypeTree, List[Tree /*TypeTree | TypeBoundsTree*/])] = Some((x.tpt, x.args)) } extension AppliedOps on (self: Applied) { - def tpt(given ctx: Context): TypeTree = internal.Applied_tpt(self) - def args(given ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] = internal.Applied_args(self) + def tpt(using ctx: Context): TypeTree = internal.Applied_tpt(self) + def args(using ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] = internal.Applied_args(self) } - given (given Context): IsInstanceOf[Annotated] = + given (using ctx: Context): IsInstanceOf[Annotated] = internal.isInstanceOfAnnotated object Annotated { - def apply(arg: TypeTree, annotation: Term)(given ctx: Context): Annotated = + def apply(arg: TypeTree, annotation: Term)(using ctx: Context): Annotated = internal.Annotated_apply(arg, annotation) - def copy(original: Tree)(arg: TypeTree, annotation: Term)(given ctx: Context): Annotated = + def copy(original: Tree)(arg: TypeTree, annotation: Term)(using ctx: Context): Annotated = internal.Annotated_copy(original)(arg, annotation) - def unapply(x: Annotated)(given ctx: Context): Option[(TypeTree, Term)] = + def unapply(x: Annotated)(using ctx: Context): Option[(TypeTree, Term)] = Some((x.arg, x.annotation)) } extension AnnotatedOps on (self: Annotated) { - def arg(given ctx: Context): TypeTree = internal.Annotated_arg(self) - def annotation(given ctx: Context): Term = internal.Annotated_annotation(self) + def arg(using ctx: Context): TypeTree = internal.Annotated_arg(self) + def annotation(using ctx: Context): Term = internal.Annotated_annotation(self) } - given (given Context): IsInstanceOf[MatchTypeTree] = + given (using ctx: Context): IsInstanceOf[MatchTypeTree] = internal.isInstanceOfMatchTypeTree object MatchTypeTree { - def apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(given ctx: Context): MatchTypeTree = + def apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(using ctx: Context): MatchTypeTree = internal.MatchTypeTree_apply(bound, selector, cases) - def copy(original: Tree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(given ctx: Context): MatchTypeTree = + def copy(original: Tree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(using ctx: Context): MatchTypeTree = internal.MatchTypeTree_copy(original)(bound, selector, cases) - def unapply(x: MatchTypeTree)(given ctx: Context): Option[(Option[TypeTree], TypeTree, List[TypeCaseDef])] = + def unapply(x: MatchTypeTree)(using ctx: Context): Option[(Option[TypeTree], TypeTree, List[TypeCaseDef])] = Some((x.bound, x.selector, x.cases)) } extension MatchTypeTreeOps on (self: MatchTypeTree) { - def bound(given ctx: Context): Option[TypeTree] = internal.MatchTypeTree_bound(self) - def selector(given ctx: Context): TypeTree = internal.MatchTypeTree_selector(self) - def cases(given ctx: Context): List[TypeCaseDef] = internal.MatchTypeTree_cases(self) + def bound(using ctx: Context): Option[TypeTree] = internal.MatchTypeTree_bound(self) + def selector(using ctx: Context): TypeTree = internal.MatchTypeTree_selector(self) + def cases(using ctx: Context): List[TypeCaseDef] = internal.MatchTypeTree_cases(self) } - given (given Context): IsInstanceOf[ByName] = + given (using ctx: Context): IsInstanceOf[ByName] = internal.isInstanceOfByName object ByName { - def apply(result: TypeTree)(given ctx: Context): ByName = + def apply(result: TypeTree)(using ctx: Context): ByName = internal.ByName_apply(result) - def copy(original: Tree)(result: TypeTree)(given ctx: Context): ByName = + def copy(original: Tree)(result: TypeTree)(using ctx: Context): ByName = internal.ByName_copy(original)(result) - def unapply(x: ByName)(given ctx: Context): Option[TypeTree] = + def unapply(x: ByName)(using ctx: Context): Option[TypeTree] = Some(x.result) } extension ByNameOps on (self: ByName) { - def result(given ctx: Context): TypeTree = internal.ByName_result(self) + def result(using ctx: Context): TypeTree = internal.ByName_result(self) } - given (given Context): IsInstanceOf[LambdaTypeTree] = internal.isInstanceOfLambdaTypeTree + given (using ctx: Context): IsInstanceOf[LambdaTypeTree] = internal.isInstanceOfLambdaTypeTree object LambdaTypeTree { - def apply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(given ctx: Context): LambdaTypeTree = + def apply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(using ctx: Context): LambdaTypeTree = internal.Lambdaapply(tparams, body) - def copy(original: Tree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(given ctx: Context): LambdaTypeTree = + def copy(original: Tree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(using ctx: Context): LambdaTypeTree = internal.Lambdacopy(original)(tparams, body) - def unapply(tree: LambdaTypeTree)(given ctx: Context): Option[(List[TypeDef], Tree /*TypeTree | TypeBoundsTree*/)] = + def unapply(tree: LambdaTypeTree)(using ctx: Context): Option[(List[TypeDef], Tree /*TypeTree | TypeBoundsTree*/)] = Some((tree.tparams, tree.body)) } extension LambdaTypeTreeOps on (self: LambdaTypeTree) { - def tparams(given ctx: Context): List[TypeDef] = internal.Lambdatparams(self) - def body(given ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.Lambdabody(self) + def tparams(using ctx: Context): List[TypeDef] = internal.Lambdatparams(self) + def body(using ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.Lambdabody(self) } - given (given Context): IsInstanceOf[TypeBind] = internal.isInstanceOfTypeBind + given (using ctx: Context): IsInstanceOf[TypeBind] = internal.isInstanceOfTypeBind object TypeBind { - // TODO def apply(name: String, tree: Tree)(given ctx: Context): TypeBind - def copy(original: Tree)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/)(given ctx: Context): TypeBind = + // TODO def apply(name: String, tree: Tree)(using ctx: Context): TypeBind + def copy(original: Tree)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/)(using ctx: Context): TypeBind = internal.TypeBind_copy(original)(name, tpt) - def unapply(x: TypeBind)(given ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/)] = + def unapply(x: TypeBind)(using ctx: Context): Option[(String, Tree /*TypeTree | TypeBoundsTree*/)] = Some((x.name, x.body)) } extension TypeBindOps on (self: TypeBind) { - def name(given ctx: Context): String = internal.TypeBind_name(self) - def body(given ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.TypeBind_body(self) + def name(using ctx: Context): String = internal.TypeBind_name(self) + def body(using ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ = internal.TypeBind_body(self) } - given (given Context): IsInstanceOf[TypeBlock] = internal.isInstanceOfTypeBlock + given (using ctx: Context): IsInstanceOf[TypeBlock] = internal.isInstanceOfTypeBlock object TypeBlock { - def apply(aliases: List[TypeDef], tpt: TypeTree)(given ctx: Context): TypeBlock = + def apply(aliases: List[TypeDef], tpt: TypeTree)(using ctx: Context): TypeBlock = internal.TypeBlock_apply(aliases, tpt) - def copy(original: Tree)(aliases: List[TypeDef], tpt: TypeTree)(given ctx: Context): TypeBlock = + def copy(original: Tree)(aliases: List[TypeDef], tpt: TypeTree)(using ctx: Context): TypeBlock = internal.TypeBlock_copy(original)(aliases, tpt) - def unapply(x: TypeBlock)(given ctx: Context): Option[(List[TypeDef], TypeTree)] = + def unapply(x: TypeBlock)(using ctx: Context): Option[(List[TypeDef], TypeTree)] = Some((x.aliases, x.tpt)) } extension TypeBlockOps on (self: TypeBlock) { - def aliases(given ctx: Context): List[TypeDef] = internal.TypeBlock_aliases(self) - def tpt(given ctx: Context): TypeTree = internal.TypeBlock_tpt(self) + def aliases(using ctx: Context): List[TypeDef] = internal.TypeBlock_aliases(self) + def tpt(using ctx: Context): TypeTree = internal.TypeBlock_tpt(self) } // ----- TypeBoundsTrees ------------------------------------------------ extension TypeBoundsTreeOps on (self: TypeBoundsTree) { - def tpe(given ctx: Context): TypeBounds = internal.TypeBoundsTree_tpe(self) - def low(given ctx: Context): TypeTree = internal.TypeBoundsTree_low(self) - def hi(given ctx: Context): TypeTree = internal.TypeBoundsTree_hi(self) + def tpe(using ctx: Context): TypeBounds = internal.TypeBoundsTree_tpe(self) + def low(using ctx: Context): TypeTree = internal.TypeBoundsTree_low(self) + def hi(using ctx: Context): TypeTree = internal.TypeBoundsTree_hi(self) } - given (given Context): IsInstanceOf[TypeBoundsTree] = internal.isInstanceOfTypeBoundsTree + given (using ctx: Context): IsInstanceOf[TypeBoundsTree] = internal.isInstanceOfTypeBoundsTree object TypeBoundsTree { - def unapply(x: TypeBoundsTree)(given ctx: Context): Option[(TypeTree, TypeTree)] = + def unapply(x: TypeBoundsTree)(using ctx: Context): Option[(TypeTree, TypeTree)] = Some((x.low, x.hi)) } extension WildcardTypeTreeOps on (self: WildcardTypeTree) { - def tpe(given ctx: Context): TypeOrBounds = internal.WildcardTypeTree_tpe(self) + def tpe(using ctx: Context): TypeOrBounds = internal.WildcardTypeTree_tpe(self) } - given (given Context): IsInstanceOf[WildcardTypeTree] = internal.isInstanceOfWildcardTypeTree + given (using ctx: Context): IsInstanceOf[WildcardTypeTree] = internal.isInstanceOfWildcardTypeTree object WildcardTypeTree { /** Matches a TypeBoundsTree containing wildcard type bounds */ - def unapply(x: WildcardTypeTree)(given ctx: Context): Boolean = true + def unapply(x: WildcardTypeTree)(using ctx: Context): Boolean = true } // ----- CaseDefs ------------------------------------------------ extension CaseDefOps on (caseDef: CaseDef) { - def pattern(given ctx: Context): Tree = internal.CaseDef_pattern(caseDef) - def guard(given ctx: Context): Option[Term] = internal.CaseDef_guard(caseDef) - def rhs(given ctx: Context): Term = internal.CaseDef_rhs(caseDef) + def pattern(using ctx: Context): Tree = internal.CaseDef_pattern(caseDef) + def guard(using ctx: Context): Option[Term] = internal.CaseDef_guard(caseDef) + def rhs(using ctx: Context): Term = internal.CaseDef_rhs(caseDef) } - given (given Context): IsInstanceOf[CaseDef] = internal.isInstanceOfCaseDef + given (using ctx: Context): IsInstanceOf[CaseDef] = internal.isInstanceOfCaseDef object CaseDef { - def apply(pattern: Tree, guard: Option[Term], rhs: Term)(given ctx: Context): CaseDef = + def apply(pattern: Tree, guard: Option[Term], rhs: Term)(using ctx: Context): CaseDef = internal.CaseDef_module_apply(pattern, guard, rhs) - def copy(original: Tree)(pattern: Tree, guard: Option[Term], rhs: Term)(given ctx: Context): CaseDef = + def copy(original: Tree)(pattern: Tree, guard: Option[Term], rhs: Term)(using ctx: Context): CaseDef = internal.CaseDef_module_copy(original)(pattern, guard, rhs) - def unapply(x: CaseDef)(given ctx: Context): Option[(Tree, Option[Term], Term)] = + def unapply(x: CaseDef)(using ctx: Context): Option[(Tree, Option[Term], Term)] = Some((x.pattern, x.guard, x.rhs)) } extension TypeCaseDefOps on (caseDef: TypeCaseDef) { - def pattern(given ctx: Context): TypeTree = internal.TypeCaseDef_pattern(caseDef) - def rhs(given ctx: Context): TypeTree = internal.TypeCaseDef_rhs(caseDef) + def pattern(using ctx: Context): TypeTree = internal.TypeCaseDef_pattern(caseDef) + def rhs(using ctx: Context): TypeTree = internal.TypeCaseDef_rhs(caseDef) } - given (given Context): IsInstanceOf[TypeCaseDef] = + given (using ctx: Context): IsInstanceOf[TypeCaseDef] = internal.isInstanceOfTypeCaseDef object TypeCaseDef { - def apply(pattern: TypeTree, rhs: TypeTree)(given ctx: Context): TypeCaseDef = + def apply(pattern: TypeTree, rhs: TypeTree)(using ctx: Context): TypeCaseDef = internal.TypeCaseDef_module_apply(pattern, rhs) - def copy(original: Tree)(pattern: TypeTree, rhs: TypeTree)(given ctx: Context): TypeCaseDef = + def copy(original: Tree)(pattern: TypeTree, rhs: TypeTree)(using ctx: Context): TypeCaseDef = internal.TypeCaseDef_module_copy(original)(pattern, rhs) - def unapply(tree: TypeCaseDef)(given ctx: Context): Option[(TypeTree, TypeTree)] = + def unapply(tree: TypeCaseDef)(using ctx: Context): Option[(TypeTree, TypeTree)] = Some((tree.pattern, tree.rhs)) } // ----- Patterns ------------------------------------------------ - given (given Context): IsInstanceOf[Bind] = internal.isInstanceOfBind + given (using ctx: Context): IsInstanceOf[Bind] = internal.isInstanceOfBind object Bind { - // TODO def apply(name: String, pattern: Tree)(given ctx: Context): Bind - def copy(original: Tree)(name: String, pattern: Tree)(given ctx: Context): Bind = + // TODO def apply(name: String, pattern: Tree)(using ctx: Context): Bind + def copy(original: Tree)(name: String, pattern: Tree)(using ctx: Context): Bind = internal.Tree_Bind_module_copy(original)(name, pattern) - def unapply(pattern: Bind)(given ctx: Context): Option[(String, Tree)] = + def unapply(pattern: Bind)(using ctx: Context): Option[(String, Tree)] = Some((pattern.name, pattern.pattern)) } extension BindOps on (bind: Bind) { - def name(given ctx: Context): String = internal.Tree_Bind_name(bind) - def pattern(given ctx: Context): Tree = internal.Tree_Bind_pattern(bind) + def name(using ctx: Context): String = internal.Tree_Bind_name(bind) + def pattern(using ctx: Context): Tree = internal.Tree_Bind_pattern(bind) } - given (given Context): IsInstanceOf[Unapply] = internal.isInstanceOfUnapply + given (using ctx: Context): IsInstanceOf[Unapply] = internal.isInstanceOfUnapply object Unapply { - // TODO def apply(fun: Term, implicits: List[Term], patterns: List[Tree])(given ctx: Context): Unapply - def copy(original: Tree)(fun: Term, implicits: List[Term], patterns: List[Tree])(given ctx: Context): Unapply = + // TODO def apply(fun: Term, implicits: List[Term], patterns: List[Tree])(using ctx: Context): Unapply + def copy(original: Tree)(fun: Term, implicits: List[Term], patterns: List[Tree])(using ctx: Context): Unapply = internal.Tree_Unapply_module_copy(original)(fun, implicits, patterns) - def unapply(x: Unapply)(given ctx: Context): Option[(Term, List[Term], List[Tree])] = + def unapply(x: Unapply)(using ctx: Context): Option[(Term, List[Term], List[Tree])] = Some((x.fun, x.implicits, x.patterns)) } extension UnapplyOps on (unapply: Unapply) { - def fun(given ctx: Context): Term = internal.Tree_Unapply_fun(unapply) - def implicits(given ctx: Context): List[Term] = internal.Tree_Unapply_implicits(unapply) - def patterns(given ctx: Context): List[Tree] = internal.Tree_Unapply_patterns(unapply) + def fun(using ctx: Context): Term = internal.Tree_Unapply_fun(unapply) + def implicits(using ctx: Context): List[Term] = internal.Tree_Unapply_implicits(unapply) + def patterns(using ctx: Context): List[Tree] = internal.Tree_Unapply_patterns(unapply) } - given (given Context): IsInstanceOf[Alternatives] = internal.isInstanceOfAlternatives + given (using ctx: Context): IsInstanceOf[Alternatives] = internal.isInstanceOfAlternatives object Alternatives { - def apply(patterns: List[Tree])(given ctx: Context): Alternatives = + def apply(patterns: List[Tree])(using ctx: Context): Alternatives = internal.Tree_Alternatives_module_apply(patterns) - def copy(original: Tree)(patterns: List[Tree])(given ctx: Context): Alternatives = + def copy(original: Tree)(patterns: List[Tree])(using ctx: Context): Alternatives = internal.Tree_Alternatives_module_copy(original)(patterns) - def unapply(x: Alternatives)(given ctx: Context): Option[List[Tree]] = + def unapply(x: Alternatives)(using ctx: Context): Option[List[Tree]] = Some(x.patterns) } extension AlternativesOps on (alternatives: Alternatives) { - def patterns(given ctx: Context): List[Tree] = internal.Tree_Alternatives_patterns(alternatives) + def patterns(using ctx: Context): List[Tree] = internal.Tree_Alternatives_patterns(alternatives) } @@ -1555,37 +1554,37 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => ///////////////////// extension simpleSelectorOps on (self: SimpleSelector) { - def selection(given ctx: Context): Id = + def selection(using ctx: Context): Id = internal.SimpleSelector_selection(self) } - given (given Context): IsInstanceOf[SimpleSelector] = internal.isInstanceOfSimpleSelector + given (using ctx: Context): IsInstanceOf[SimpleSelector] = internal.isInstanceOfSimpleSelector object SimpleSelector - def unapply(x: SimpleSelector)(given ctx: Context): Option[Id] = Some(x.selection) + def unapply(x: SimpleSelector)(using ctx: Context): Option[Id] = Some(x.selection) extension renameSelectorOps on (self: RenameSelector) { - def from(given ctx: Context): Id = + def from(using ctx: Context): Id = internal.RenameSelector_from(self) - def to(given ctx: Context): Id = + def to(using ctx: Context): Id = internal.RenameSelector_to(self) } - given (given Context): IsInstanceOf[RenameSelector] = internal.isInstanceOfRenameSelector + given (using ctx: Context): IsInstanceOf[RenameSelector] = internal.isInstanceOfRenameSelector object RenameSelector - def unapply(x: RenameSelector)(given ctx: Context): Option[(Id, Id)] = Some((x.from, x.to)) + def unapply(x: RenameSelector)(using ctx: Context): Option[(Id, Id)] = Some((x.from, x.to)) extension omitSelectorOps on (self: OmitSelector) { - def omitted(given ctx: Context): Id = + def omitted(using ctx: Context): Id = internal.SimpleSelector_omitted(self) } - given (given Context): IsInstanceOf[OmitSelector] = internal.isInstanceOfOmitSelector + given (using ctx: Context): IsInstanceOf[OmitSelector] = internal.isInstanceOfOmitSelector object OmitSelector - def unapply(x: OmitSelector)(given ctx: Context): Option[Id] = Some(x.omitted) + def unapply(x: OmitSelector)(using ctx: Context): Option[Id] = Some(x.omitted) /////////////// @@ -1593,20 +1592,20 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => /////////////// /** Returns the type (Type) of T */ - def typeOf[T](given qtype: scala.quoted.Type[T], ctx: Context): Type = qtype.unseal.tpe + def typeOf[T](using qtype: scala.quoted.Type[T], ctx: Context): Type = qtype.unseal.tpe /** Members of `TypeOrBounds` */ extension TypeOrBoundsOps on (tpe: TypeOrBounds) { /** Shows the tree as extractors */ - def showExtractors(given ctx: Context): String = + def showExtractors(using ctx: Context): String = new ExtractorsPrinter[self.type](self).showTypeOrBounds(tpe) /** Shows the tree as fully typed source code */ - def show(given ctx: Context): String = + def show(using ctx: Context): String = tpe.showWith(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String = + def showWith(syntaxHighlight: SyntaxHighlight)(using ctx: Context): String = new SourceCodePrinter[self.type](self)(syntaxHighlight).showTypeOrBounds(tpe) } @@ -1617,10 +1616,10 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => /** Is `self` type the same as `that` type? * This is the case iff `self <:< that` and `that <:< self`. */ - def =:=(that: Type)(given ctx: Context): Boolean = internal.Type_isTypeEq(self)(that) + def =:=(that: Type)(using ctx: Context): Boolean = internal.Type_isTypeEq(self)(that) /** Is this type a subtype of that type? */ - def <:<(that: Type)(given ctx: Context): Boolean = internal.Type_isSubType(self)(that) + def <:<(that: Type)(using ctx: Context): Boolean = internal.Type_isSubType(self)(that) /** Widen from singleton type to its underlying non-singleton * base type by applying one or more `underlying` dereferences, @@ -1631,32 +1630,32 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * def o: Outer * .widen = o.C */ - def widen(given ctx: Context): Type = internal.Type_widen(self) + def widen(using ctx: Context): Type = internal.Type_widen(self) /** Widen from TermRef to its underlying non-termref * base type, while also skipping `=>T` types. */ - def widenTermRefExpr(given ctx: Context): Type = internal.Type_widenTermRefExpr(self) + def widenTermRefExpr(using ctx: Context): Type = internal.Type_widenTermRefExpr(self) /** Follow aliases and dereferences LazyRefs, annotated types and instantiated * TypeVars until type is no longer alias type, annotated type, LazyRef, * or instantiated type variable. */ - def dealias(given ctx: Context): Type = internal.Type_dealias(self) + def dealias(using ctx: Context): Type = internal.Type_dealias(self) /** A simplified version of this type which is equivalent wrt =:= to this type. * Reduces typerefs, applied match types, and and or types. */ - def simplified(given ctx: Context): Type = internal.Type_simplified(self) + def simplified(using ctx: Context): Type = internal.Type_simplified(self) - def classSymbol(given ctx: Context): Option[Symbol] = internal.Type_classSymbol(self) - def typeSymbol(given ctx: Context): Symbol = internal.Type_typeSymbol(self) - def termSymbol(given ctx: Context): Symbol = internal.Type_termSymbol(self) - def isSingleton(given ctx: Context): Boolean = internal.Type_isSingleton(self) - def memberType(member: Symbol)(given ctx: Context): Type = internal.Type_memberType(self)(member) + def classSymbol(using ctx: Context): Option[Symbol] = internal.Type_classSymbol(self) + def typeSymbol(using ctx: Context): Symbol = internal.Type_typeSymbol(self) + def termSymbol(using ctx: Context): Symbol = internal.Type_termSymbol(self) + def isSingleton(using ctx: Context): Boolean = internal.Type_isSingleton(self) + def memberType(member: Symbol)(using ctx: Context): Type = internal.Type_memberType(self)(member) /** Is this type an instance of a non-bottom subclass of the given class `cls`? */ - def derivesFrom(cls: Symbol)(given ctx: Context): Boolean = + def derivesFrom(cls: Symbol)(using ctx: Context): Boolean = internal.Type_derivesFrom(self)(cls) /** Is this type a function type? @@ -1668,226 +1667,226 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * - returns true for `given Int => Int` and `erased Int => Int` * - returns false for `List[Int]`, despite that `List[Int] <:< Int => Int`. */ - def isFunctionType(given ctx: Context): Boolean = internal.Type_isFunctionType(self) + def isFunctionType(using ctx: Context): Boolean = internal.Type_isFunctionType(self) /** Is this type an context function type? * * @see `isFunctionType` */ - def isContextFunctionType(given ctx: Context): Boolean = internal.Type_isContextFunctionType(self) + def isContextFunctionType(using ctx: Context): Boolean = internal.Type_isContextFunctionType(self) /** Is this type an erased function type? * * @see `isFunctionType` */ - def isErasedFunctionType(given ctx: Context): Boolean = internal.Type_isErasedFunctionType(self) + def isErasedFunctionType(using ctx: Context): Boolean = internal.Type_isErasedFunctionType(self) /** Is this type a dependent function type? * * @see `isFunctionType` */ - def isDependentFunctionType(given ctx: Context): Boolean = internal.Type_isDependentFunctionType(self) + def isDependentFunctionType(using ctx: Context): Boolean = internal.Type_isDependentFunctionType(self) } - given (given Context): IsInstanceOf[Type] = internal.isInstanceOfType + given (using ctx: Context): IsInstanceOf[Type] = internal.isInstanceOfType object Type { - def apply(clazz: Class[_])(given ctx: Context): Type = + def apply(clazz: Class[_])(using ctx: Context): Type = internal.Type_apply(clazz) } - given (given Context): IsInstanceOf[ConstantType] = internal.isInstanceOfConstantType + given (using ctx: Context): IsInstanceOf[ConstantType] = internal.isInstanceOfConstantType object ConstantType { - def apply(x : Constant)(given ctx: Context): ConstantType = internal.ConstantType_apply(x) - def unapply(x: ConstantType)(given ctx: Context): Option[Constant] = Some(x.constant) + def apply(x : Constant)(using ctx: Context): ConstantType = internal.ConstantType_apply(x) + def unapply(x: ConstantType)(using ctx: Context): Option[Constant] = Some(x.constant) } extension ConstantTypeOps on (self: ConstantType) { - def constant(given ctx: Context): Constant = internal.ConstantType_constant(self) + def constant(using ctx: Context): Constant = internal.ConstantType_constant(self) } - given (given Context): IsInstanceOf[TermRef] = internal.isInstanceOfTermRef + given (using ctx: Context): IsInstanceOf[TermRef] = internal.isInstanceOfTermRef object TermRef { - def apply(qual: TypeOrBounds, name: String)(given ctx: Context): TermRef = + def apply(qual: TypeOrBounds, name: String)(using ctx: Context): TermRef = internal.TermRef_apply(qual, name) - def unapply(x: TermRef)(given ctx: Context): Option[(TypeOrBounds /* Type | NoPrefix */, String)] = + def unapply(x: TermRef)(using ctx: Context): Option[(TypeOrBounds /* Type | NoPrefix */, String)] = Some((x.qualifier, x.name)) } extension TermRefOps on (self: TermRef) { - def qualifier(given ctx: Context): TypeOrBounds /* Type | NoPrefix */ = internal.TermRef_qualifier(self) - def name(given ctx: Context): String = internal.TermRef_name(self) + def qualifier(using ctx: Context): TypeOrBounds /* Type | NoPrefix */ = internal.TermRef_qualifier(self) + def name(using ctx: Context): String = internal.TermRef_name(self) } - given (given Context): IsInstanceOf[TypeRef] = internal.isInstanceOfTypeRef + given (using ctx: Context): IsInstanceOf[TypeRef] = internal.isInstanceOfTypeRef object TypeRef { - def unapply(x: TypeRef)(given ctx: Context): Option[(TypeOrBounds /* Type | NoPrefix */, String)] = + def unapply(x: TypeRef)(using ctx: Context): Option[(TypeOrBounds /* Type | NoPrefix */, String)] = Some((x.qualifier, x.name)) } extension TypeRefOps on (self: TypeRef) { - def qualifier(given ctx: Context): TypeOrBounds /* Type | NoPrefix */ = internal.TypeRef_qualifier(self) - def name(given ctx: Context): String = internal.TypeRef_name(self) - def isOpaqueAlias(given ctx: Context): Boolean = internal.TypeRef_isOpaqueAlias(self) - def translucentSuperType(given ctx: Context): Type = internal.TypeRef_translucentSuperType(self) + def qualifier(using ctx: Context): TypeOrBounds /* Type | NoPrefix */ = internal.TypeRef_qualifier(self) + def name(using ctx: Context): String = internal.TypeRef_name(self) + def isOpaqueAlias(using ctx: Context): Boolean = internal.TypeRef_isOpaqueAlias(self) + def translucentSuperType(using ctx: Context): Type = internal.TypeRef_translucentSuperType(self) } - given (given Context): IsInstanceOf[SuperType] = internal.isInstanceOfSuperType + given (using ctx: Context): IsInstanceOf[SuperType] = internal.isInstanceOfSuperType object SuperType { - def apply(thistpe: Type, supertpe: Type)(given ctx: Context): SuperType = + def apply(thistpe: Type, supertpe: Type)(using ctx: Context): SuperType = internal.SuperType_apply(thistpe, supertpe) - def unapply(x: SuperType)(given ctx: Context): Option[(Type, Type)] = + def unapply(x: SuperType)(using ctx: Context): Option[(Type, Type)] = Some((x.thistpe, x.supertpe)) } extension SuperTypeOps on (self: SuperType) { - def thistpe(given ctx: Context): Type = internal.SuperType_thistpe(self) - def supertpe(given ctx: Context): Type = internal.SuperType_supertpe(self) + def thistpe(using ctx: Context): Type = internal.SuperType_thistpe(self) + def supertpe(using ctx: Context): Type = internal.SuperType_supertpe(self) } - given (given Context): IsInstanceOf[Refinement] = internal.isInstanceOfRefinement + given (using ctx: Context): IsInstanceOf[Refinement] = internal.isInstanceOfRefinement object Refinement { - def apply(parent: Type, name: String, info: TypeOrBounds /* Type | TypeBounds */)(given ctx: Context): Refinement = + def apply(parent: Type, name: String, info: TypeOrBounds /* Type | TypeBounds */)(using ctx: Context): Refinement = internal.Refinement_apply(parent, name, info) - def unapply(x: Refinement)(given ctx: Context): Option[(Type, String, TypeOrBounds /* Type | TypeBounds */)] = + def unapply(x: Refinement)(using ctx: Context): Option[(Type, String, TypeOrBounds /* Type | TypeBounds */)] = Some((x.parent, x.name, x.info)) } extension RefinementOps on (self: Refinement) { - def parent(given ctx: Context): Type = internal.Refinement_parent(self) - def name(given ctx: Context): String = internal.Refinement_name(self) - def info(given ctx: Context): TypeOrBounds = internal.Refinement_info(self) + def parent(using ctx: Context): Type = internal.Refinement_parent(self) + def name(using ctx: Context): String = internal.Refinement_name(self) + def info(using ctx: Context): TypeOrBounds = internal.Refinement_info(self) } - given (given Context): IsInstanceOf[AppliedType] = internal.isInstanceOfAppliedType + given (using ctx: Context): IsInstanceOf[AppliedType] = internal.isInstanceOfAppliedType object AppliedType { - def apply(tycon: Type, args: List[TypeOrBounds])(given ctx: Context): AppliedType = + def apply(tycon: Type, args: List[TypeOrBounds])(using ctx: Context): AppliedType = internal.AppliedType_apply(tycon, args) - def unapply(x: AppliedType)(given ctx: Context): Option[(Type, List[TypeOrBounds /* Type | TypeBounds */])] = + def unapply(x: AppliedType)(using ctx: Context): Option[(Type, List[TypeOrBounds /* Type | TypeBounds */])] = Some((x.tycon, x.args)) } extension AppliedTypeOps on (self: AppliedType) { - def tycon(given ctx: Context): Type = internal.AppliedType_tycon(self) - def args(given ctx: Context): List[TypeOrBounds /* Type | TypeBounds */] = internal.AppliedType_args(self) + def tycon(using ctx: Context): Type = internal.AppliedType_tycon(self) + def args(using ctx: Context): List[TypeOrBounds /* Type | TypeBounds */] = internal.AppliedType_args(self) } - given (given Context): IsInstanceOf[AnnotatedType] = internal.isInstanceOfAnnotatedType + given (using ctx: Context): IsInstanceOf[AnnotatedType] = internal.isInstanceOfAnnotatedType object AnnotatedType { - def apply(underlying: Type, annot: Term)(given ctx: Context): AnnotatedType = + def apply(underlying: Type, annot: Term)(using ctx: Context): AnnotatedType = internal.AnnotatedType_apply(underlying, annot) - def unapply(x: AnnotatedType)(given ctx: Context): Option[(Type, Term)] = + def unapply(x: AnnotatedType)(using ctx: Context): Option[(Type, Term)] = Some((x.underlying, x.annot)) } extension AnnotatedTypeOps on (self: AnnotatedType) { - def underlying(given ctx: Context): Type = internal.AnnotatedType_underlying(self) - def annot(given ctx: Context): Term = internal.AnnotatedType_annot(self) + def underlying(using ctx: Context): Type = internal.AnnotatedType_underlying(self) + def annot(using ctx: Context): Term = internal.AnnotatedType_annot(self) } - given (given Context): IsInstanceOf[AndType] = internal.isInstanceOfAndType + given (using ctx: Context): IsInstanceOf[AndType] = internal.isInstanceOfAndType object AndType { - def apply(lhs: Type, rhs: Type)(given ctx: Context): AndType = + def apply(lhs: Type, rhs: Type)(using ctx: Context): AndType = internal.AndType_apply(lhs, rhs) - def unapply(x: AndType)(given ctx: Context): Option[(Type, Type)] = + def unapply(x: AndType)(using ctx: Context): Option[(Type, Type)] = Some((x.left, x.right)) } extension AndTypeOps on (self: AndType) { - def left(given ctx: Context): Type = internal.AndType_left(self) - def right(given ctx: Context): Type = internal.AndType_right(self) + def left(using ctx: Context): Type = internal.AndType_left(self) + def right(using ctx: Context): Type = internal.AndType_right(self) } - given (given Context): IsInstanceOf[OrType] = internal.isInstanceOfOrType + given (using ctx: Context): IsInstanceOf[OrType] = internal.isInstanceOfOrType object OrType { - def apply(lhs: Type, rhs: Type)(given ctx: Context): OrType = internal.OrType_apply(lhs, rhs) - def unapply(x: OrType)(given ctx: Context): Option[(Type, Type)] = + def apply(lhs: Type, rhs: Type)(using ctx: Context): OrType = internal.OrType_apply(lhs, rhs) + def unapply(x: OrType)(using ctx: Context): Option[(Type, Type)] = Some((x.left, x.right)) } extension OrTypeOps on (self: OrType) { - def left(given ctx: Context): Type = internal.OrType_left(self) - def right(given ctx: Context): Type = internal.OrType_right(self) + def left(using ctx: Context): Type = internal.OrType_left(self) + def right(using ctx: Context): Type = internal.OrType_right(self) } - given (given Context): IsInstanceOf[MatchType] = internal.isInstanceOfMatchType + given (using ctx: Context): IsInstanceOf[MatchType] = internal.isInstanceOfMatchType object MatchType { - def apply(bound: Type, scrutinee: Type, cases: List[Type])(given ctx: Context): MatchType = + def apply(bound: Type, scrutinee: Type, cases: List[Type])(using ctx: Context): MatchType = internal.MatchType_apply(bound, scrutinee, cases) - def unapply(x: MatchType)(given ctx: Context): Option[(Type, Type, List[Type])] = + def unapply(x: MatchType)(using ctx: Context): Option[(Type, Type, List[Type])] = Some((x.bound, x.scrutinee, x.cases)) } extension MatchTypeOps on (self: MatchType) { - def bound(given ctx: Context): Type = internal.MatchType_bound(self) - def scrutinee(given ctx: Context): Type = internal.MatchType_scrutinee(self) - def cases(given ctx: Context): List[Type] = internal.MatchType_cases(self) + def bound(using ctx: Context): Type = internal.MatchType_bound(self) + def scrutinee(using ctx: Context): Type = internal.MatchType_scrutinee(self) + def cases(using ctx: Context): List[Type] = internal.MatchType_cases(self) } /** * An accessor for `scala.internal.MatchCase[_,_]`, the representation of a `MatchType` case. */ - def MatchCaseType(given Context): Type = { + def MatchCaseType(using ctx: Context): Type = { import scala.internal.MatchCase Type(classOf[MatchCase[_,_]]) } - given (given Context): IsInstanceOf[ByNameType] = internal.isInstanceOfByNameType + given (using ctx: Context): IsInstanceOf[ByNameType] = internal.isInstanceOfByNameType object ByNameType { - def apply(underlying: Type)(given ctx: Context): Type = internal.ByNameType_apply(underlying) - def unapply(x: ByNameType)(given ctx: Context): Option[Type] = Some(x.underlying) + def apply(underlying: Type)(using ctx: Context): Type = internal.ByNameType_apply(underlying) + def unapply(x: ByNameType)(using ctx: Context): Option[Type] = Some(x.underlying) } extension ByNameTypeOps on (self: ByNameType) { - def underlying(given ctx: Context): Type = internal.ByNameType_underlying(self) + def underlying(using ctx: Context): Type = internal.ByNameType_underlying(self) } - given (given Context): IsInstanceOf[ParamRef] = internal.isInstanceOfParamRef + given (using ctx: Context): IsInstanceOf[ParamRef] = internal.isInstanceOfParamRef object ParamRef { - def unapply(x: ParamRef)(given ctx: Context): Option[(LambdaType[TypeOrBounds], Int)] = + def unapply(x: ParamRef)(using ctx: Context): Option[(LambdaType[TypeOrBounds], Int)] = Some((x.binder, x.paramNum)) } extension ParamRefOps on (self: ParamRef) { - def binder(given ctx: Context): LambdaType[TypeOrBounds] = internal.ParamRef_binder(self) - def paramNum(given ctx: Context): Int = internal.ParamRef_paramNum(self) + def binder(using ctx: Context): LambdaType[TypeOrBounds] = internal.ParamRef_binder(self) + def paramNum(using ctx: Context): Int = internal.ParamRef_paramNum(self) } - given (given Context): IsInstanceOf[ThisType] = internal.isInstanceOfThisType + given (using ctx: Context): IsInstanceOf[ThisType] = internal.isInstanceOfThisType object ThisType { - def unapply(x: ThisType)(given ctx: Context): Option[Type] = Some(x.tref) + def unapply(x: ThisType)(using ctx: Context): Option[Type] = Some(x.tref) } extension ThisTypeOps on (self: ThisType) { - def tref(given ctx: Context): Type = internal.ThisType_tref(self) + def tref(using ctx: Context): Type = internal.ThisType_tref(self) } - given (given Context): IsInstanceOf[RecursiveThis] = internal.isInstanceOfRecursiveThis + given (using ctx: Context): IsInstanceOf[RecursiveThis] = internal.isInstanceOfRecursiveThis object RecursiveThis { - def unapply(x: RecursiveThis)(given ctx: Context): Option[RecursiveType] = Some(x.binder) + def unapply(x: RecursiveThis)(using ctx: Context): Option[RecursiveType] = Some(x.binder) } extension RecursiveThisOps on (self: RecursiveThis) { - def binder(given ctx: Context): RecursiveType = internal.RecursiveThis_binder(self) + def binder(using ctx: Context): RecursiveType = internal.RecursiveThis_binder(self) } - given (given Context): IsInstanceOf[RecursiveType] = internal.isInstanceOfRecursiveType + given (using ctx: Context): IsInstanceOf[RecursiveType] = internal.isInstanceOfRecursiveType object RecursiveType { @@ -1899,90 +1898,90 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * `type T`. This avoids infinite recursions later when we * try to follow these references. */ - def apply(parentExp: RecursiveType => Type)(given ctx: Context): RecursiveType = + def apply(parentExp: RecursiveType => Type)(using ctx: Context): RecursiveType = internal.RecursiveType_apply(parentExp) - def unapply(x: RecursiveType)(given ctx: Context): Option[Type] = Some(x.underlying) + def unapply(x: RecursiveType)(using ctx: Context): Option[Type] = Some(x.underlying) } extension RecursiveTypeOps on (self: RecursiveType) { - def underlying(given ctx: Context): Type = internal.RecursiveType_underlying(self) - def recThis(given Context): RecursiveThis = internal.RecursiveThis_recThis(self) + def underlying(using ctx: Context): Type = internal.RecursiveType_underlying(self) + def recThis(using ctx: Context): RecursiveThis = internal.RecursiveThis_recThis(self) } - given (given Context): IsInstanceOf[MethodType] = internal.isInstanceOfMethodType + given (using ctx: Context): IsInstanceOf[MethodType] = internal.isInstanceOfMethodType object MethodType { def apply(paramNames: List[String])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type): MethodType = internal.MethodType_apply(paramNames)(paramInfosExp, resultTypeExp) - def unapply(x: MethodType)(given ctx: Context): Option[(List[String], List[Type], Type)] = + def unapply(x: MethodType)(using ctx: Context): Option[(List[String], List[Type], Type)] = Some((x.paramNames, x.paramTypes, x.resType)) } extension MethodTypeOps on (self: MethodType) { def isImplicit: Boolean = internal.MethodType_isImplicit(self) def isErased: Boolean = internal.MethodType_isErased(self) - def param(idx: Int)(given ctx: Context): Type = internal.MethodType_param(self, idx) - def paramNames(given ctx: Context): List[String] = internal.MethodType_paramNames(self) - def paramTypes(given ctx: Context): List[Type] = internal.MethodType_paramTypes(self) - def resType(given ctx: Context): Type = internal.MethodType_resType(self) + def param(idx: Int)(using ctx: Context): Type = internal.MethodType_param(self, idx) + def paramNames(using ctx: Context): List[String] = internal.MethodType_paramNames(self) + def paramTypes(using ctx: Context): List[Type] = internal.MethodType_paramTypes(self) + def resType(using ctx: Context): Type = internal.MethodType_resType(self) } - given (given Context): IsInstanceOf[PolyType] = internal.isInstanceOfPolyType + given (using ctx: Context): IsInstanceOf[PolyType] = internal.isInstanceOfPolyType object PolyType { - def apply(paramNames: List[String])(paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)(given ctx: Context): PolyType = + def apply(paramNames: List[String])(paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)(using ctx: Context): PolyType = internal.PolyType_apply(paramNames)(paramBoundsExp, resultTypeExp) - def unapply(x: PolyType)(given ctx: Context): Option[(List[String], List[TypeBounds], Type)] = + def unapply(x: PolyType)(using ctx: Context): Option[(List[String], List[TypeBounds], Type)] = Some((x.paramNames, x.paramBounds, x.resType)) } extension PolyTypeOps on (self: PolyType) { - def param(idx: Int)(given ctx: Context): Type = internal.PolyType_param(self, idx) - def paramNames(given ctx: Context): List[String] = internal.PolyType_paramNames(self) - def paramBounds(given ctx: Context): List[TypeBounds] = internal.PolyType_paramBounds(self) - def resType(given ctx: Context): Type = internal.PolyType_resType(self) + def param(idx: Int)(using ctx: Context): Type = internal.PolyType_param(self, idx) + def paramNames(using ctx: Context): List[String] = internal.PolyType_paramNames(self) + def paramBounds(using ctx: Context): List[TypeBounds] = internal.PolyType_paramBounds(self) + def resType(using ctx: Context): Type = internal.PolyType_resType(self) } - given (given Context): IsInstanceOf[TypeLambda] = internal.isInstanceOfTypeLambda + given (using ctx: Context): IsInstanceOf[TypeLambda] = internal.isInstanceOfTypeLambda object TypeLambda { def apply(paramNames: List[String], boundsFn: TypeLambda => List[TypeBounds], bodyFn: TypeLambda => Type): TypeLambda = internal.TypeLambda_apply(paramNames, boundsFn, bodyFn) - def unapply(x: TypeLambda)(given ctx: Context): Option[(List[String], List[TypeBounds], Type)] = + def unapply(x: TypeLambda)(using ctx: Context): Option[(List[String], List[TypeBounds], Type)] = Some((x.paramNames, x.paramBounds, x.resType)) } extension TypeLambdaOps on (self: TypeLambda) { - def paramNames(given ctx: Context): List[String] = internal.TypeLambda_paramNames(self) - def paramBounds(given ctx: Context): List[TypeBounds] = internal.TypeLambda_paramBounds(self) - def param(idx: Int)(given ctx: Context) : Type = internal.TypeLambda_param(self, idx) - def resType(given ctx: Context): Type = internal.TypeLambda_resType(self) + def paramNames(using ctx: Context): List[String] = internal.TypeLambda_paramNames(self) + def paramBounds(using ctx: Context): List[TypeBounds] = internal.TypeLambda_paramBounds(self) + def param(idx: Int)(using ctx: Context) : Type = internal.TypeLambda_param(self, idx) + def resType(using ctx: Context): Type = internal.TypeLambda_resType(self) } // ----- TypeBounds ----------------------------------------------- - given (given Context): IsInstanceOf[TypeBounds] = internal.isInstanceOfTypeBounds + given (using ctx: Context): IsInstanceOf[TypeBounds] = internal.isInstanceOfTypeBounds object TypeBounds { - def apply(low: Type, hi: Type)(given ctx: Context): TypeBounds = + def apply(low: Type, hi: Type)(using ctx: Context): TypeBounds = internal.TypeBounds_apply(low, hi) - def unapply(x: TypeBounds)(given ctx: Context): Option[(Type, Type)] = Some((x.low, x.hi)) + def unapply(x: TypeBounds)(using ctx: Context): Option[(Type, Type)] = Some((x.low, x.hi)) } extension TypeBoundsOps on (self: TypeBounds) { - def low(given ctx: Context): Type = internal.TypeBounds_low(self) - def hi(given ctx: Context): Type = internal.TypeBounds_hi(self) + def low(using ctx: Context): Type = internal.TypeBounds_low(self) + def hi(using ctx: Context): Type = internal.TypeBounds_hi(self) } // ----- NoPrefix ------------------------------------------------- - given (given Context): IsInstanceOf[NoPrefix] = internal.isInstanceOfNoPrefix + given (using ctx: Context): IsInstanceOf[NoPrefix] = internal.isInstanceOfNoPrefix object NoPrefix - def unapply(x: NoPrefix)(given ctx: Context): Boolean = true + def unapply(x: NoPrefix)(using ctx: Context): Boolean = true /////////////// @@ -1996,15 +1995,15 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => def value: Any = internal.Constant_value(const) /** Shows the tree as extractors */ - def showExtractors(given ctx: Context): String = + def showExtractors(using ctx: Context): String = new ExtractorsPrinter[self.type](self).showConstant(const) /** Shows the tree as fully typed source code */ - def show(given ctx: Context): String = + def show(using ctx: Context): String = const.showWith(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String = + def showWith(syntaxHighlight: SyntaxHighlight)(using ctx: Context): String = new SourceCodePrinter[self.type](self)(syntaxHighlight).showConstant(const) } @@ -2020,7 +2019,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => /** Module of ClassTag literals */ object ClassTag { /** scala.reflect.ClassTag literal */ - def apply[T](given x: Type): Constant = + def apply[T](using x: Type): Constant = internal.Constant_ClassTag_apply(x) /** Extractor for ClassTag literals */ @@ -2037,15 +2036,15 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => extension IdOps on (id: Id) { /** Position in the source code */ - def pos(given ctx: Context): Position = internal.Id_pos(id) + def pos(using ctx: Context): Position = internal.Id_pos(id) /** Name of the identifier */ - def name(given ctx: Context): String = internal.Id_name(id) + def name(using ctx: Context): String = internal.Id_name(id) } object Id { - def unapply(id: Id)(given ctx: Context): Option[String] = Some(id.name) + def unapply(id: Id)(using ctx: Context): Option[String] = Some(id.name) } @@ -2053,26 +2052,26 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => // IMPLICIT SEARCH // ///////////////////// - def searchImplicit(tpe: Type)(given ctx: Context): ImplicitSearchResult = + def searchImplicit(tpe: Type)(using ctx: Context): ImplicitSearchResult = internal.searchImplicit(tpe) - given (given Context): IsInstanceOf[ImplicitSearchSuccess] = internal.isInstanceOfImplicitSearchSuccess + given (using ctx: Context): IsInstanceOf[ImplicitSearchSuccess] = internal.isInstanceOfImplicitSearchSuccess extension successOps on (self: ImplicitSearchSuccess) { - def tree(given ctx: Context): Term = internal.ImplicitSearchSuccess_tree(self) + def tree(using ctx: Context): Term = internal.ImplicitSearchSuccess_tree(self) } - given (given Context): IsInstanceOf[ImplicitSearchFailure] = internal.isInstanceOfImplicitSearchFailure + given (using ctx: Context): IsInstanceOf[ImplicitSearchFailure] = internal.isInstanceOfImplicitSearchFailure extension failureOps on (self: ImplicitSearchFailure) { - def explanation(given ctx: Context): String = internal.ImplicitSearchFailure_explanation(self) + def explanation(using ctx: Context): String = internal.ImplicitSearchFailure_explanation(self) } - given (given Context): IsInstanceOf[DivergingImplicit] = internal.isInstanceOfDivergingImplicit + given (using ctx: Context): IsInstanceOf[DivergingImplicit] = internal.isInstanceOfDivergingImplicit - given (given Context): IsInstanceOf[NoMatchingImplicits] = internal.isInstanceOfNoMatchingImplicits + given (using ctx: Context): IsInstanceOf[NoMatchingImplicits] = internal.isInstanceOfNoMatchingImplicits - given (given Context): IsInstanceOf[AmbiguousImplicits] = internal.isInstanceOfAmbiguousImplicits + given (using ctx: Context): IsInstanceOf[AmbiguousImplicits] = internal.isInstanceOfAmbiguousImplicits ///////////// @@ -2081,7 +2080,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => object Symbol { /** The class Symbol of a global class definition */ - def classSymbol(fullName: String)(given ctx: Context): Symbol = + def classSymbol(fullName: String)(using ctx: Context): Symbol = internal.Symbol_of(fullName) /** Generates a new method symbol with the given parent, name and type. @@ -2093,7 +2092,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * @note As a macro can only splice code into the point at which it is expanded, all generated symbols must be * direct or indirect children of the reflection context's owner. */ - def newMethod(parent: Symbol, name: String, tpe: Type)(given ctx: Context): Symbol = + def newMethod(parent: Symbol, name: String, tpe: Type)(using ctx: Context): Symbol = newMethod(parent, name, tpe, Flags.EmptyFlags, noSymbol) /** Works as the other newMethod, but with additional parameters. @@ -2101,11 +2100,11 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * @param flags extra flags to with which the symbol should be constructed * @param privateWithin the symbol within which this new method symbol should be private. May be noSymbol. */ - def newMethod(parent: Symbol, name: String, tpe: Type, flags: Flags, privateWithin: Symbol)(given ctx: Context): Symbol = + def newMethod(parent: Symbol, name: String, tpe: Type, flags: Flags, privateWithin: Symbol)(using ctx: Context): Symbol = internal.Symbol_newMethod(parent, name, flags, tpe, privateWithin) /** Definition not available */ - def noSymbol(given ctx: Context): Symbol = + def noSymbol(using ctx: Context): Symbol = internal.Symbol_noSymbol } @@ -2113,33 +2112,33 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => extension SymbolOps on (sym: Symbol) { /** Owner of this symbol. The owner is the symbol in which this symbol is defined. Throws if this symbol does not have an owner. */ - def owner(given ctx: Context): Symbol = internal.Symbol_owner(sym) + def owner(using ctx: Context): Symbol = internal.Symbol_owner(sym) /** Owner of this symbol. The owner is the symbol in which this symbol is defined. Returns `NoSymbol` if this symbol does not have an owner. */ - def maybeOwner(given ctx: Context): Symbol = internal.Symbol_maybeOwner(sym) + def maybeOwner(using ctx: Context): Symbol = internal.Symbol_maybeOwner(sym) /** Flags of this symbol */ - def flags(given ctx: Context): Flags = internal.Symbol_flags(sym) + def flags(using ctx: Context): Flags = internal.Symbol_flags(sym) /** This symbol is private within the resulting type */ - def privateWithin(given ctx: Context): Option[Type] = internal.Symbol_privateWithin(sym) + def privateWithin(using ctx: Context): Option[Type] = internal.Symbol_privateWithin(sym) /** This symbol is protected within the resulting type */ - def protectedWithin(given ctx: Context): Option[Type] = internal.Symbol_protectedWithin(sym) + def protectedWithin(using ctx: Context): Option[Type] = internal.Symbol_protectedWithin(sym) /** The name of this symbol */ - def name(given ctx: Context): String = internal.Symbol_name(sym) + def name(using ctx: Context): String = internal.Symbol_name(sym) /** The full name of this symbol up to the root package */ - def fullName(given ctx: Context): String = internal.Symbol_fullName(sym) + def fullName(using ctx: Context): String = internal.Symbol_fullName(sym) /** The position of this symbol */ - def pos(given ctx: Context): Position = internal.Symbol_pos(sym) + def pos(using ctx: Context): Position = internal.Symbol_pos(sym) - def localContext(given ctx: Context): Context = internal.Symbol_localContext(sym) + def localContext(using ctx: Context): Context = internal.Symbol_localContext(sym) /** The comment for this symbol, if any */ - def comment(given ctx: Context): Option[Comment] = internal.Symbol_comment(sym) + def comment(using ctx: Context): Option[Comment] = internal.Symbol_comment(sym) /** Tree of this definition * @@ -2150,109 +2149,109 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => * if this symbol `isDefDef` it will return a `DefDef` * if this symbol `isBind` it will return a `Bind` */ - def tree(given ctx: Context): Tree = + def tree(using ctx: Context): Tree = internal.Symbol_tree(sym) /** Annotations attached to this symbol */ - def annots(given ctx: Context): List[Term] = internal.Symbol_annots(sym) + def annots(using ctx: Context): List[Term] = internal.Symbol_annots(sym) - def isDefinedInCurrentRun(given ctx: Context): Boolean = internal.Symbol_isDefinedInCurrentRun(sym) + def isDefinedInCurrentRun(using ctx: Context): Boolean = internal.Symbol_isDefinedInCurrentRun(sym) - def isLocalDummy(given ctx: Context): Boolean = internal.Symbol_isLocalDummy(sym) - def isRefinementClass(given ctx: Context): Boolean = internal.Symbol_isRefinementClass(sym) - def isAliasType(given ctx: Context): Boolean = internal.Symbol_isAliasType(sym) - def isAnonymousClass(given ctx: Context): Boolean = internal.Symbol_isAnonymousClass(sym) - def isAnonymousFunction(given ctx: Context): Boolean = internal.Symbol_isAnonymousFunction(sym) - def isAbstractType(given ctx: Context): Boolean = internal.Symbol_isAbstractType(sym) - def isClassConstructor(given ctx: Context): Boolean = internal.Symbol_isClassConstructor(sym) + def isLocalDummy(using ctx: Context): Boolean = internal.Symbol_isLocalDummy(sym) + def isRefinementClass(using ctx: Context): Boolean = internal.Symbol_isRefinementClass(sym) + def isAliasType(using ctx: Context): Boolean = internal.Symbol_isAliasType(sym) + def isAnonymousClass(using ctx: Context): Boolean = internal.Symbol_isAnonymousClass(sym) + def isAnonymousFunction(using ctx: Context): Boolean = internal.Symbol_isAnonymousFunction(sym) + def isAbstractType(using ctx: Context): Boolean = internal.Symbol_isAbstractType(sym) + def isClassConstructor(using ctx: Context): Boolean = internal.Symbol_isClassConstructor(sym) /** Is this the definition of a type? */ - def isType(given ctx: Context): Boolean = internal.Symbol_isType(sym) + def isType(using ctx: Context): Boolean = internal.Symbol_isType(sym) /** Is this the definition of a term? */ - def isTerm(given ctx: Context): Boolean = internal.Symbol_isTerm(sym) + def isTerm(using ctx: Context): Boolean = internal.Symbol_isTerm(sym) /** Is this the definition of a PackageDef tree? */ - def isPackageDef(given ctx: Context): Boolean = internal.Symbol_isPackageDef(sym) + def isPackageDef(using ctx: Context): Boolean = internal.Symbol_isPackageDef(sym) /** Is this the definition of a ClassDef tree? */ - def isClassDef(given ctx: Context): Boolean = internal.Symbol_isClassDef(sym) + def isClassDef(using ctx: Context): Boolean = internal.Symbol_isClassDef(sym) /** Is this the definition of a TypeDef tree */ - def isTypeDef(given ctx: Context): Boolean = internal.Symbol_isTypeDef(sym) + def isTypeDef(using ctx: Context): Boolean = internal.Symbol_isTypeDef(sym) /** Is this the definition of a ValDef tree? */ - def isValDef(given ctx: Context): Boolean = internal.Symbol_isValDef(sym) + def isValDef(using ctx: Context): Boolean = internal.Symbol_isValDef(sym) /** Is this the definition of a DefDef tree? */ - def isDefDef(given ctx: Context): Boolean = internal.Symbol_isDefDef(sym) + def isDefDef(using ctx: Context): Boolean = internal.Symbol_isDefDef(sym) /** Is this the definition of a Bind pattern? */ - def isBind(given ctx: Context): Boolean = internal.Symbol_isBind(sym) + def isBind(using ctx: Context): Boolean = internal.Symbol_isBind(sym) /** Does this symbol represent a no definition? */ - def isNoSymbol(given ctx: Context): Boolean = sym == Symbol.noSymbol + def isNoSymbol(using ctx: Context): Boolean = sym == Symbol.noSymbol /** Does this symbol represent a definition? */ - def exists(given ctx: Context): Boolean = sym != Symbol.noSymbol + def exists(using ctx: Context): Boolean = sym != Symbol.noSymbol /** Fields directly declared in the class */ - def fields(given ctx: Context): List[Symbol] = + def fields(using ctx: Context): List[Symbol] = internal.Symbol_fields(sym) /** Field with the given name directly declared in the class */ - def field(name: String)(given ctx: Context): Symbol = + def field(name: String)(using ctx: Context): Symbol = internal.Symbol_field(sym)(name) /** Get non-private named methods defined directly inside the class */ - def classMethod(name: String)(given ctx: Context): List[Symbol] = + def classMethod(name: String)(using ctx: Context): List[Symbol] = internal.Symbol_classMethod(sym)(name) /** Get all non-private methods defined directly inside the class, exluding constructors */ - def classMethods(given ctx: Context): List[Symbol] = + def classMethods(using ctx: Context): List[Symbol] = internal.Symbol_classMethods(sym) /** Get named non-private methods declared or inherited */ - def method(name: String)(given ctx: Context): List[Symbol] = + def method(name: String)(using ctx: Context): List[Symbol] = internal.Symbol_method(sym)(name) /** Get all non-private methods declared or inherited */ - def methods(given ctx: Context): List[Symbol] = + def methods(using ctx: Context): List[Symbol] = internal.Symbol_methods(sym) /** Fields of a case class type -- only the ones declared in primary constructor */ - def caseFields(given ctx: Context): List[Symbol] = + def caseFields(using ctx: Context): List[Symbol] = internal.Symbol_caseFields(sym) - def isTypeParam(given ctx: Context): Boolean = + def isTypeParam(using ctx: Context): Boolean = internal.Symbol_isTypeParam(sym) /** Signature of this definition */ - def signature(given ctx: Context): Signature = + def signature(using ctx: Context): Signature = internal.Symbol_signature(sym) /** The class symbol of the companion module class */ - def moduleClass(given ctx: Context): Symbol = + def moduleClass(using ctx: Context): Symbol = internal.Symbol_moduleClass(sym) /** The symbol of the companion class */ - def companionClass(given ctx: Context): Symbol = + def companionClass(using ctx: Context): Symbol = internal.Symbol_companionClass(sym) /** The symbol of the companion module */ - def companionModule(given ctx: Context): Symbol = + def companionModule(using ctx: Context): Symbol = internal.Symbol_companionModule(sym) /** Shows the tree as extractors */ - def showExtractors(given ctx: Context): String = + def showExtractors(using ctx: Context): String = new ExtractorsPrinter[self.type](self).showSymbol(sym) /** Shows the tree as fully typed source code */ - def show(given ctx: Context): String = + def show(using ctx: Context): String = sym.showWith(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String = + def showWith(syntaxHighlight: SyntaxHighlight)(using ctx: Context): String = new SourceCodePrinter[self.type](self)(syntaxHighlight).showSymbol(sym) } @@ -2264,7 +2263,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => /** The signature of a method */ object Signature { /** Matches the method signature and returns its parameters and result type. */ - def unapply(sig: Signature)(given ctx: Context): Option[(List[String | Int], String)] = + def unapply(sig: Signature)(using ctx: Context): Option[(List[String | Int], String)] = Some((sig.paramSigs, sig.resultSig)) } @@ -2532,15 +2531,15 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => def &(that: Flags): Flags = internal.Flags_and(flags)(that) /** Shows the tree as extractors */ - def showExtractors(given ctx: Context): String = + def showExtractors(using ctx: Context): String = new ExtractorsPrinter[self.type](self).showFlags(flags) /** Shows the tree as fully typed source code */ - def show(given ctx: Context): String = + def show(using ctx: Context): String = flags.showWith(SyntaxHighlight.plain) /** Shows the tree as fully typed source code */ - def showWith(syntaxHighlight: SyntaxHighlight)(given ctx: Context): String = + def showWith(syntaxHighlight: SyntaxHighlight)(using ctx: Context): String = new SourceCodePrinter[self.type](self)(syntaxHighlight).showFlags(flags) } @@ -2710,19 +2709,19 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => /////////////// /** Emits an error message */ - def error(msg: => String, pos: Position)(given ctx: Context): Unit = + def error(msg: => String, pos: Position)(using ctx: Context): Unit = internal.error(msg, pos) /** Emits an error at a specific range of a file */ - def error(msg: => String, source: SourceFile, start: Int, end: Int)(given ctx: Context): Unit = + def error(msg: => String, source: SourceFile, start: Int, end: Int)(using ctx: Context): Unit = internal.error(msg, source, start, end) /** Emits an error message */ - def warning(msg: => String, pos: Position)(given ctx: Context): Unit = + def warning(msg: => String, pos: Position)(using ctx: Context): Unit = internal.warning(msg, pos) /** Emits a warning at a specific range of a file */ - def warning(msg: => String, source: SourceFile, start: Int, end: Int)(given ctx: Context): Unit = + def warning(msg: => String, source: SourceFile, start: Int, end: Int)(using ctx: Context): Unit = internal.warning(msg, source, start, end) @@ -2766,7 +2765,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => // TODO extract from Reflection /** Bind the `rhs` to a `val` and use it in `body` */ - def let(rhs: Term)(body: Ident => Term)(given ctx: Context): Term = { + def let(rhs: Term)(body: Ident => Term)(using ctx: Context): Term = { import scala.quoted.QuoteContext given QuoteContext = new QuoteContext(this) val expr = (rhs.seal: @unchecked) match { @@ -2783,7 +2782,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self => } /** Bind the given `terms` to names and use them in the `body` */ - def lets(terms: List[Term])(body: List[Term] => Term)(given Context): Term = { + def lets(terms: List[Term])(body: List[Term] => Term)(using ctx: Context): Term = { def rec(xs: List[Term], acc: List[Term]): Term = xs match { case Nil => body(acc) case x :: xs => let(x) { (x: Term) => rec(xs, x :: acc) } diff --git a/library/src/scala/tasty/reflect/CompilerInterface.scala b/library/src/scala/tasty/reflect/CompilerInterface.scala index 9ad8973f2686..b2f08fc65e30 100644 --- a/library/src/scala/tasty/reflect/CompilerInterface.scala +++ b/library/src/scala/tasty/reflect/CompilerInterface.scala @@ -168,16 +168,16 @@ trait CompilerInterface { /////////////// /** Report a compilation error with the given message at the given position */ - def error(msg: => String, pos: Position)(given ctx: Context): Unit + def error(msg: => String, pos: Position)(using ctx: Context): Unit /** Report a compilation error with the given message at the given position range */ - def error(msg: => String, source: SourceFile, start: Int, end: Int)(given ctx: Context): Unit + def error(msg: => String, source: SourceFile, start: Int, end: Int)(using ctx: Context): Unit /** Report a compilation warning with the given message at the given position */ - def warning(msg: => String, pos: Position)(given ctx: Context): Unit + def warning(msg: => String, pos: Position)(using ctx: Context): Unit /** Report a compilation warning with the given message at the given position range */ - def warning(msg: => String, source: SourceFile, start: Int, end: Int)(given ctx: Context): Unit + def warning(msg: => String, source: SourceFile, start: Int, end: Int)(using ctx: Context): Unit ////////////// @@ -197,249 +197,249 @@ trait CompilerInterface { /** Tree representing code written in the source */ type Tree <: AnyRef - def Tree_pos(self: Tree)(given ctx: Context): Position - def Tree_symbol(self: Tree)(given ctx: Context): Symbol + def Tree_pos(self: Tree)(using ctx: Context): Position + def Tree_symbol(self: Tree)(using ctx: Context): Symbol /** Tree representing a pacakage clause in the source code */ type PackageClause <: Tree - def isInstanceOfPackageClause(given ctx: Context): IsInstanceOf[PackageClause] + def isInstanceOfPackageClause(using ctx: Context): IsInstanceOf[PackageClause] - def PackageClause_pid(self: PackageClause)(given ctx: Context): Ref - def PackageClause_stats(self: PackageClause)(given ctx: Context): List[Tree] + def PackageClause_pid(self: PackageClause)(using ctx: Context): Ref + def PackageClause_stats(self: PackageClause)(using ctx: Context): List[Tree] - def PackageClause_apply(pid: Ref, stats: List[Tree])(given ctx: Context): PackageClause + def PackageClause_apply(pid: Ref, stats: List[Tree])(using ctx: Context): PackageClause - def PackageClause_copy(original: Tree)(pid: Ref, stats: List[Tree])(given ctx: Context): PackageClause + def PackageClause_copy(original: Tree)(pid: Ref, stats: List[Tree])(using ctx: Context): PackageClause /** Tree representing a statement in the source code */ type Statement <: Tree - def isInstanceOfStatement(given ctx: Context): IsInstanceOf[Statement] + def isInstanceOfStatement(using ctx: Context): IsInstanceOf[Statement] /** Tree representing an import in the source code */ type Import <: Statement - def isInstanceOfImport(given ctx: Context): IsInstanceOf[Import] + def isInstanceOfImport(using ctx: Context): IsInstanceOf[Import] def Import_implied(self: Import): Boolean - def Import_expr(self: Import)(given ctx: Context): Term - def Import_selectors(self: Import)(given ctx: Context): List[ImportSelector] + def Import_expr(self: Import)(using ctx: Context): Term + def Import_selectors(self: Import)(using ctx: Context): List[ImportSelector] - def Import_apply(iexpr: Term, selectors: List[ImportSelector])(given ctx: Context): Import + def Import_apply(iexpr: Term, selectors: List[ImportSelector])(using ctx: Context): Import - def Import_copy(original: Tree)(expr: Term, selectors: List[ImportSelector])(given ctx: Context): Import + def Import_copy(original: Tree)(expr: Term, selectors: List[ImportSelector])(using ctx: Context): Import /** Tree representing a definition in the source code. It can be `PackageDef`, `ClassDef`, `TypeDef`, `DefDef` or `ValDef` */ type Definition <: Statement - def isInstanceOfDefinition(given ctx: Context): IsInstanceOf[Definition] + def isInstanceOfDefinition(using ctx: Context): IsInstanceOf[Definition] - def Definition_name(self: Definition)(given ctx: Context): String + def Definition_name(self: Definition)(using ctx: Context): String /** Tree representing a package definition. This includes definitions in all source files */ type PackageDef <: Definition - def isInstanceOfPackageDef(given ctx: Context): IsInstanceOf[PackageDef] + def isInstanceOfPackageDef(using ctx: Context): IsInstanceOf[PackageDef] - def PackageDef_owner(self: PackageDef)(given ctx: Context): PackageDef - def PackageDef_members(self: PackageDef)(given ctx: Context): List[Statement] + def PackageDef_owner(self: PackageDef)(using ctx: Context): PackageDef + def PackageDef_members(self: PackageDef)(using ctx: Context): List[Statement] /** Tree representing a class definition. This includes annonymus class definitions and the class of a module object */ type ClassDef <: Definition - def isInstanceOfClassDef(given ctx: Context): IsInstanceOf[ClassDef] + def isInstanceOfClassDef(using ctx: Context): IsInstanceOf[ClassDef] - def ClassDef_constructor(self: ClassDef)(given ctx: Context): DefDef - def ClassDef_parents(self: ClassDef)(given ctx: Context): List[Tree/* Term | TypeTree */] - def ClassDef_derived(self: ClassDef)(given ctx: Context): List[TypeTree] - def ClassDef_self(self: ClassDef)(given ctx: Context): Option[ValDef] - def ClassDef_body(self: ClassDef)(given ctx: Context): List[Statement] + def ClassDef_constructor(self: ClassDef)(using ctx: Context): DefDef + def ClassDef_parents(self: ClassDef)(using ctx: Context): List[Tree/* Term | TypeTree */] + def ClassDef_derived(self: ClassDef)(using ctx: Context): List[TypeTree] + def ClassDef_self(self: ClassDef)(using ctx: Context): Option[ValDef] + def ClassDef_body(self: ClassDef)(using ctx: Context): List[Statement] - def ClassDef_copy(original: Tree)(name: String, constr: DefDef, parents: List[Tree/* Term | TypeTree */], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement])(given ctx: Context): ClassDef + def ClassDef_copy(original: Tree)(name: String, constr: DefDef, parents: List[Tree/* Term | TypeTree */], derived: List[TypeTree], selfOpt: Option[ValDef], body: List[Statement])(using ctx: Context): ClassDef /** Tree representing a type (paramter or member) definition in the source code */ type TypeDef <: Definition - def isInstanceOfTypeDef(given ctx: Context): IsInstanceOf[TypeDef] + def isInstanceOfTypeDef(using ctx: Context): IsInstanceOf[TypeDef] - def TypeDef_rhs(self: TypeDef)(given ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ + def TypeDef_rhs(self: TypeDef)(using ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ - def TypeDef_apply(symbol: Symbol)(given ctx: Context): TypeDef - def TypeDef_copy(original: Tree)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/)(given ctx: Context): TypeDef + def TypeDef_apply(symbol: Symbol)(using ctx: Context): TypeDef + def TypeDef_copy(original: Tree)(name: String, rhs: Tree /*TypeTree | TypeBoundsTree*/)(using ctx: Context): TypeDef /** Tree representing a method definition in the source code */ type DefDef <: Definition - def isInstanceOfDefDef(given ctx: Context): IsInstanceOf[DefDef] + def isInstanceOfDefDef(using ctx: Context): IsInstanceOf[DefDef] - def DefDef_typeParams(self: DefDef)(given ctx: Context): List[TypeDef] - def DefDef_paramss(self: DefDef)(given ctx: Context): List[List[ValDef]] - def DefDef_returnTpt(self: DefDef)(given ctx: Context): TypeTree - def DefDef_rhs(self: DefDef)(given ctx: Context): Option[Term] + def DefDef_typeParams(self: DefDef)(using ctx: Context): List[TypeDef] + def DefDef_paramss(self: DefDef)(using ctx: Context): List[List[ValDef]] + def DefDef_returnTpt(self: DefDef)(using ctx: Context): TypeTree + def DefDef_rhs(self: DefDef)(using ctx: Context): Option[Term] - def DefDef_apply(symbol: Symbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(given ctx: Context): DefDef - def DefDef_copy(original: Tree)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term])(given ctx: Context): DefDef + def DefDef_apply(symbol: Symbol, rhsFn: List[Type] => List[List[Term]] => Option[Term])(using ctx: Context): DefDef + def DefDef_copy(original: Tree)(name: String, typeParams: List[TypeDef], paramss: List[List[ValDef]], tpt: TypeTree, rhs: Option[Term])(using ctx: Context): DefDef /** Tree representing a value definition in the source code This inclues `val`, `lazy val`, `var`, `object` and parameter definitions. */ type ValDef <: Definition - def isInstanceOfValDef(given ctx: Context): IsInstanceOf[ValDef] + def isInstanceOfValDef(using ctx: Context): IsInstanceOf[ValDef] - def ValDef_tpt(self: ValDef)(given ctx: Context): TypeTree - def ValDef_rhs(self: ValDef)(given ctx: Context): Option[Term] + def ValDef_tpt(self: ValDef)(using ctx: Context): TypeTree + def ValDef_rhs(self: ValDef)(using ctx: Context): Option[Term] - def ValDef_apply(symbol: Symbol, rhs: Option[Term])(given ctx: Context): ValDef - def ValDef_copy(original: Tree)(name: String, tpt: TypeTree, rhs: Option[Term])(given ctx: Context): ValDef + def ValDef_apply(symbol: Symbol, rhs: Option[Term])(using ctx: Context): ValDef + def ValDef_copy(original: Tree)(name: String, tpt: TypeTree, rhs: Option[Term])(using ctx: Context): ValDef /** Tree representing an expression in the source code */ type Term <: Statement - def isInstanceOfTerm(given ctx: Context): IsInstanceOf[Term] + def isInstanceOfTerm(using ctx: Context): IsInstanceOf[Term] - def Term_tpe(self: Term)(given ctx: Context): Type - def Term_underlyingArgument(self: Term)(given ctx: Context): Term - def Term_underlying(self: Term)(given ctx: Context): Term - def Term_etaExpand(term: Term): Term + def Term_tpe(self: Term)(using ctx: Context): Type + def Term_underlyingArgument(self: Term)(using ctx: Context): Term + def Term_underlying(self: Term)(using ctx: Context): Term + def Term_etaExpand(term: Term)(using ctx: Context): Term /** Tree representing a reference to definition */ type Ref <: Term - def isInstanceOfRef(given ctx: Context): IsInstanceOf[Ref] + def isInstanceOfRef(using ctx: Context): IsInstanceOf[Ref] - def Ref_apply(sym: Symbol)(given ctx: Context): Ref + def Ref_apply(sym: Symbol)(using ctx: Context): Ref /** Tree representing a reference to definition with a given name */ type Ident <: Ref - def isInstanceOfIdent(given ctx: Context): IsInstanceOf[Ident] + def isInstanceOfIdent(using ctx: Context): IsInstanceOf[Ident] - def Ident_name(self: Ident)(given ctx: Context): String + def Ident_name(self: Ident)(using ctx: Context): String - def Ident_apply(tmref: TermRef)(given ctx: Context): Term - def Ident_copy(original: Tree)(name: String)(given ctx: Context): Ident + def Ident_apply(tmref: TermRef)(using ctx: Context): Term + def Ident_copy(original: Tree)(name: String)(using ctx: Context): Ident /** Tree representing a selection of definition with a given name on a given prefix */ type Select <: Ref - def isInstanceOfSelect(given ctx: Context): IsInstanceOf[Select] + def isInstanceOfSelect(using ctx: Context): IsInstanceOf[Select] - def Select_qualifier(self: Select)(given ctx: Context): Term - def Select_name(self: Select)(given ctx: Context): String - def Select_signature(self: Select)(given ctx: Context): Option[Signature] + def Select_qualifier(self: Select)(using ctx: Context): Term + def Select_name(self: Select)(using ctx: Context): String + def Select_signature(self: Select)(using ctx: Context): Option[Signature] - def Select_apply(qualifier: Term, symbol: Symbol)(given ctx: Context): Select - def Select_unique(qualifier: Term, name: String)(given ctx: Context): Select + def Select_apply(qualifier: Term, symbol: Symbol)(using ctx: Context): Select + def Select_unique(qualifier: Term, name: String)(using ctx: Context): Select // TODO rename, this returns an Apply and not a Select - def Select_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term])(given ctx: Context): Apply - def Select_copy(original: Tree)(qualifier: Term, name: String)(given ctx: Context): Select + def Select_overloaded(qualifier: Term, name: String, targs: List[Type], args: List[Term])(using ctx: Context): Apply + def Select_copy(original: Tree)(qualifier: Term, name: String)(using ctx: Context): Select /** Tree representing a literal value in the source code */ type Literal <: Term - def isInstanceOfLiteral(given ctx: Context): IsInstanceOf[Literal] + def isInstanceOfLiteral(using ctx: Context): IsInstanceOf[Literal] - def Literal_constant(self: Literal)(given ctx: Context): Constant + def Literal_constant(self: Literal)(using ctx: Context): Constant - def Literal_apply(constant: Constant)(given ctx: Context): Literal - def Literal_copy(original: Tree)(constant: Constant)(given ctx: Context): Literal + def Literal_apply(constant: Constant)(using ctx: Context): Literal + def Literal_copy(original: Tree)(constant: Constant)(using ctx: Context): Literal /** Tree representing `this` in the source code */ type This <: Term - def isInstanceOfThis(given ctx: Context): IsInstanceOf[This] + def isInstanceOfThis(using ctx: Context): IsInstanceOf[This] - def This_id(self: This)(given ctx: Context): Option[Id] + def This_id(self: This)(using ctx: Context): Option[Id] - def This_apply(cls: Symbol)(given ctx: Context): This - def This_copy(original: Tree)(qual: Option[Id])(given ctx: Context): This + def This_apply(cls: Symbol)(using ctx: Context): This + def This_copy(original: Tree)(qual: Option[Id])(using ctx: Context): This /** Tree representing `new` in the source code */ type New <: Term - def isInstanceOfNew(given ctx: Context): IsInstanceOf[New] + def isInstanceOfNew(using ctx: Context): IsInstanceOf[New] - def New_tpt(self: New)(given ctx: Context): TypeTree + def New_tpt(self: New)(using ctx: Context): TypeTree - def New_apply(tpt: TypeTree)(given ctx: Context): New - def New_copy(original: Tree)(tpt: TypeTree)(given ctx: Context): New + def New_apply(tpt: TypeTree)(using ctx: Context): New + def New_copy(original: Tree)(tpt: TypeTree)(using ctx: Context): New /** Tree representing an argument passed with an explicit name. Such as `arg1 = x` in `foo(arg1 = x)` */ type NamedArg <: Term - def isInstanceOfNamedArg(given ctx: Context): IsInstanceOf[NamedArg] + def isInstanceOfNamedArg(using ctx: Context): IsInstanceOf[NamedArg] - def NamedArg_name(self: NamedArg)(given ctx: Context): String - def NamedArg_value(self: NamedArg)(given ctx: Context): Term + def NamedArg_name(self: NamedArg)(using ctx: Context): String + def NamedArg_value(self: NamedArg)(using ctx: Context): Term - def NamedArg_apply(name: String, arg: Term)(given ctx: Context): NamedArg - def NamedArg_copy(original: Tree)(name: String, arg: Term)(given ctx: Context): NamedArg + def NamedArg_apply(name: String, arg: Term)(using ctx: Context): NamedArg + def NamedArg_copy(original: Tree)(name: String, arg: Term)(using ctx: Context): NamedArg /** Tree an application of arguments. It represents a single list of arguments, multiple argument lists will have nested `Apply`s */ type Apply <: Term - def isInstanceOfApply(given ctx: Context): IsInstanceOf[Apply] + def isInstanceOfApply(using ctx: Context): IsInstanceOf[Apply] - def Apply_fun(self: Apply)(given ctx: Context): Term - def Apply_args(self: Apply)(given ctx: Context): List[Term] + def Apply_fun(self: Apply)(using ctx: Context): Term + def Apply_args(self: Apply)(using ctx: Context): List[Term] - def Apply_apply(fn: Term, args: List[Term])(given ctx: Context): Apply - def Apply_copy(original: Tree)(fun: Term, args: List[Term])(given ctx: Context): Apply + def Apply_apply(fn: Term, args: List[Term])(using ctx: Context): Apply + def Apply_copy(original: Tree)(fun: Term, args: List[Term])(using ctx: Context): Apply /** Tree an application of type arguments */ type TypeApply <: Term - def isInstanceOfTypeApply(given ctx: Context): IsInstanceOf[TypeApply] + def isInstanceOfTypeApply(using ctx: Context): IsInstanceOf[TypeApply] - def TypeApply_fun(self: TypeApply)(given ctx: Context): Term - def TypeApply_args(self: TypeApply)(given ctx: Context): List[TypeTree] + def TypeApply_fun(self: TypeApply)(using ctx: Context): Term + def TypeApply_args(self: TypeApply)(using ctx: Context): List[TypeTree] - def TypeApply_apply(fn: Term, args: List[TypeTree])(given ctx: Context): TypeApply - def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree])(given ctx: Context): TypeApply + def TypeApply_apply(fn: Term, args: List[TypeTree])(using ctx: Context): TypeApply + def TypeApply_copy(original: Tree)(fun: Term, args: List[TypeTree])(using ctx: Context): TypeApply /** Tree representing `super` in the source code */ type Super <: Term - def isInstanceOfSuper(given ctx: Context): IsInstanceOf[Super] + def isInstanceOfSuper(using ctx: Context): IsInstanceOf[Super] - def Super_qualifier(self: Super)(given ctx: Context): Term - def Super_id(self: Super)(given ctx: Context): Option[Id] + def Super_qualifier(self: Super)(using ctx: Context): Term + def Super_id(self: Super)(using ctx: Context): Option[Id] - def Super_apply(qual: Term, mix: Option[Id])(given ctx: Context): Super - def Super_copy(original: Tree)(qual: Term, mix: Option[Id])(given ctx: Context): Super + def Super_apply(qual: Term, mix: Option[Id])(using ctx: Context): Super + def Super_copy(original: Tree)(qual: Term, mix: Option[Id])(using ctx: Context): Super /** Tree representing a type ascription `x: T` in the source code */ type Typed <: Term - def isInstanceOfTyped(given ctx: Context): IsInstanceOf[Typed] + def isInstanceOfTyped(using ctx: Context): IsInstanceOf[Typed] - def Typed_expr(self: Typed)(given ctx: Context): Term - def Typed_tpt(self: Typed)(given ctx: Context): TypeTree + def Typed_expr(self: Typed)(using ctx: Context): Term + def Typed_tpt(self: Typed)(using ctx: Context): TypeTree - def Typed_apply(expr: Term, tpt: TypeTree)(given ctx: Context): Typed - def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree)(given ctx: Context): Typed + def Typed_apply(expr: Term, tpt: TypeTree)(using ctx: Context): Typed + def Typed_copy(original: Tree)(expr: Term, tpt: TypeTree)(using ctx: Context): Typed /** Tree representing an assignment `x = y` in the source code */ type Assign <: Term - def isInstanceOfAssign(given ctx: Context): IsInstanceOf[Assign] + def isInstanceOfAssign(using ctx: Context): IsInstanceOf[Assign] - def Assign_lhs(self: Assign)(given ctx: Context): Term - def Assign_rhs(self: Assign)(given ctx: Context): Term + def Assign_lhs(self: Assign)(using ctx: Context): Term + def Assign_rhs(self: Assign)(using ctx: Context): Term - def Assign_apply(lhs: Term, rhs: Term)(given ctx: Context): Assign - def Assign_copy(original: Tree)(lhs: Term, rhs: Term)(given ctx: Context): Assign + def Assign_apply(lhs: Term, rhs: Term)(using ctx: Context): Assign + def Assign_copy(original: Tree)(lhs: Term, rhs: Term)(using ctx: Context): Assign /** Tree representing a block `{ ... }` in the source code */ type Block <: Term - def isInstanceOfBlock(given ctx: Context): IsInstanceOf[Block] + def isInstanceOfBlock(using ctx: Context): IsInstanceOf[Block] - def Block_statements(self: Block)(given ctx: Context): List[Statement] - def Block_expr(self: Block)(given ctx: Context): Term + def Block_statements(self: Block)(using ctx: Context): List[Statement] + def Block_expr(self: Block)(using ctx: Context): Term - def Block_apply(stats: List[Statement], expr: Term)(given ctx: Context): Block - def Block_copy(original: Tree)(stats: List[Statement], expr: Term)(given ctx: Context): Block + def Block_apply(stats: List[Statement], expr: Term)(using ctx: Context): Block + def Block_copy(original: Tree)(stats: List[Statement], expr: Term)(using ctx: Context): Block /** A lambda `(...) => ...` in the source code is represented as * a local method and a closure: @@ -452,266 +452,266 @@ trait CompilerInterface { */ type Closure <: Term - def isInstanceOfClosure(given ctx: Context): IsInstanceOf[Closure] + def isInstanceOfClosure(using ctx: Context): IsInstanceOf[Closure] - def Closure_meth(self: Closure)(given ctx: Context): Term - def Closure_tpeOpt(self: Closure)(given ctx: Context): Option[Type] + def Closure_meth(self: Closure)(using ctx: Context): Term + def Closure_tpeOpt(self: Closure)(using ctx: Context): Option[Type] - def Closure_apply(meth: Term, tpe: Option[Type])(given ctx: Context): Closure - def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type])(given ctx: Context): Closure + def Closure_apply(meth: Term, tpe: Option[Type])(using ctx: Context): Closure + def Closure_copy(original: Tree)(meth: Tree, tpe: Option[Type])(using ctx: Context): Closure - def Lambda_apply(tpe: MethodType, rhsFn: List[Tree] => Tree)(given ctx: Context): Block + def Lambda_apply(tpe: MethodType, rhsFn: List[Tree] => Tree)(using ctx: Context): Block /** Tree representing an if/then/else `if (...) ... else ...` in the source code */ type If <: Term - def isInstanceOfIf(given ctx: Context): IsInstanceOf[If] + def isInstanceOfIf(using ctx: Context): IsInstanceOf[If] - def If_cond(self: If)(given ctx: Context): Term - def If_thenp(self: If)(given ctx: Context): Term - def If_elsep(self: If)(given ctx: Context): Term + def If_cond(self: If)(using ctx: Context): Term + def If_thenp(self: If)(using ctx: Context): Term + def If_elsep(self: If)(using ctx: Context): Term - def If_apply(cond: Term, thenp: Term, elsep: Term)(given ctx: Context): If - def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(given ctx: Context): If + def If_apply(cond: Term, thenp: Term, elsep: Term)(using ctx: Context): If + def If_copy(original: Tree)(cond: Term, thenp: Term, elsep: Term)(using ctx: Context): If /** Tree representing a pattern match `x match { ... }` in the source code */ type Match <: Term - def isInstanceOfMatch(given ctx: Context): IsInstanceOf[Match] + def isInstanceOfMatch(using ctx: Context): IsInstanceOf[Match] - def Match_scrutinee(self: Match)(given ctx: Context): Term - def Match_cases(self: Match)(given ctx: Context): List[CaseDef] + def Match_scrutinee(self: Match)(using ctx: Context): Term + def Match_cases(self: Match)(using ctx: Context): List[CaseDef] - def Match_apply(selector: Term, cases: List[CaseDef])(given ctx: Context): Match - def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef])(given ctx: Context): Match + def Match_apply(selector: Term, cases: List[CaseDef])(using ctx: Context): Match + def Match_copy(original: Tree)(selector: Term, cases: List[CaseDef])(using ctx: Context): Match /** Tree representing a pattern match `given match { ... }` in the source code */ type GivenMatch <: Term - def isInstanceOfGivenMatch(given ctx: Context): IsInstanceOf[GivenMatch] + def isInstanceOfGivenMatch(using ctx: Context): IsInstanceOf[GivenMatch] - def GivenMatch_cases(self: GivenMatch)(given ctx: Context): List[CaseDef] + def GivenMatch_cases(self: GivenMatch)(using ctx: Context): List[CaseDef] - def GivenMatch_apply(cases: List[CaseDef])(given ctx: Context): GivenMatch - def GivenMatch_copy(original: Tree)(cases: List[CaseDef])(given ctx: Context): GivenMatch + def GivenMatch_apply(cases: List[CaseDef])(using ctx: Context): GivenMatch + def GivenMatch_copy(original: Tree)(cases: List[CaseDef])(using ctx: Context): GivenMatch /** Tree representing a tyr catch `try x catch { ... } finally { ... }` in the source code */ type Try <: Term - def isInstanceOfTry(given ctx: Context): IsInstanceOf[Try] + def isInstanceOfTry(using ctx: Context): IsInstanceOf[Try] - def Try_body(self: Try)(given ctx: Context): Term - def Try_cases(self: Try)(given ctx: Context): List[CaseDef] - def Try_finalizer(self: Try)(given ctx: Context): Option[Term] + def Try_body(self: Try)(using ctx: Context): Term + def Try_cases(self: Try)(using ctx: Context): List[CaseDef] + def Try_finalizer(self: Try)(using ctx: Context): Option[Term] - def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(given ctx: Context): Try - def Try_copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(given ctx: Context): Try + def Try_apply(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(using ctx: Context): Try + def Try_copy(original: Tree)(expr: Term, cases: List[CaseDef], finalizer: Option[Term])(using ctx: Context): Try /** Tree representing a `return` in the source code */ type Return <: Term - def isInstanceOfReturn(given ctx: Context): IsInstanceOf[Return] + def isInstanceOfReturn(using ctx: Context): IsInstanceOf[Return] - def Return_expr(self: Return)(given ctx: Context): Term + def Return_expr(self: Return)(using ctx: Context): Term - def Return_apply(expr: Term)(given ctx: Context): Return - def Return_copy(original: Tree)(expr: Term)(given ctx: Context): Return + def Return_apply(expr: Term)(using ctx: Context): Return + def Return_copy(original: Tree)(expr: Term)(using ctx: Context): Return /** Tree representing a variable argument list in the source code */ type Repeated <: Term - def isInstanceOfRepeated(given ctx: Context): IsInstanceOf[Repeated] + def isInstanceOfRepeated(using ctx: Context): IsInstanceOf[Repeated] - def Repeated_elems(self: Repeated)(given ctx: Context): List[Term] - def Repeated_elemtpt(self: Repeated)(given ctx: Context): TypeTree + def Repeated_elems(self: Repeated)(using ctx: Context): List[Term] + def Repeated_elemtpt(self: Repeated)(using ctx: Context): TypeTree - def Repeated_apply(elems: List[Term], elemtpt: TypeTree)(given ctx: Context): Repeated - def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree)(given ctx: Context): Repeated + def Repeated_apply(elems: List[Term], elemtpt: TypeTree)(using ctx: Context): Repeated + def Repeated_copy(original: Tree)(elems: List[Term], elemtpt: TypeTree)(using ctx: Context): Repeated /** Tree representing the scope of an inlined tree */ type Inlined <: Term - def isInstanceOfInlined(given ctx: Context): IsInstanceOf[Inlined] + def isInstanceOfInlined(using ctx: Context): IsInstanceOf[Inlined] - def Inlined_call(self: Inlined)(given ctx: Context): Option[Tree/* Term | TypeTree */] - def Inlined_bindings(self: Inlined)(given ctx: Context): List[Definition] - def Inlined_body(self: Inlined)(given ctx: Context): Term + def Inlined_call(self: Inlined)(using ctx: Context): Option[Tree/* Term | TypeTree */] + def Inlined_bindings(self: Inlined)(using ctx: Context): List[Definition] + def Inlined_body(self: Inlined)(using ctx: Context): Term - def Inlined_apply(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term)(given ctx: Context): Inlined - def Inlined_copy(original: Tree)(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term)(given ctx: Context): Inlined + def Inlined_apply(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term)(using ctx: Context): Inlined + def Inlined_copy(original: Tree)(call: Option[Tree/* Term | TypeTree */], bindings: List[Definition], expansion: Term)(using ctx: Context): Inlined /** Tree representing a selection of definition with a given name on a given prefix and number of nested scopes of inlined trees */ type SelectOuter <: Term - def isInstanceOfSelectOuter(given ctx: Context): IsInstanceOf[SelectOuter] + def isInstanceOfSelectOuter(using ctx: Context): IsInstanceOf[SelectOuter] - def SelectOuter_qualifier(self: SelectOuter)(given ctx: Context): Term - def SelectOuter_level(self: SelectOuter)(given ctx: Context): Int + def SelectOuter_qualifier(self: SelectOuter)(using ctx: Context): Term + def SelectOuter_level(self: SelectOuter)(using ctx: Context): Int - def SelectOuter_apply(qualifier: Term, name: String, levels: Int)(given ctx: Context): SelectOuter - def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int)(given ctx: Context): SelectOuter + def SelectOuter_apply(qualifier: Term, name: String, levels: Int)(using ctx: Context): SelectOuter + def SelectOuter_copy(original: Tree)(qualifier: Term, name: String, levels: Int)(using ctx: Context): SelectOuter /** Tree representing a while loop */ type While <: Term - def isInstanceOfWhile(given ctx: Context): IsInstanceOf[While] + def isInstanceOfWhile(using ctx: Context): IsInstanceOf[While] - def While_cond(self: While)(given ctx: Context): Term - def While_body(self: While)(given ctx: Context): Term + def While_cond(self: While)(using ctx: Context): Term + def While_body(self: While)(using ctx: Context): Term - def While_apply(cond: Term, body: Term)(given ctx: Context): While - def While_copy(original: Tree)(cond: Term, body: Term)(given ctx: Context): While + def While_apply(cond: Term, body: Term)(using ctx: Context): While + def While_copy(original: Tree)(cond: Term, body: Term)(using ctx: Context): While /** Type tree representing a type written in the source */ type TypeTree <: Tree - def isInstanceOfTypeTree(given ctx: Context): IsInstanceOf[TypeTree] + def isInstanceOfTypeTree(using ctx: Context): IsInstanceOf[TypeTree] - def TypeTree_tpe(self: TypeTree)(given ctx: Context): Type + def TypeTree_tpe(self: TypeTree)(using ctx: Context): Type /** Type tree representing an inferred type */ type Inferred <: TypeTree - def isInstanceOfInferred(given ctx: Context): IsInstanceOf[Inferred] + def isInstanceOfInferred(using ctx: Context): IsInstanceOf[Inferred] - def Inferred_apply(tpe: Type)(given ctx: Context): Inferred + def Inferred_apply(tpe: Type)(using ctx: Context): Inferred - def TypeRef_apply(sym: Symbol)(given ctx: Context): TypeTree + def TypeRef_apply(sym: Symbol)(using ctx: Context): TypeTree /** Type tree representing a reference to definition with a given name */ type TypeIdent <: TypeTree - def isInstanceOfTypeIdent(given ctx: Context): IsInstanceOf[TypeIdent] + def isInstanceOfTypeIdent(using ctx: Context): IsInstanceOf[TypeIdent] - def TypeIdent_name(self: TypeIdent)(given ctx: Context): String + def TypeIdent_name(self: TypeIdent)(using ctx: Context): String - def TypeIdent_copy(original: Tree)(name: String)(given ctx: Context): TypeIdent + def TypeIdent_copy(original: Tree)(name: String)(using ctx: Context): TypeIdent /** Type tree representing a selection of definition with a given name on a given term prefix */ type TypeSelect <: TypeTree - def isInstanceOfTypeSelect(given ctx: Context): IsInstanceOf[TypeSelect] + def isInstanceOfTypeSelect(using ctx: Context): IsInstanceOf[TypeSelect] - def TypeSelect_qualifier(self: TypeSelect)(given ctx: Context): Term - def TypeSelect_name(self: TypeSelect)(given ctx: Context): String + def TypeSelect_qualifier(self: TypeSelect)(using ctx: Context): Term + def TypeSelect_name(self: TypeSelect)(using ctx: Context): String - def TypeSelect_apply(qualifier: Term, name: String)(given ctx: Context): TypeSelect - def TypeSelect_copy(original: Tree)(qualifier: Term, name: String)(given ctx: Context): TypeSelect + def TypeSelect_apply(qualifier: Term, name: String)(using ctx: Context): TypeSelect + def TypeSelect_copy(original: Tree)(qualifier: Term, name: String)(using ctx: Context): TypeSelect /** Type tree representing a selection of definition with a given name on a given type prefix */ type Projection <: TypeTree - def isInstanceOfProjection(given ctx: Context): IsInstanceOf[Projection] + def isInstanceOfProjection(using ctx: Context): IsInstanceOf[Projection] - def Projection_qualifier(self: Projection)(given ctx: Context): TypeTree - def Projection_name(self: Projection)(given ctx: Context): String + def Projection_qualifier(self: Projection)(using ctx: Context): TypeTree + def Projection_name(self: Projection)(using ctx: Context): String - def Projection_copy(original: Tree)(qualifier: TypeTree, name: String)(given ctx: Context): Projection + def Projection_copy(original: Tree)(qualifier: TypeTree, name: String)(using ctx: Context): Projection /** Type tree representing a singleton type */ type Singleton <: TypeTree - def isInstanceOfSingleton(given ctx: Context): IsInstanceOf[Singleton] + def isInstanceOfSingleton(using ctx: Context): IsInstanceOf[Singleton] - def Singleton_ref(self: Singleton)(given ctx: Context): Term + def Singleton_ref(self: Singleton)(using ctx: Context): Term - def Singleton_apply(ref: Term)(given ctx: Context): Singleton - def Singleton_copy(original: Tree)(ref: Term)(given ctx: Context): Singleton + def Singleton_apply(ref: Term)(using ctx: Context): Singleton + def Singleton_copy(original: Tree)(ref: Term)(using ctx: Context): Singleton /** Type tree representing a type refinement */ type Refined <: TypeTree - def isInstanceOfRefined(given ctx: Context): IsInstanceOf[Refined] + def isInstanceOfRefined(using ctx: Context): IsInstanceOf[Refined] - def Refined_tpt(self: Refined)(given ctx: Context): TypeTree - def Refined_refinements(self: Refined)(given ctx: Context): List[Definition] + def Refined_tpt(self: Refined)(using ctx: Context): TypeTree + def Refined_refinements(self: Refined)(using ctx: Context): List[Definition] - def Refined_copy(original: Tree)(tpt: TypeTree, refinements: List[Definition])(given ctx: Context): Refined + def Refined_copy(original: Tree)(tpt: TypeTree, refinements: List[Definition])(using ctx: Context): Refined /** Type tree representing a type application */ type Applied <: TypeTree - def isInstanceOfApplied(given ctx: Context): IsInstanceOf[Applied] + def isInstanceOfApplied(using ctx: Context): IsInstanceOf[Applied] - def Applied_tpt(self: Applied)(given ctx: Context): TypeTree - def Applied_args(self: Applied)(given ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] + def Applied_tpt(self: Applied)(using ctx: Context): TypeTree + def Applied_args(self: Applied)(using ctx: Context): List[Tree /*TypeTree | TypeBoundsTree*/] - def Applied_apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(given ctx: Context): Applied - def Applied_copy(original: Tree)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(given ctx: Context): Applied + def Applied_apply(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(using ctx: Context): Applied + def Applied_copy(original: Tree)(tpt: TypeTree, args: List[Tree /*TypeTree | TypeBoundsTree*/])(using ctx: Context): Applied /** Type tree representing an annotated type */ type Annotated <: TypeTree - def isInstanceOfAnnotated(given ctx: Context): IsInstanceOf[Annotated] + def isInstanceOfAnnotated(using ctx: Context): IsInstanceOf[Annotated] - def Annotated_arg(self: Annotated)(given ctx: Context): TypeTree - def Annotated_annotation(self: Annotated)(given ctx: Context): Term + def Annotated_arg(self: Annotated)(using ctx: Context): TypeTree + def Annotated_annotation(self: Annotated)(using ctx: Context): Term - def Annotated_apply(arg: TypeTree, annotation: Term)(given ctx: Context): Annotated - def Annotated_copy(original: Tree)(arg: TypeTree, annotation: Term)(given ctx: Context): Annotated + def Annotated_apply(arg: TypeTree, annotation: Term)(using ctx: Context): Annotated + def Annotated_copy(original: Tree)(arg: TypeTree, annotation: Term)(using ctx: Context): Annotated /** Type tree representing a type match */ type MatchTypeTree <: TypeTree - def isInstanceOfMatchTypeTree(given ctx: Context): IsInstanceOf[MatchTypeTree] + def isInstanceOfMatchTypeTree(using ctx: Context): IsInstanceOf[MatchTypeTree] - def MatchTypeTree_bound(self: MatchTypeTree)(given ctx: Context): Option[TypeTree] - def MatchTypeTree_selector(self: MatchTypeTree)(given ctx: Context): TypeTree - def MatchTypeTree_cases(self: MatchTypeTree)(given ctx: Context): List[TypeCaseDef] + def MatchTypeTree_bound(self: MatchTypeTree)(using ctx: Context): Option[TypeTree] + def MatchTypeTree_selector(self: MatchTypeTree)(using ctx: Context): TypeTree + def MatchTypeTree_cases(self: MatchTypeTree)(using ctx: Context): List[TypeCaseDef] - def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(given ctx: Context): MatchTypeTree - def MatchTypeTree_copy(original: Tree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(given ctx: Context): MatchTypeTree + def MatchTypeTree_apply(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(using ctx: Context): MatchTypeTree + def MatchTypeTree_copy(original: Tree)(bound: Option[TypeTree], selector: TypeTree, cases: List[TypeCaseDef])(using ctx: Context): MatchTypeTree /** Type tree representing a by name parameter */ type ByName <: TypeTree - def ByName_result(self: ByName)(given ctx: Context): TypeTree + def ByName_result(self: ByName)(using ctx: Context): TypeTree - def isInstanceOfByName(given ctx: Context): IsInstanceOf[ByName] + def isInstanceOfByName(using ctx: Context): IsInstanceOf[ByName] - def ByName_apply(result: TypeTree)(given ctx: Context): ByName - def ByName_copy(original: Tree)(result: TypeTree)(given ctx: Context): ByName + def ByName_apply(result: TypeTree)(using ctx: Context): ByName + def ByName_copy(original: Tree)(result: TypeTree)(using ctx: Context): ByName /** Type tree representing a lambda abstraction type */ type LambdaTypeTree <: TypeTree - def isInstanceOfLambdaTypeTree(given ctx: Context): IsInstanceOf[LambdaTypeTree] + def isInstanceOfLambdaTypeTree(using ctx: Context): IsInstanceOf[LambdaTypeTree] - def Lambdatparams(self: LambdaTypeTree)(given ctx: Context): List[TypeDef] - def Lambdabody(self: LambdaTypeTree)(given ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ + def Lambdatparams(self: LambdaTypeTree)(using ctx: Context): List[TypeDef] + def Lambdabody(self: LambdaTypeTree)(using ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ - def Lambdaapply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(given ctx: Context): LambdaTypeTree - def Lambdacopy(original: Tree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(given ctx: Context): LambdaTypeTree + def Lambdaapply(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(using ctx: Context): LambdaTypeTree + def Lambdacopy(original: Tree)(tparams: List[TypeDef], body: Tree /*TypeTree | TypeBoundsTree*/)(using ctx: Context): LambdaTypeTree /** Type tree representing a type binding */ type TypeBind <: TypeTree - def isInstanceOfTypeBind(given ctx: Context): IsInstanceOf[TypeBind] + def isInstanceOfTypeBind(using ctx: Context): IsInstanceOf[TypeBind] - def TypeBind_name(self: TypeBind)(given ctx: Context): String - def TypeBind_body(self: TypeBind)(given ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ + def TypeBind_name(self: TypeBind)(using ctx: Context): String + def TypeBind_body(self: TypeBind)(using ctx: Context): Tree /*TypeTree | TypeBoundsTree*/ - def TypeBind_copy(original: Tree)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/)(given ctx: Context): TypeBind + def TypeBind_copy(original: Tree)(name: String, tpt: Tree /*TypeTree | TypeBoundsTree*/)(using ctx: Context): TypeBind /** Type tree within a block with aliases `{ type U1 = ... ; T[U1, U2] }` */ type TypeBlock <: TypeTree - def isInstanceOfTypeBlock(given ctx: Context): IsInstanceOf[TypeBlock] + def isInstanceOfTypeBlock(using ctx: Context): IsInstanceOf[TypeBlock] - def TypeBlock_aliases(self: TypeBlock)(given ctx: Context): List[TypeDef] - def TypeBlock_tpt(self: TypeBlock)(given ctx: Context): TypeTree + def TypeBlock_aliases(self: TypeBlock)(using ctx: Context): List[TypeDef] + def TypeBlock_tpt(self: TypeBlock)(using ctx: Context): TypeTree - def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree)(given ctx: Context): TypeBlock - def TypeBlock_copy(original: Tree)(aliases: List[TypeDef], tpt: TypeTree)(given ctx: Context): TypeBlock + def TypeBlock_apply(aliases: List[TypeDef], tpt: TypeTree)(using ctx: Context): TypeBlock + def TypeBlock_copy(original: Tree)(aliases: List[TypeDef], tpt: TypeTree)(using ctx: Context): TypeBlock /** Type tree representing a type bound written in the source */ type TypeBoundsTree <: Tree /*TypeTree | TypeBoundsTree*/ - def isInstanceOfTypeBoundsTree(given ctx: Context): IsInstanceOf[TypeBoundsTree] + def isInstanceOfTypeBoundsTree(using ctx: Context): IsInstanceOf[TypeBoundsTree] - def TypeBoundsTree_tpe(self: TypeBoundsTree)(given ctx: Context): TypeBounds - def TypeBoundsTree_low(self: TypeBoundsTree)(given ctx: Context): TypeTree - def TypeBoundsTree_hi(self: TypeBoundsTree)(given ctx: Context): TypeTree + def TypeBoundsTree_tpe(self: TypeBoundsTree)(using ctx: Context): TypeBounds + def TypeBoundsTree_low(self: TypeBoundsTree)(using ctx: Context): TypeTree + def TypeBoundsTree_hi(self: TypeBoundsTree)(using ctx: Context): TypeTree /** Type tree representing wildcard type bounds written in the source. * The wildcard type `_` (for example in in `List[_]`) will be a type tree that @@ -719,32 +719,32 @@ trait CompilerInterface { */ type WildcardTypeTree <: Tree - def isInstanceOfWildcardTypeTree(given ctx: Context): IsInstanceOf[WildcardTypeTree] + def isInstanceOfWildcardTypeTree(using ctx: Context): IsInstanceOf[WildcardTypeTree] - def WildcardTypeTree_tpe(self: WildcardTypeTree)(given ctx: Context): TypeOrBounds + def WildcardTypeTree_tpe(self: WildcardTypeTree)(using ctx: Context): TypeOrBounds /** Branch of a pattern match or catch clause */ type CaseDef <: Tree - def isInstanceOfCaseDef(given ctx: Context): IsInstanceOf[CaseDef] + def isInstanceOfCaseDef(using ctx: Context): IsInstanceOf[CaseDef] - def CaseDef_pattern(self: CaseDef)(given ctx: Context): Tree - def CaseDef_guard(self: CaseDef)(given ctx: Context): Option[Term] - def CaseDef_rhs(self: CaseDef)(given ctx: Context): Term + def CaseDef_pattern(self: CaseDef)(using ctx: Context): Tree + def CaseDef_guard(self: CaseDef)(using ctx: Context): Option[Term] + def CaseDef_rhs(self: CaseDef)(using ctx: Context): Term - def CaseDef_module_apply(pattern: Tree, guard: Option[Term], body: Term)(given ctx: Context): CaseDef - def CaseDef_module_copy(original: Tree)(pattern: Tree, guard: Option[Term], body: Term)(given ctx: Context): CaseDef + def CaseDef_module_apply(pattern: Tree, guard: Option[Term], body: Term)(using ctx: Context): CaseDef + def CaseDef_module_copy(original: Tree)(pattern: Tree, guard: Option[Term], body: Term)(using ctx: Context): CaseDef /** Branch of a type pattern match */ type TypeCaseDef <: Tree - def isInstanceOfTypeCaseDef(given ctx: Context): IsInstanceOf[TypeCaseDef] + def isInstanceOfTypeCaseDef(using ctx: Context): IsInstanceOf[TypeCaseDef] - def TypeCaseDef_pattern(self: TypeCaseDef)(given ctx: Context): TypeTree - def TypeCaseDef_rhs(self: TypeCaseDef)(given ctx: Context): TypeTree + def TypeCaseDef_pattern(self: TypeCaseDef)(using ctx: Context): TypeTree + def TypeCaseDef_rhs(self: TypeCaseDef)(using ctx: Context): TypeTree - def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree)(given ctx: Context): TypeCaseDef - def TypeCaseDef_module_copy(original: Tree)(pattern: TypeTree, body: TypeTree)(given ctx: Context): TypeCaseDef + def TypeCaseDef_module_apply(pattern: TypeTree, body: TypeTree)(using ctx: Context): TypeCaseDef + def TypeCaseDef_module_copy(original: Tree)(pattern: TypeTree, body: TypeTree)(using ctx: Context): TypeCaseDef // // PATTERNS @@ -753,36 +753,36 @@ trait CompilerInterface { /** Tree representing a binding pattern `_ @ _` */ type Bind <: Tree - def isInstanceOfBind(given ctx: Context): IsInstanceOf[Bind] + def isInstanceOfBind(using ctx: Context): IsInstanceOf[Bind] - def Tree_Bind_name(self: Bind)(given ctx: Context): String + def Tree_Bind_name(self: Bind)(using ctx: Context): String - def Tree_Bind_pattern(self: Bind)(given ctx: Context): Tree + def Tree_Bind_pattern(self: Bind)(using ctx: Context): Tree - def Tree_Bind_module_copy(original: Tree)(name: String, pattern: Tree)(given ctx: Context): Bind + def Tree_Bind_module_copy(original: Tree)(name: String, pattern: Tree)(using ctx: Context): Bind /** Tree representing an unapply pattern `Xyz(...)` */ type Unapply <: Tree - def isInstanceOfUnapply(given ctx: Context): IsInstanceOf[Unapply] + def isInstanceOfUnapply(using ctx: Context): IsInstanceOf[Unapply] - def Tree_Unapply_fun(self: Unapply)(given ctx: Context): Term + def Tree_Unapply_fun(self: Unapply)(using ctx: Context): Term - def Tree_Unapply_implicits(self: Unapply)(given ctx: Context): List[Term] + def Tree_Unapply_implicits(self: Unapply)(using ctx: Context): List[Term] - def Tree_Unapply_patterns(self: Unapply)(given ctx: Context): List[Tree] + def Tree_Unapply_patterns(self: Unapply)(using ctx: Context): List[Tree] - def Tree_Unapply_module_copy(original: Tree)(fun: Term, implicits: List[Term], patterns: List[Tree])(given ctx: Context): Unapply + def Tree_Unapply_module_copy(original: Tree)(fun: Term, implicits: List[Term], patterns: List[Tree])(using ctx: Context): Unapply /** Tree representing pattern alternatives `X | Y | ...` */ type Alternatives <: Tree - def isInstanceOfAlternatives(given ctx: Context): IsInstanceOf[Alternatives] + def isInstanceOfAlternatives(using ctx: Context): IsInstanceOf[Alternatives] - def Tree_Alternatives_patterns(self: Alternatives)(given ctx: Context): List[Tree] + def Tree_Alternatives_patterns(self: Alternatives)(using ctx: Context): List[Tree] - def Tree_Alternatives_module_apply(patterns: List[Tree])(given ctx: Context): Alternatives - def Tree_Alternatives_module_copy(original: Tree)(patterns: List[Tree])(given ctx: Context): Alternatives + def Tree_Alternatives_module_apply(patterns: List[Tree])(using ctx: Context): Alternatives + def Tree_Alternatives_module_copy(original: Tree)(patterns: List[Tree])(using ctx: Context): Alternatives // @@ -795,32 +795,32 @@ trait CompilerInterface { /** NoPrefix for a type selection */ type NoPrefix <: TypeOrBounds - def isInstanceOfNoPrefix(given ctx: Context): IsInstanceOf[NoPrefix] + def isInstanceOfNoPrefix(using ctx: Context): IsInstanceOf[NoPrefix] /** Type bounds */ type TypeBounds <: TypeOrBounds - def isInstanceOfTypeBounds(given ctx: Context): IsInstanceOf[TypeBounds] + def isInstanceOfTypeBounds(using ctx: Context): IsInstanceOf[TypeBounds] - def TypeBounds_apply(low: Type, hi: Type)(given ctx: Context): TypeBounds + def TypeBounds_apply(low: Type, hi: Type)(using ctx: Context): TypeBounds - def TypeBounds_low(self: TypeBounds)(given ctx: Context): Type - def TypeBounds_hi(self: TypeBounds)(given ctx: Context): Type + def TypeBounds_low(self: TypeBounds)(using ctx: Context): Type + def TypeBounds_hi(self: TypeBounds)(using ctx: Context): Type /** A type */ type Type <: TypeOrBounds - def isInstanceOfType(given ctx: Context): IsInstanceOf[Type] + def isInstanceOfType(using ctx: Context): IsInstanceOf[Type] - def Type_apply(clazz: Class[_])(given ctx: Context): Type + def Type_apply(clazz: Class[_])(using ctx: Context): Type /** Is `self` type the same as `that` type? * This is the case iff `Type_isSubType(self, that)` and `Type_isSubType(that, self)`. */ - def Type_isTypeEq(self: Type)(that: Type)(given ctx: Context): Boolean + def Type_isTypeEq(self: Type)(that: Type)(using ctx: Context): Boolean /** Is this type a subtype of that type? */ - def Type_isSubType(self: Type)(that: Type)(given ctx: Context): Boolean + def Type_isSubType(self: Type)(that: Type)(using ctx: Context): Boolean /** Widen from singleton type to its underlying non-singleton * base type by applying one or more `underlying` dereferences, @@ -831,33 +831,33 @@ trait CompilerInterface { * def o: Outer * .widen = o.C */ - def Type_widen(self: Type)(given ctx: Context): Type + def Type_widen(self: Type)(using ctx: Context): Type /** Widen from TermRef to its underlying non-termref * base type, while also skipping Expr types. */ - def Type_widenTermRefExpr(self: Type)(given ctx: Context): Type + def Type_widenTermRefExpr(self: Type)(using ctx: Context): Type /** Follow aliases and dereferences LazyRefs, annotated types and instantiated * TypeVars until type is no longer alias type, annotated type, LazyRef, * or instantiated type variable. */ - def Type_dealias(self: Type)(given ctx: Context): Type + def Type_dealias(self: Type)(using ctx: Context): Type - def Type_simplified(self: Type)(given ctx: Context): Type + def Type_simplified(self: Type)(using ctx: Context): Type - def Type_classSymbol(self: Type)(given ctx: Context): Option[Symbol] // TODO remove Option and use NoSymbol + def Type_classSymbol(self: Type)(using ctx: Context): Option[Symbol] // TODO remove Option and use NoSymbol - def Type_typeSymbol(self: Type)(given ctx: Context): Symbol + def Type_typeSymbol(self: Type)(using ctx: Context): Symbol - def Type_termSymbol(self: Type)(given ctx: Context): Symbol + def Type_termSymbol(self: Type)(using ctx: Context): Symbol - def Type_isSingleton(self: Type)(given ctx: Context): Boolean + def Type_isSingleton(self: Type)(using ctx: Context): Boolean - def Type_memberType(self: Type)(member: Symbol)(given ctx: Context): Type + def Type_memberType(self: Type)(member: Symbol)(using ctx: Context): Type /** Is this type an instance of a non-bottom subclass of the given class `cls`? */ - def Type_derivesFrom(self: Type)(cls: Symbol)(given ctx: Context): Boolean + def Type_derivesFrom(self: Type)(cls: Symbol)(using ctx: Context): Boolean /** Is this type a function type? * @@ -868,163 +868,163 @@ trait CompilerInterface { * - returns true for `given Int => Int` and `erased Int => Int` * - returns false for `List[Int]`, despite that `List[Int] <:< Int => Int`. */ - def Type_isFunctionType(self: Type)(given ctx: Context): Boolean + def Type_isFunctionType(self: Type)(using ctx: Context): Boolean /** Is this type an context function type? * * @see `Type_isFunctionType` */ - def Type_isContextFunctionType(self: Type)(given ctx: Context): Boolean + def Type_isContextFunctionType(self: Type)(using ctx: Context): Boolean /** Is this type an erased function type? * * @see `Type_isFunctionType` */ - def Type_isErasedFunctionType(self: Type)(given ctx: Context): Boolean + def Type_isErasedFunctionType(self: Type)(using ctx: Context): Boolean /** Is this type a dependent function type? * * @see `Type_isFunctionType` */ - def Type_isDependentFunctionType(self: Type)(given ctx: Context): Boolean + def Type_isDependentFunctionType(self: Type)(using ctx: Context): Boolean /** A singleton type representing a known constant value */ type ConstantType <: Type - def isInstanceOfConstantType(given ctx: Context): IsInstanceOf[ConstantType] + def isInstanceOfConstantType(using ctx: Context): IsInstanceOf[ConstantType] - def ConstantType_apply(const : Constant)(given ctx : Context) : ConstantType + def ConstantType_apply(const : Constant)(using ctx : Context) : ConstantType - def ConstantType_constant(self: ConstantType)(given ctx: Context): Constant + def ConstantType_constant(self: ConstantType)(using ctx: Context): Constant /** Type of a reference to a term symbol */ type TermRef <: Type - def isInstanceOfTermRef(given ctx: Context): IsInstanceOf[TermRef] + def isInstanceOfTermRef(using ctx: Context): IsInstanceOf[TermRef] - def TermRef_apply(qual: TypeOrBounds, name: String)(given ctx: Context): TermRef + def TermRef_apply(qual: TypeOrBounds, name: String)(using ctx: Context): TermRef - def TermRef_qualifier(self: TermRef)(given ctx: Context): TypeOrBounds - def TermRef_name(self: TermRef)(given ctx: Context): String + def TermRef_qualifier(self: TermRef)(using ctx: Context): TypeOrBounds + def TermRef_name(self: TermRef)(using ctx: Context): String /** Type of a reference to a type symbol */ type TypeRef <: Type - def isInstanceOfTypeRef(given ctx: Context): IsInstanceOf[TypeRef] + def isInstanceOfTypeRef(using ctx: Context): IsInstanceOf[TypeRef] - def TypeRef_qualifier(self: TypeRef)(given ctx: Context): TypeOrBounds - def TypeRef_name(self: TypeRef)(given Context): String - def TypeRef_isOpaqueAlias(self: TypeRef)(given Context): Boolean - def TypeRef_translucentSuperType(self: TypeRef)(given Context): Type + def TypeRef_qualifier(self: TypeRef)(using ctx: Context): TypeOrBounds + def TypeRef_name(self: TypeRef)(using ctx: Context): String + def TypeRef_isOpaqueAlias(self: TypeRef)(using ctx: Context): Boolean + def TypeRef_translucentSuperType(self: TypeRef)(using ctx: Context): Type /** Type of a `super` reference */ type SuperType <: Type - def isInstanceOfSuperType(given ctx: Context): IsInstanceOf[SuperType] + def isInstanceOfSuperType(using ctx: Context): IsInstanceOf[SuperType] - def SuperType_apply(thistpe: Type, supertpe: Type)(given ctx: Context): SuperType + def SuperType_apply(thistpe: Type, supertpe: Type)(using ctx: Context): SuperType - def SuperType_thistpe(self: SuperType)(given ctx: Context): Type - def SuperType_supertpe(self: SuperType)(given ctx: Context): Type + def SuperType_thistpe(self: SuperType)(using ctx: Context): Type + def SuperType_supertpe(self: SuperType)(using ctx: Context): Type /** A type with a type refinement `T { type U }` */ type Refinement <: Type - def isInstanceOfRefinement(given ctx: Context): IsInstanceOf[Refinement] + def isInstanceOfRefinement(using ctx: Context): IsInstanceOf[Refinement] - def Refinement_apply(parent: Type, name: String, info: TypeOrBounds /* Type | TypeBounds */)(given ctx: Context): Refinement + def Refinement_apply(parent: Type, name: String, info: TypeOrBounds /* Type | TypeBounds */)(using ctx: Context): Refinement - def Refinement_parent(self: Refinement)(given ctx: Context): Type - def Refinement_name(self: Refinement)(given ctx: Context): String - def Refinement_info(self: Refinement)(given ctx: Context): TypeOrBounds + def Refinement_parent(self: Refinement)(using ctx: Context): Type + def Refinement_name(self: Refinement)(using ctx: Context): String + def Refinement_info(self: Refinement)(using ctx: Context): TypeOrBounds /** A higher kinded type applied to some types `T[U]` */ type AppliedType <: Type - def isInstanceOfAppliedType(given ctx: Context): IsInstanceOf[AppliedType] + def isInstanceOfAppliedType(using ctx: Context): IsInstanceOf[AppliedType] - def AppliedType_tycon(self: AppliedType)(given ctx: Context): Type - def AppliedType_args(self: AppliedType)(given ctx: Context): List[TypeOrBounds] + def AppliedType_tycon(self: AppliedType)(using ctx: Context): Type + def AppliedType_args(self: AppliedType)(using ctx: Context): List[TypeOrBounds] - def AppliedType_apply(tycon: Type, args: List[TypeOrBounds])(given ctx: Context) : AppliedType + def AppliedType_apply(tycon: Type, args: List[TypeOrBounds])(using ctx: Context) : AppliedType /** A type with an anottation `T @foo` */ type AnnotatedType <: Type - def isInstanceOfAnnotatedType(given ctx: Context): IsInstanceOf[AnnotatedType] + def isInstanceOfAnnotatedType(using ctx: Context): IsInstanceOf[AnnotatedType] - def AnnotatedType_apply(underlying: Type, annot: Term)(given ctx: Context): AnnotatedType + def AnnotatedType_apply(underlying: Type, annot: Term)(using ctx: Context): AnnotatedType - def AnnotatedType_underlying(self: AnnotatedType)(given ctx: Context): Type - def AnnotatedType_annot(self: AnnotatedType)(given ctx: Context): Term + def AnnotatedType_underlying(self: AnnotatedType)(using ctx: Context): Type + def AnnotatedType_annot(self: AnnotatedType)(using ctx: Context): Term /** Intersection type `T & U` */ type AndType <: Type - def isInstanceOfAndType(given ctx: Context): IsInstanceOf[AndType] + def isInstanceOfAndType(using ctx: Context): IsInstanceOf[AndType] - def AndType_apply(lhs: Type, rhs: Type)(given ctx: Context): AndType + def AndType_apply(lhs: Type, rhs: Type)(using ctx: Context): AndType - def AndType_left(self: AndType)(given ctx: Context): Type - def AndType_right(self: AndType)(given ctx: Context): Type + def AndType_left(self: AndType)(using ctx: Context): Type + def AndType_right(self: AndType)(using ctx: Context): Type /** Union type `T | U` */ type OrType <: Type - def isInstanceOfOrType(given ctx: Context): IsInstanceOf[OrType] + def isInstanceOfOrType(using ctx: Context): IsInstanceOf[OrType] - def OrType_apply(lhs : Type, rhs : Type)(given ctx : Context): OrType + def OrType_apply(lhs : Type, rhs : Type)(using ctx : Context): OrType - def OrType_left(self: OrType)(given ctx: Context): Type - def OrType_right(self: OrType)(given ctx: Context): Type + def OrType_left(self: OrType)(using ctx: Context): Type + def OrType_right(self: OrType)(using ctx: Context): Type /** Type match `T match { case U => ... }` */ type MatchType <: Type - def isInstanceOfMatchType(given ctx: Context): IsInstanceOf[MatchType] + def isInstanceOfMatchType(using ctx: Context): IsInstanceOf[MatchType] - def MatchType_apply(bound: Type, scrutinee: Type, cases: List[Type])(given ctx: Context): MatchType + def MatchType_apply(bound: Type, scrutinee: Type, cases: List[Type])(using ctx: Context): MatchType - def MatchType_bound(self: MatchType)(given ctx: Context): Type - def MatchType_scrutinee(self: MatchType)(given ctx: Context): Type - def MatchType_cases(self: MatchType)(given ctx: Context): List[Type] + def MatchType_bound(self: MatchType)(using ctx: Context): Type + def MatchType_scrutinee(self: MatchType)(using ctx: Context): Type + def MatchType_cases(self: MatchType)(using ctx: Context): List[Type] /** Type of a by by name parameter */ type ByNameType <: Type - def isInstanceOfByNameType(given ctx: Context): IsInstanceOf[ByNameType] + def isInstanceOfByNameType(using ctx: Context): IsInstanceOf[ByNameType] - def ByNameType_apply(underlying: Type)(given ctx: Context): Type + def ByNameType_apply(underlying: Type)(using ctx: Context): Type - def ByNameType_underlying(self: ByNameType)(given ctx: Context): Type + def ByNameType_underlying(self: ByNameType)(using ctx: Context): Type /** Type of a parameter reference */ type ParamRef <: Type - def isInstanceOfParamRef(given ctx: Context): IsInstanceOf[ParamRef] + def isInstanceOfParamRef(using ctx: Context): IsInstanceOf[ParamRef] - def ParamRef_binder(self: ParamRef)(given ctx: Context): LambdaType[TypeOrBounds] - def ParamRef_paramNum(self: ParamRef)(given ctx: Context): Int + def ParamRef_binder(self: ParamRef)(using ctx: Context): LambdaType[TypeOrBounds] + def ParamRef_paramNum(self: ParamRef)(using ctx: Context): Int /** Type of `this` */ type ThisType <: Type - def isInstanceOfThisType(given ctx: Context): IsInstanceOf[ThisType] + def isInstanceOfThisType(using ctx: Context): IsInstanceOf[ThisType] - def ThisType_tref(self: ThisType)(given ctx: Context): Type + def ThisType_tref(self: ThisType)(using ctx: Context): Type /** A type that is recursively defined `this` */ type RecursiveThis <: Type - def isInstanceOfRecursiveThis(given ctx: Context): IsInstanceOf[RecursiveThis] + def isInstanceOfRecursiveThis(using ctx: Context): IsInstanceOf[RecursiveThis] - def RecursiveThis_binder(self: RecursiveThis)(given ctx: Context): RecursiveType + def RecursiveThis_binder(self: RecursiveThis)(using ctx: Context): RecursiveType /** A type that is recursively defined */ type RecursiveType <: Type - def isInstanceOfRecursiveType(given ctx: Context): IsInstanceOf[RecursiveType] + def isInstanceOfRecursiveType(using ctx: Context): IsInstanceOf[RecursiveType] /** Create a RecType, normalizing its contents. This means: * @@ -1034,11 +1034,11 @@ trait CompilerInterface { * `type T`. This avoids infinite recursions later when we * try to follow these references. */ - def RecursiveType_apply(parentExp: RecursiveType => Type)(given ctx: Context): RecursiveType + def RecursiveType_apply(parentExp: RecursiveType => Type)(using ctx: Context): RecursiveType - def RecursiveType_underlying(self: RecursiveType)(given ctx: Context): Type + def RecursiveType_underlying(self: RecursiveType)(using ctx: Context): Type - def RecursiveThis_recThis(self: RecursiveType)(given Context): RecursiveThis + def RecursiveThis_recThis(self: RecursiveType)(using ctx: Context): RecursiveThis // TODO can we add the bound back without an cake? // TODO is LambdaType really needed? ParamRefExtractor could be split into more precise extractors @@ -1048,40 +1048,40 @@ trait CompilerInterface { /** Type of the definition of a method taking a single list of parameters. It's return type may be a MethodType. */ type MethodType <: LambdaType[Type] - def isInstanceOfMethodType(given ctx: Context): IsInstanceOf[MethodType] + def isInstanceOfMethodType(using ctx: Context): IsInstanceOf[MethodType] def MethodType_apply(paramNames: List[String])(paramInfosExp: MethodType => List[Type], resultTypeExp: MethodType => Type): MethodType def MethodType_isErased(self: MethodType): Boolean def MethodType_isImplicit(self: MethodType): Boolean - def MethodType_param(self: MethodType, ids: Int)(given ctx: Context): Type - def MethodType_paramNames(self: MethodType)(given ctx: Context): List[String] - def MethodType_paramTypes(self: MethodType)(given ctx: Context): List[Type] - def MethodType_resType(self: MethodType)(given ctx: Context): Type + def MethodType_param(self: MethodType, ids: Int)(using ctx: Context): Type + def MethodType_paramNames(self: MethodType)(using ctx: Context): List[String] + def MethodType_paramTypes(self: MethodType)(using ctx: Context): List[Type] + def MethodType_resType(self: MethodType)(using ctx: Context): Type /** Type of the definition of a method taking a list of type parameters. It's return type may be a MethodType. */ type PolyType <: LambdaType[TypeBounds] - def isInstanceOfPolyType(given ctx: Context): IsInstanceOf[PolyType] + def isInstanceOfPolyType(using ctx: Context): IsInstanceOf[PolyType] - def PolyType_apply(paramNames: List[String])(paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)(given ctx: Context): PolyType + def PolyType_apply(paramNames: List[String])(paramBoundsExp: PolyType => List[TypeBounds], resultTypeExp: PolyType => Type)(using ctx: Context): PolyType - def PolyType_param(self: PolyType, idx: Int)(given ctx: Context): Type - def PolyType_paramNames(self: PolyType)(given ctx: Context): List[String] - def PolyType_paramBounds(self: PolyType)(given ctx: Context): List[TypeBounds] - def PolyType_resType(self: PolyType)(given ctx: Context): Type + def PolyType_param(self: PolyType, idx: Int)(using ctx: Context): Type + def PolyType_paramNames(self: PolyType)(using ctx: Context): List[String] + def PolyType_paramBounds(self: PolyType)(using ctx: Context): List[TypeBounds] + def PolyType_resType(self: PolyType)(using ctx: Context): Type /** Type of the definition of a type lambda taking a list of type parameters. It's return type may be a TypeLambda. */ type TypeLambda <: LambdaType[TypeBounds] - def isInstanceOfTypeLambda(given ctx: Context): IsInstanceOf[TypeLambda] + def isInstanceOfTypeLambda(using ctx: Context): IsInstanceOf[TypeLambda] def TypeLambda_apply(paramNames: List[String], boundsFn: TypeLambda => List[TypeBounds], bodyFn: TypeLambda => Type): TypeLambda - def TypeLambda_paramNames(self: TypeLambda)(given ctx: Context): List[String] - def TypeLambda_paramBounds(self: TypeLambda)(given ctx: Context): List[TypeBounds] - def TypeLambda_param(self: TypeLambda, idx: Int)(given ctx: Context): Type - def TypeLambda_resType(self: TypeLambda)(given ctx: Context): Type + def TypeLambda_paramNames(self: TypeLambda)(using ctx: Context): List[String] + def TypeLambda_paramBounds(self: TypeLambda)(using ctx: Context): List[TypeBounds] + def TypeLambda_param(self: TypeLambda, idx: Int)(using ctx: Context): Type + def TypeLambda_resType(self: TypeLambda)(using ctx: Context): Type ////////////////////// @@ -1097,22 +1097,22 @@ trait CompilerInterface { type SimpleSelector <: ImportSelector - def isInstanceOfSimpleSelector(given ctx: Context): IsInstanceOf[SimpleSelector] + def isInstanceOfSimpleSelector(using ctx: Context): IsInstanceOf[SimpleSelector] - def SimpleSelector_selection(self: SimpleSelector)(given ctx: Context): Id + def SimpleSelector_selection(self: SimpleSelector)(using ctx: Context): Id type RenameSelector <: ImportSelector - def isInstanceOfRenameSelector(given ctx: Context): IsInstanceOf[RenameSelector] + def isInstanceOfRenameSelector(using ctx: Context): IsInstanceOf[RenameSelector] - def RenameSelector_from(self: RenameSelector)(given ctx: Context): Id - def RenameSelector_to(self: RenameSelector)(given ctx: Context): Id + def RenameSelector_from(self: RenameSelector)(using ctx: Context): Id + def RenameSelector_to(self: RenameSelector)(using ctx: Context): Id type OmitSelector <: ImportSelector - def isInstanceOfOmitSelector(given ctx: Context): IsInstanceOf[OmitSelector] + def isInstanceOfOmitSelector(using ctx: Context): IsInstanceOf[OmitSelector] - def SimpleSelector_omitted(self: OmitSelector)(given ctx: Context): Id + def SimpleSelector_omitted(self: OmitSelector)(using ctx: Context): Id ///////////////// @@ -1123,10 +1123,10 @@ trait CompilerInterface { type Id <: AnyRef /** Position in the source code */ - def Id_pos(self: Id)(given ctx: Context): Position + def Id_pos(self: Id)(using ctx: Context): Position /** Name of the identifier */ - def Id_name(self: Id)(given ctx: Context): String + def Id_name(self: Id)(using ctx: Context): String //////////////// @@ -1226,118 +1226,118 @@ trait CompilerInterface { type Symbol <: AnyRef /** Owner of this symbol. The owner is the symbol in which this symbol is defined. Throws if this symbol does not have an owner. */ - def Symbol_owner(self: Symbol)(given ctx: Context): Symbol + def Symbol_owner(self: Symbol)(using ctx: Context): Symbol /** Owner of this symbol. The owner is the symbol in which this symbol is defined. Returns `NoSymbol` if this symbol does not have an owner. */ - def Symbol_maybeOwner(self: Symbol)(given ctx: Context): Symbol + def Symbol_maybeOwner(self: Symbol)(using ctx: Context): Symbol /** Flags of this symbol */ - def Symbol_flags(self: Symbol)(given ctx: Context): Flags + def Symbol_flags(self: Symbol)(using ctx: Context): Flags - def Symbol_tree(self: Symbol)(given ctx: Context): Tree + def Symbol_tree(self: Symbol)(using ctx: Context): Tree - def Symbol_isLocalDummy(self: Symbol)(given ctx: Context): Boolean + def Symbol_isLocalDummy(self: Symbol)(using ctx: Context): Boolean - def Symbol_isRefinementClass(self: Symbol)(given ctx: Context): Boolean + def Symbol_isRefinementClass(self: Symbol)(using ctx: Context): Boolean - def Symbol_isAliasType(self: Symbol)(given ctx: Context): Boolean + def Symbol_isAliasType(self: Symbol)(using ctx: Context): Boolean - def Symbol_isAnonymousClass(self: Symbol)(given ctx: Context): Boolean + def Symbol_isAnonymousClass(self: Symbol)(using ctx: Context): Boolean - def Symbol_isAnonymousFunction(self: Symbol)(given ctx: Context): Boolean + def Symbol_isAnonymousFunction(self: Symbol)(using ctx: Context): Boolean - def Symbol_isAbstractType(self: Symbol)(given ctx: Context): Boolean + def Symbol_isAbstractType(self: Symbol)(using ctx: Context): Boolean - def Symbol_isClassConstructor(self: Symbol)(given ctx: Context): Boolean + def Symbol_isClassConstructor(self: Symbol)(using ctx: Context): Boolean /** This symbol is private within the resulting type. */ - def Symbol_privateWithin(self: Symbol)(given ctx: Context): Option[Type] + def Symbol_privateWithin(self: Symbol)(using ctx: Context): Option[Type] /** This symbol is protected within the resulting type. */ - def Symbol_protectedWithin(self: Symbol)(given ctx: Context): Option[Type] + def Symbol_protectedWithin(self: Symbol)(using ctx: Context): Option[Type] /** The name of this symbol. */ - def Symbol_name(self: Symbol)(given ctx: Context): String + def Symbol_name(self: Symbol)(using ctx: Context): String /** The full name of this symbol up to the root package. */ - def Symbol_fullName(self: Symbol)(given ctx: Context): String + def Symbol_fullName(self: Symbol)(using ctx: Context): String /** The position of this symbol */ - def Symbol_pos(self: Symbol)(given ctx: Context): Position + def Symbol_pos(self: Symbol)(using ctx: Context): Position - def Symbol_localContext(self: Symbol)(given ctx: Context): Context + def Symbol_localContext(self: Symbol)(using ctx: Context): Context /** The comment of the symbol */ - def Symbol_comment(self: Symbol)(given ctx: Context): Option[Comment] + def Symbol_comment(self: Symbol)(using ctx: Context): Option[Comment] /** Annotations attached to this symbol */ - def Symbol_annots(self: Symbol)(given ctx: Context): List[Term] + def Symbol_annots(self: Symbol)(using ctx: Context): List[Term] - def Symbol_isDefinedInCurrentRun(self: Symbol)(given ctx: Context): Boolean + def Symbol_isDefinedInCurrentRun(self: Symbol)(using ctx: Context): Boolean /** Fields directly declared in the class */ - def Symbol_fields(self: Symbol)(given ctx: Context): List[Symbol] + def Symbol_fields(self: Symbol)(using ctx: Context): List[Symbol] /** Field with the given name directly declared in the class */ - def Symbol_field(self: Symbol)(name: String)(given ctx: Context): Symbol + def Symbol_field(self: Symbol)(name: String)(using ctx: Context): Symbol /** Get non-private named methods defined directly inside the class */ - def Symbol_classMethod(self: Symbol)(name: String)(given ctx: Context): List[Symbol] + def Symbol_classMethod(self: Symbol)(name: String)(using ctx: Context): List[Symbol] /** Get all non-private methods defined directly inside the class, excluding constructors */ - def Symbol_classMethods(self: Symbol)(given ctx: Context): List[Symbol] + def Symbol_classMethods(self: Symbol)(using ctx: Context): List[Symbol] /** Get named non-private methods declared or inherited */ - def Symbol_method(self: Symbol)(name: String)(given ctx: Context): List[Symbol] + def Symbol_method(self: Symbol)(name: String)(using ctx: Context): List[Symbol] /** Get all non-private methods declared or inherited */ - def Symbol_methods(self: Symbol)(given ctx: Context): List[Symbol] + def Symbol_methods(self: Symbol)(using ctx: Context): List[Symbol] /** Fields of a case class type -- only the ones declared in primary constructor */ - def Symbol_caseFields(self: Symbol)(given ctx: Context): List[Symbol] + def Symbol_caseFields(self: Symbol)(using ctx: Context): List[Symbol] - def Symbol_of(fullName: String)(given ctx: Context): Symbol + def Symbol_of(fullName: String)(using ctx: Context): Symbol - def Symbol_newMethod(parent: Symbol, name: String, flags: Flags, tpe: Type, privateWithin: Symbol)(given ctx: Context): Symbol + def Symbol_newMethod(parent: Symbol, name: String, flags: Flags, tpe: Type, privateWithin: Symbol)(using ctx: Context): Symbol - def Symbol_isTypeParam(self: Symbol)(given ctx: Context): Boolean + def Symbol_isTypeParam(self: Symbol)(using ctx: Context): Boolean - def Symbol_isPackageDef(symbol: Symbol)(given ctx: Context): Boolean + def Symbol_isPackageDef(symbol: Symbol)(using ctx: Context): Boolean /** Is this the definition of a type? */ - def Symbol_isType(symbol: Symbol)(given ctx: Context): Boolean + def Symbol_isType(symbol: Symbol)(using ctx: Context): Boolean /** Is this the definition of a term? */ - def Symbol_isTerm(symbol: Symbol)(given ctx: Context): Boolean + def Symbol_isTerm(symbol: Symbol)(using ctx: Context): Boolean /** Is this the definition of a ClassDef tree? */ - def Symbol_isClassDef(symbol: Symbol)(given ctx: Context): Boolean + def Symbol_isClassDef(symbol: Symbol)(using ctx: Context): Boolean /** Is this the definition of a TypeDef tree? */ - def Symbol_isTypeDef(symbol: Symbol)(given ctx: Context): Boolean + def Symbol_isTypeDef(symbol: Symbol)(using ctx: Context): Boolean /** Is this the definition of a DefDef tree? */ - def Symbol_isDefDef(symbol: Symbol)(given ctx: Context): Boolean + def Symbol_isDefDef(symbol: Symbol)(using ctx: Context): Boolean /** Is this the definition of a ValDef tree? */ - def Symbol_isValDef(symbol: Symbol)(given ctx: Context): Boolean + def Symbol_isValDef(symbol: Symbol)(using ctx: Context): Boolean /** Is this the definition of a Bind pattern? */ - def Symbol_isBind(symbol: Symbol)(given ctx: Context): Boolean + def Symbol_isBind(symbol: Symbol)(using ctx: Context): Boolean /** Signature of this definition */ - def Symbol_signature(self: Symbol)(given ctx: Context): Signature + def Symbol_signature(self: Symbol)(using ctx: Context): Signature /** The class symbol of the companion module class */ - def Symbol_moduleClass(self: Symbol)(given ctx: Context): Symbol + def Symbol_moduleClass(self: Symbol)(using ctx: Context): Symbol /** The symbol of the companion class */ - def Symbol_companionClass(self: Symbol)(given ctx: Context): Symbol + def Symbol_companionClass(self: Symbol)(using ctx: Context): Symbol /** The symbol of the companion module */ - def Symbol_companionModule(self: Symbol)(given ctx: Context): Symbol + def Symbol_companionModule(self: Symbol)(using ctx: Context): Symbol - def Symbol_noSymbol(given ctx: Context): Symbol + def Symbol_noSymbol(using ctx: Context): Symbol /////////// @@ -1398,20 +1398,20 @@ trait CompilerInterface { //////////////////////// /** 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[_])(using ctx: Context): Term /** Checked cast to a `quoted.Expr[U]` */ - def QuotedExpr_cast[U](self: scala.quoted.Expr[_])(given tp: scala.quoted.Type[U], ctx: Context): scala.quoted.Expr[U] + def QuotedExpr_cast[U](self: scala.quoted.Expr[_])(using tp: scala.quoted.Type[U], ctx: Context): scala.quoted.Expr[U] /** View this expression `quoted.Type[T]` as a `TypeTree` */ - def QuotedType_unseal(self: scala.quoted.Type[_])(given ctx: Context): TypeTree + def QuotedType_unseal(self: scala.quoted.Type[_])(using ctx: Context): TypeTree /** Convert `Term` to an `quoted.Expr[Any]` */ - def QuotedExpr_seal(self: Term)(given ctx: Context): scala.quoted.Expr[Any] + def QuotedExpr_seal(self: Term)(using ctx: Context): scala.quoted.Expr[Any] /** Convert `Type` to an `quoted.Type[_]` */ - def QuotedType_seal(self: Type)(given ctx: Context): scala.quoted.Type[_] + def QuotedType_seal(self: Type)(using ctx: Context): scala.quoted.Type[_] ///////////////// @@ -1503,21 +1503,21 @@ trait CompilerInterface { type ImplicitSearchResult <: AnyRef type ImplicitSearchSuccess <: ImplicitSearchResult - def isInstanceOfImplicitSearchSuccess(given ctx: Context): IsInstanceOf[ImplicitSearchSuccess] - def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess)(given ctx: Context): Term + def isInstanceOfImplicitSearchSuccess(using ctx: Context): IsInstanceOf[ImplicitSearchSuccess] + def ImplicitSearchSuccess_tree(self: ImplicitSearchSuccess)(using ctx: Context): Term type ImplicitSearchFailure <: ImplicitSearchResult - def isInstanceOfImplicitSearchFailure(given ctx: Context): IsInstanceOf[ImplicitSearchFailure] - def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure)(given ctx: Context): String + def isInstanceOfImplicitSearchFailure(using ctx: Context): IsInstanceOf[ImplicitSearchFailure] + def ImplicitSearchFailure_explanation(self: ImplicitSearchFailure)(using ctx: Context): String type DivergingImplicit <: ImplicitSearchFailure - def isInstanceOfDivergingImplicit(given ctx: Context): IsInstanceOf[DivergingImplicit] + def isInstanceOfDivergingImplicit(using ctx: Context): IsInstanceOf[DivergingImplicit] type NoMatchingImplicits <: ImplicitSearchFailure - def isInstanceOfNoMatchingImplicits(given ctx: Context): IsInstanceOf[NoMatchingImplicits] + def isInstanceOfNoMatchingImplicits(using ctx: Context): IsInstanceOf[NoMatchingImplicits] type AmbiguousImplicits <: ImplicitSearchFailure - def isInstanceOfAmbiguousImplicits(given ctx: Context): IsInstanceOf[AmbiguousImplicits] + def isInstanceOfAmbiguousImplicits(using ctx: Context): IsInstanceOf[AmbiguousImplicits] /** Find an implicit of type `T` in the current scope given by `ctx`. * Return an `ImplicitSearchResult`. @@ -1525,11 +1525,11 @@ trait CompilerInterface { * @param tpe type of the implicit parameter * @param ctx current context */ - def searchImplicit(tpe: Type)(given ctx: Context): ImplicitSearchResult + def searchImplicit(tpe: Type)(using ctx: Context): ImplicitSearchResult /** Inline fn if it is an explicit closure possibly nested inside the expression of a block. * Otherwise apply the arguments to the closure. */ - def betaReduce(f: Term, args: List[Term])(given ctx: Context): Term + def betaReduce(f: Term, args: List[Term])(using ctx: Context): Term } diff --git a/library/src/scala/tasty/reflect/ExtractorsPrinter.scala b/library/src/scala/tasty/reflect/ExtractorsPrinter.scala index f7bbacece6ac..4ad5b5cfd363 100644 --- a/library/src/scala/tasty/reflect/ExtractorsPrinter.scala +++ b/library/src/scala/tasty/reflect/ExtractorsPrinter.scala @@ -4,19 +4,19 @@ package reflect class ExtractorsPrinter[R <: Reflection & Singleton](val tasty: R) extends Printer[R] { import tasty.{_, given} - def showTree(tree: Tree)(given ctx: Context): String = + def showTree(tree: Tree)(using ctx: Context): String = new Buffer().visitTree(tree).result() - def showTypeOrBounds(tpe: TypeOrBounds)(given ctx: Context): String = + def showTypeOrBounds(tpe: TypeOrBounds)(using ctx: Context): String = new Buffer().visitType(tpe).result() - def showConstant(const: Constant)(given ctx: Context): String = + def showConstant(const: Constant)(using ctx: Context): String = new Buffer().visitConstant(const).result() - def showSymbol(symbol: Symbol)(given ctx: Context): String = + def showSymbol(symbol: Symbol)(using ctx: Context): String = new Buffer().visitSymbol(symbol).result() - def showFlags(flags: Flags)(given ctx: Context): String = { + def showFlags(flags: Flags)(using ctx: Context): String = { val flagList = List.newBuilder[String] if (flags.is(Flags.Private)) flagList += "Flags.Private" if (flags.is(Flags.Protected)) flagList += "Flags.Protected" @@ -54,7 +54,7 @@ class ExtractorsPrinter[R <: Reflection & Singleton](val tasty: R) extends Print flagList.result().mkString(" | ") } - private class Buffer(given ctx: Context) { self => + private class Buffer(using ctx: Context) { self => private val sb: StringBuilder = new StringBuilder diff --git a/library/src/scala/tasty/reflect/Printer.scala b/library/src/scala/tasty/reflect/Printer.scala index a8d7582a921f..1809e1883d76 100644 --- a/library/src/scala/tasty/reflect/Printer.scala +++ b/library/src/scala/tasty/reflect/Printer.scala @@ -7,17 +7,17 @@ trait Printer[R <: Reflection & Singleton] { val tasty: R /** Show a String representation of a tasty.Tree */ - def showTree(tree: tasty.Tree)(given ctx: tasty.Context): String + def showTree(tree: tasty.Tree)(using ctx: tasty.Context): String /** Show a String representation of a tasty.TypeOrBounds */ - def showTypeOrBounds(tpe: tasty.TypeOrBounds)(given ctx: tasty.Context): String + def showTypeOrBounds(tpe: tasty.TypeOrBounds)(using ctx: tasty.Context): String /** Show a String representation of a tasty.Constant */ - def showConstant(const: tasty.Constant)(given ctx: tasty.Context): String + def showConstant(const: tasty.Constant)(using ctx: tasty.Context): String /** Show a String representation of a tasty.Symbol */ - def showSymbol(symbol: tasty.Symbol)(given ctx: tasty.Context): String + def showSymbol(symbol: tasty.Symbol)(using ctx: tasty.Context): String /** Show a String representation of a tasty.Flags */ - def showFlags(flags: tasty.Flags)(given ctx: tasty.Context): String + def showFlags(flags: tasty.Flags)(using ctx: tasty.Context): String } diff --git a/library/src/scala/tasty/reflect/SourceCodePrinter.scala b/library/src/scala/tasty/reflect/SourceCodePrinter.scala index a722805c91b0..64c93426e208 100644 --- a/library/src/scala/tasty/reflect/SourceCodePrinter.scala +++ b/library/src/scala/tasty/reflect/SourceCodePrinter.scala @@ -8,19 +8,19 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig import tasty.{_, given} import syntaxHighlight._ - def showTree(tree: Tree)(given ctx: Context): String = + def showTree(tree: Tree)(using ctx: Context): String = (new Buffer).printTree(tree).result() - def showTypeOrBounds(tpe: TypeOrBounds)(given ctx: Context): String = + def showTypeOrBounds(tpe: TypeOrBounds)(using ctx: Context): String = (new Buffer).printTypeOrBound(tpe)(given None).result() - def showConstant(const: Constant)(given ctx: Context): String = + def showConstant(const: Constant)(using ctx: Context): String = (new Buffer).printConstant(const).result() - def showSymbol(symbol: Symbol)(given ctx: Context): String = + def showSymbol(symbol: Symbol)(using ctx: Context): String = symbol.fullName - def showFlags(flags: Flags)(given ctx: Context): String = { + def showFlags(flags: Flags)(using ctx: Context): String = { val flagList = List.newBuilder[String] if (flags.is(Flags.Private)) flagList += "private" if (flags.is(Flags.Protected)) flagList += "protected" @@ -58,7 +58,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig flagList.result().mkString("/*", " ", "*/") } - private class Buffer(given ctx: Context) { + private class Buffer(using ctx: Context) { private[this] val sb: StringBuilder = new StringBuilder @@ -95,7 +95,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig def lineBreak(): String = "\n" + (" " * indent) def doubleLineBreak(): String = "\n\n" + (" " * indent) - def printTree(tree: Tree)(given elideThis: Option[Symbol] = None): Buffer = tree match { + def printTree(tree: Tree)(using elideThis: Option[Symbol] = None): Buffer = tree match { case PackageObject(body)=> printTree(body) // Print package object @@ -570,7 +570,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig (flatStats.result(), flatExpr) } - def printFlatBlock(stats: List[Statement], expr: Term)(given elideThis: Option[Symbol]): Buffer = { + def printFlatBlock(stats: List[Statement], expr: Term)(using elideThis: Option[Symbol]): Buffer = { val (stats1, expr1) = flatBlock(stats, expr) val stats2 = stats1.filter { case tree: TypeDef => !tree.symbol.annots.exists(_.symbol.owner == ctx.requiredClass("scala.internal.Quoted.quoteTypeTag")) @@ -587,7 +587,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } } - def printStats(stats: List[Tree], expr: Tree)(given eliseThis: Option[Symbol]): Unit = { + def printStats(stats: List[Tree], expr: Tree)(using eliseThis: Option[Symbol]): Unit = { def printSeparator(next: Tree): Unit = { // Avoid accidental application of opening `{` on next line with a double break def rec(next: Tree): Unit = next match { @@ -635,13 +635,13 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig this } - def printTrees(trees: List[Tree], sep: String)(given elideThis: Option[Symbol]): Buffer = + def printTrees(trees: List[Tree], sep: String)(using elideThis: Option[Symbol]): Buffer = printList(trees, sep, (t: Tree) => printTree(t)) - def printTypeTrees(trees: List[TypeTree], sep: String)(given elideThis: Option[Symbol] = None): Buffer = + def printTypeTrees(trees: List[TypeTree], sep: String)(using elideThis: Option[Symbol] = None): Buffer = printList(trees, sep, (t: TypeTree) => printTypeTree(t)) - def printTypes(trees: List[Type], sep: String)(given elideThis: Option[Symbol]): Buffer = { + def printTypes(trees: List[Type], sep: String)(using elideThis: Option[Symbol]): Buffer = { def printSeparated(list: List[Type]): Unit = list match { case Nil => case x :: Nil => printType(x) @@ -707,7 +707,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig this } - def printTypesOrBounds(types: List[TypeOrBounds], sep: String)(given elideThis: Option[Symbol]): Buffer = { + def printTypesOrBounds(types: List[TypeOrBounds], sep: String)(using elideThis: Option[Symbol]): Buffer = { def printSeparated(list: List[TypeOrBounds]): Unit = list match { case Nil => case x :: Nil => printTypeOrBound(x) @@ -720,7 +720,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig this } - def printTargsDefs(targs: List[(TypeDef, TypeDef)], isDef:Boolean = true)(given elideThis: Option[Symbol]): Unit = { + def printTargsDefs(targs: List[(TypeDef, TypeDef)], isDef:Boolean = true)(using elideThis: Option[Symbol]): Unit = { if (!targs.isEmpty) { def printSeparated(list: List[(TypeDef, TypeDef)]): Unit = list match { case Nil => @@ -735,7 +735,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } } - def printTargDef(arg: (TypeDef, TypeDef), isMember: Boolean = false, isDef:Boolean = true)(given elideThis: Option[Symbol]): Buffer = { + def printTargDef(arg: (TypeDef, TypeDef), isMember: Boolean = false, isDef:Boolean = true)(using elideThis: Option[Symbol]): Buffer = { val (argDef, argCons) = arg if (isDef) { @@ -785,7 +785,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } } - def printArgsDefs(args: List[ValDef])(given elideThis: Option[Symbol]): Unit = { + def printArgsDefs(args: List[ValDef])(using elideThis: Option[Symbol]): Unit = { val argFlags = args match { case Nil => Flags.EmptyFlags case arg :: _ => arg.symbol.flags @@ -811,7 +811,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } } - def printAnnotations(trees: List[Term])(given elideThis: Option[Symbol]): Buffer = { + def printAnnotations(trees: List[Term])(using elideThis: Option[Symbol]): Buffer = { def printSeparated(list: List[Term]): Unit = list match { case Nil => case x :: Nil => printAnnotation(x) @@ -824,7 +824,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig this } - def printParamDef(arg: ValDef)(given elideThis: Option[Symbol]): Unit = { + def printParamDef(arg: ValDef)(using elideThis: Option[Symbol]): Unit = { val name = arg.name val sym = arg.symbol.owner if sym.isDefDef && sym.name == "" then @@ -943,7 +943,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig inSquare(printType(v)) } - def printTypeOrBoundsTree(tpt: Tree)(given elideThis: Option[Symbol] = None): Buffer = tpt match { + def printTypeOrBoundsTree(tpt: Tree)(using elideThis: Option[Symbol] = None): Buffer = tpt match { case TypeBoundsTree(lo, hi) => this += "_ >: " printTypeTree(lo) @@ -963,7 +963,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig * Self type annotation and types in parent list should elide current class * prefix `C.this` to avoid type checking errors. */ - def printTypeTree(tree: TypeTree)(given elideThis: Option[Symbol] = None): Buffer = tree match { + def printTypeTree(tree: TypeTree)(using elideThis: Option[Symbol] = None): Buffer = tree match { case Inferred() => // TODO try to move this logic into `printType` def printTypeAndAnnots(tpe: Type): Buffer = tpe match { @@ -1049,7 +1049,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } - def printTypeOrBound(tpe: TypeOrBounds)(given elideThis: Option[Symbol]): Buffer = tpe match { + def printTypeOrBound(tpe: TypeOrBounds)(using elideThis: Option[Symbol]): Buffer = tpe match { case tpe@TypeBounds(lo, hi) => this += "_ >: " printType(lo) @@ -1066,7 +1066,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig * Self type annotation and types in parent list should elide current class * prefix `C.this` to avoid type checking errors. */ - def printType(tpe: Type)(given elideThis: Option[Symbol] = None): Buffer = tpe match { + def printType(tpe: Type)(using elideThis: Option[Symbol] = None): Buffer = tpe match { case ConstantType(const) => printConstant(const) @@ -1226,7 +1226,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig case PackageDef(name, _) => this += highlightTypeDef(name) } - def printAnnotation(annot: Term)(given elideThis: Option[Symbol]): Buffer = { + def printAnnotation(annot: Term)(using elideThis: Option[Symbol]): Buffer = { val Annotation(ref, args) = annot if (annot.symbol.maybeOwner == ctx.requiredClass("scala.internal.quoted.showName")) this else { @@ -1239,7 +1239,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } } - def printDefAnnotations(definition: Definition)(given elideThis: Option[Symbol]): Buffer = { + def printDefAnnotations(definition: Definition)(using elideThis: Option[Symbol]): Buffer = { val annots = definition.symbol.annots.filter { case Annotation(annot, _) => val sym = annot.tpe.typeSymbol @@ -1252,7 +1252,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig else this } - def printRefinement(tpe: Type)(given elideThis: Option[Symbol]): Buffer = { + def printRefinement(tpe: Type)(using elideThis: Option[Symbol]): Buffer = { def printMethodicType(tp: TypeOrBounds): Unit = tp match { case tp @ MethodType(paramNames, params, res) => inParens(printMethodicTypeParams(paramNames, params)) @@ -1292,7 +1292,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig this += lineBreak() += "}" } - def printMethodicTypeParams(paramNames: List[String], params: List[TypeOrBounds])(given elideThis: Option[Symbol]): Unit = { + def printMethodicTypeParams(paramNames: List[String], params: List[TypeOrBounds])(using elideThis: Option[Symbol]): Unit = { def printInfo(info: TypeOrBounds) = info match { case info: TypeBounds => printBounds(info) case info: Type => @@ -1313,7 +1313,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig printSeparated(paramNames.zip(params)) } - def printBoundsTree(bounds: TypeBoundsTree)(given elideThis: Option[Symbol]): Buffer = { + def printBoundsTree(bounds: TypeBoundsTree)(using elideThis: Option[Symbol]): Buffer = { bounds.low match { case Inferred() => case low => @@ -1328,7 +1328,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } } - def printBounds(bounds: TypeBounds)(given elideThis: Option[Symbol]): Buffer = { + def printBounds(bounds: TypeBounds)(using elideThis: Option[Symbol]): Buffer = { this += " >: " printType(bounds.low) this += " <: " @@ -1400,7 +1400,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig private def escapedString(str: String): String = str flatMap escapedChar } - private def splicedName(sym: Symbol)(given ctx: Context): Option[String] = { + private def splicedName(sym: Symbol)(using ctx: Context): Option[String] = { sym.annots.find(_.symbol.owner == ctx.requiredClass("scala.internal.quoted.showName")).flatMap { case Apply(_, Literal(Constant(c: String)) :: Nil) => Some(c) case Apply(_, Inlined(_, _, Literal(Constant(c: String))) :: Nil) => Some(c) @@ -1409,7 +1409,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } private object SpecialOp { - def unapply(arg: Tree)(given ctx: Context): Option[(String, List[Term])] = arg match { + def unapply(arg: Tree)(using ctx: Context): Option[(String, List[Term])] = arg match { case arg @ Apply(fn, args) => fn.tpe match { case tpe @ TermRef(ThisType(TypeRef(_, name)), name2) if name == "" => @@ -1421,7 +1421,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } private object Annotation { - def unapply(arg: Tree)(given ctx: Context): Option[(TypeTree, List[Term])] = arg match { + def unapply(arg: Tree)(using ctx: Context): Option[(TypeTree, List[Term])] = arg match { case New(annot) => Some((annot, Nil)) case Apply(Select(New(annot), ""), args) => Some((annot, args)) case Apply(TypeApply(Select(New(annot), ""), targs), args) => Some((annot, args)) @@ -1433,14 +1433,14 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig private object Types { object Sequence { - def unapply(tpe: Type)(given ctx: Context): Option[Type] = tpe match { + def unapply(tpe: Type)(using ctx: Context): Option[Type] = tpe match { case AppliedType(seq, (tp: Type) :: Nil) if seq.typeSymbol == ctx.requiredClass("scala.collection.Seq") => Some(tp) case _ => None } } object Repeated { - def unapply(tpe: Type)(given ctx: Context): Option[Type] = tpe match { + def unapply(tpe: Type)(using ctx: Context): Option[Type] = tpe match { case AppliedType(rep, (tp: Type) :: Nil) if rep.typeSymbol == ctx.requiredClass("scala.") => Some(tp) case _ => None } @@ -1449,7 +1449,7 @@ class SourceCodePrinter[R <: Reflection & Singleton](val tasty: R)(syntaxHighlig } object PackageObject { - def unapply(tree: Tree)(given ctx: Context): Option[Tree] = tree match { + def unapply(tree: Tree)(using ctx: Context): Option[Tree] = tree match { case PackageClause(_, ValDef("package", _, _) :: body :: Nil) => Some(body) case _ => None }