@@ -29,7 +29,7 @@ abstract class Lifter {
29
29
import tpd ._
30
30
31
31
/** Test indicating `expr` does not need lifting */
32
- def noLift (expr : Tree )(implicit ctx : Context ): Boolean
32
+ def noLift (expr : Tree )(using Context ): Boolean
33
33
34
34
/** The corresponding lifter for pass-by-name arguments */
35
35
protected def exprLifter : Lifter = NoLift
@@ -38,12 +38,12 @@ abstract class Lifter {
38
38
protected def liftedFlags : FlagSet = EmptyFlags
39
39
40
40
/** The tree of a lifted definition */
41
- protected def liftedDef (sym : TermSymbol , rhs : Tree )(implicit ctx : Context ): MemberDef = ValDef (sym, rhs)
41
+ protected def liftedDef (sym : TermSymbol , rhs : Tree )(using Context ): MemberDef = ValDef (sym, rhs)
42
42
43
43
/** Is lifting performed on erased terms? */
44
44
protected def isErased = false
45
45
46
- private def lift (defs : mutable.ListBuffer [Tree ], expr : Tree , prefix : TermName = EmptyTermName )(implicit ctx : Context ): Tree =
46
+ private def lift (defs : mutable.ListBuffer [Tree ], expr : Tree , prefix : TermName = EmptyTermName )(using Context ): Tree =
47
47
if (noLift(expr)) expr
48
48
else {
49
49
val name = UniqueName .fresh(prefix)
@@ -62,7 +62,7 @@ abstract class Lifter {
62
62
*
63
63
* lhs += expr
64
64
*/
65
- def liftAssigned (defs : mutable.ListBuffer [Tree ], tree : Tree )(implicit ctx : Context ): Tree = tree match {
65
+ def liftAssigned (defs : mutable.ListBuffer [Tree ], tree : Tree )(using Context ): Tree = tree match {
66
66
case Apply (MaybePoly (fn @ Select (pre, name), targs), args) =>
67
67
cpy.Apply (tree)(
68
68
cpy.Select (fn)(
@@ -75,7 +75,7 @@ abstract class Lifter {
75
75
}
76
76
77
77
/** Lift a function argument, stripping any NamedArg wrapper */
78
- private def liftArg (defs : mutable.ListBuffer [Tree ], arg : Tree , prefix : TermName = EmptyTermName )(implicit ctx : Context ): Tree =
78
+ private def liftArg (defs : mutable.ListBuffer [Tree ], arg : Tree , prefix : TermName = EmptyTermName )(using Context ): Tree =
79
79
arg match {
80
80
case arg @ NamedArg (name, arg1) => cpy.NamedArg (arg)(name, lift(defs, arg1, prefix))
81
81
case arg => lift(defs, arg, prefix)
@@ -84,7 +84,7 @@ abstract class Lifter {
84
84
/** Lift arguments that are not-idempotent into ValDefs in buffer `defs`
85
85
* and replace by the idents of so created ValDefs.
86
86
*/
87
- def liftArgs (defs : mutable.ListBuffer [Tree ], methRef : Type , args : List [Tree ])(implicit ctx : Context ): List [Tree ] =
87
+ def liftArgs (defs : mutable.ListBuffer [Tree ], methRef : Type , args : List [Tree ])(using Context ): List [Tree ] =
88
88
methRef.widen match {
89
89
case mt : MethodType =>
90
90
args.lazyZip(mt.paramNames).lazyZip(mt.paramInfos).map { (arg, name, tp) =>
@@ -108,7 +108,7 @@ abstract class Lifter {
108
108
* But leave pure expressions alone.
109
109
*
110
110
*/
111
- def liftApp (defs : mutable.ListBuffer [Tree ], tree : Tree )(implicit ctx : Context ): Tree = tree match {
111
+ def liftApp (defs : mutable.ListBuffer [Tree ], tree : Tree )(using Context ): Tree = tree match {
112
112
case Apply (fn, args) =>
113
113
val fn1 = liftApp(defs, fn)
114
114
val args1 = liftArgs(defs, fn.tpe, args)
@@ -133,24 +133,24 @@ abstract class Lifter {
133
133
*
134
134
* unless `pre` is idempotent.
135
135
*/
136
- def liftPrefix (defs : mutable.ListBuffer [Tree ], tree : Tree )(implicit ctx : Context ): Tree =
136
+ def liftPrefix (defs : mutable.ListBuffer [Tree ], tree : Tree )(using Context ): Tree =
137
137
if (isIdempotentExpr(tree)) tree else lift(defs, tree)
138
138
}
139
139
140
140
/** No lifting at all */
141
141
object NoLift extends Lifter {
142
- def noLift (expr : tpd.Tree )(implicit ctx : Context ): Boolean = true
142
+ def noLift (expr : tpd.Tree )(using Context ): Boolean = true
143
143
}
144
144
145
145
/** Lift all impure arguments */
146
146
class LiftImpure extends Lifter {
147
- def noLift (expr : tpd.Tree )(implicit ctx : Context ): Boolean = tpd.isPureExpr(expr)
147
+ def noLift (expr : tpd.Tree )(using Context ): Boolean = tpd.isPureExpr(expr)
148
148
}
149
149
object LiftImpure extends LiftImpure
150
150
151
151
/** Lift all impure or complex arguments */
152
152
class LiftComplex extends Lifter {
153
- def noLift (expr : tpd.Tree )(implicit ctx : Context ): Boolean = tpd.isPurePath(expr)
153
+ def noLift (expr : tpd.Tree )(using Context ): Boolean = tpd.isPurePath(expr)
154
154
override def exprLifter : Lifter = LiftToDefs
155
155
}
156
156
object LiftComplex extends LiftComplex
@@ -161,7 +161,7 @@ object LiftErased extends LiftComplex:
161
161
/** Lift all impure or complex arguments to `def`s */
162
162
object LiftToDefs extends LiftComplex {
163
163
override def liftedFlags : FlagSet = Method
164
- override def liftedDef (sym : TermSymbol , rhs : tpd.Tree )(implicit ctx : Context ): tpd.DefDef = tpd.DefDef (sym, rhs)
164
+ override def liftedDef (sym : TermSymbol , rhs : tpd.Tree )(using Context ): tpd.DefDef = tpd.DefDef (sym, rhs)
165
165
}
166
166
167
167
/** Lifter for eta expansion */
@@ -221,7 +221,7 @@ object EtaExpansion extends LiftImpure {
221
221
* be OK. After elimByName they are all converted to regular function types anyway.
222
222
* But see comment on the `ExprType` case in function `prune` in class `ConstraintHandling`.
223
223
*/
224
- def etaExpand (tree : Tree , mt : MethodType , xarity : Int )(implicit ctx : Context ): untpd.Tree = {
224
+ def etaExpand (tree : Tree , mt : MethodType , xarity : Int )(using Context ): untpd.Tree = {
225
225
import untpd ._
226
226
assert(! ctx.isAfterTyper)
227
227
val defs = new mutable.ListBuffer [tpd.Tree ]
0 commit comments