Skip to content

Commit b1908a0

Browse files
committed
Address reviewers comments
1 parent 52d4a14 commit b1908a0

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
330330
}
331331

332332
/** The purity level of this expression.
333-
* @return PurePath if expression has no side effects and cannot contain local definitions
333+
* @return SimplyPure if expression has no side effects and cannot contain local definitions
334334
* Pure if expression has no side effects
335335
* Idempotent if running the expression a second time has no side effects
336336
* Impure otherwise
@@ -346,7 +346,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
346346
| Super(_, _)
347347
| Literal(_)
348348
| Closure(_, _, _) =>
349-
PurePath
349+
SimplyPure
350350
case Ident(_) =>
351351
refPurity(tree)
352352
case Select(qual, _) =>
@@ -383,26 +383,26 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
383383

384384
private def minOf(l0: PurityLevel, ls: List[PurityLevel]) = (l0 /: ls)(_ min _)
385385

386-
def isPurePath(tree: Tree)(implicit ctx: Context) = exprPurity(tree) == PurePath
386+
def isSimplyPure(tree: Tree)(implicit ctx: Context) = exprPurity(tree) == SimplyPure
387387
def isPureExpr(tree: Tree)(implicit ctx: Context) = exprPurity(tree) >= Pure
388388
def isIdempotentExpr(tree: Tree)(implicit ctx: Context) = exprPurity(tree) >= Idempotent
389389

390390
/** The purity level of this reference.
391391
* @return
392-
* PurePath if reference is (nonlazy and stable) or to a parameterized function
392+
* SimplyPure if reference is (nonlazy and stable) or to a parameterized function
393393
* Idempotent if reference is lazy and stable
394394
* Impure otherwise
395395
* @DarkDimius: need to make sure that lazy accessor methods have Lazy and Stable
396396
* flags set.
397397
*/
398398
private def refPurity(tree: Tree)(implicit ctx: Context): PurityLevel =
399-
if (!tree.tpe.widen.isParameterless) PurePath
399+
if (!tree.tpe.widen.isParameterless) SimplyPure
400400
else if (!tree.symbol.isStable) Impure
401401
else if (tree.symbol.is(Lazy)) Idempotent // TODO add Module flag, sinxce Module vals or not Lazy from the start.
402-
else PurePath
402+
else SimplyPure
403403

404404
def isPureRef(tree: Tree)(implicit ctx: Context) =
405-
refPurity(tree) == PurePath
405+
refPurity(tree) == SimplyPure
406406
def isIdempotentRef(tree: Tree)(implicit ctx: Context) =
407407
refPurity(tree) >= Idempotent
408408

@@ -726,7 +726,7 @@ object TreeInfo {
726726
def min(that: PurityLevel) = new PurityLevel(x min that.x)
727727
}
728728

729-
val PurePath = new PurityLevel(3)
729+
val SimplyPure = new PurityLevel(3)
730730
val Pure = new PurityLevel(2)
731731
val Idempotent = new PurityLevel(1)
732732
val Impure = new PurityLevel(0)

compiler/src/dotty/tools/dotc/typer/EtaExpansion.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class Lifter {
3333
/** Test indicating `expr` does not need lifting */
3434
def noLift(expr: Tree)(implicit ctx: Context): Boolean
3535

36-
/** The corresponding lifter for paam-by-name arguments */
36+
/** The corresponding lifter for pass-by-name arguments */
3737
protected def exprLifter: Lifter = NoLift
3838

3939
/** The flags of a lifted definition */
@@ -144,7 +144,7 @@ object LiftImpure extends LiftImpure
144144

145145
/** Lift all impure or complex arguments */
146146
class LiftComplex extends Lifter {
147-
def noLift(expr: tpd.Tree)(implicit ctx: Context) = tpd.isPurePath(expr)
147+
def noLift(expr: tpd.Tree)(implicit ctx: Context) = tpd.isSimplyPure(expr)
148148
override def exprLifter = LiftToDefs
149149
}
150150
object LiftComplex extends LiftComplex

0 commit comments

Comments
 (0)