Skip to content

Commit 8fd7268

Browse files
committed
Rename SymDenotation.isStable to SymDenotation.isStableMember
This reduces confusion with `Type.isStable`. I'm tempted to call this `isPure`.
1 parent 1fe1e12 commit 8fd7268

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
400400
*/
401401
def refPurity(tree: Tree)(implicit ctx: Context): PurityLevel =
402402
if (!tree.tpe.widen.isParameterless || tree.symbol.is(Erased)) SimplyPure
403-
else if (!tree.symbol.isStable) Impure
403+
else if (!tree.symbol.isStableMember) Impure
404404
else if (tree.symbol.is(Lazy)) Idempotent // TODO add Module flag, sinxce Module vals or not Lazy from the start.
405405
else SimplyPure
406406

@@ -463,7 +463,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
463463
case tpe: PolyType => maybeGetterType(tpe.resultType)
464464
case _ => false
465465
}
466-
sym.owner.isClass && !sym.isStable && maybeGetterType(sym.info)
466+
sym.owner.isClass && !sym.isStableMember && maybeGetterType(sym.info)
467467
}
468468

469469
/** Is tree a reference to a mutable variable, or to a potential getter

compiler/src/dotty/tools/dotc/core/CheckRealizable.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class CheckRealizable(implicit ctx: Context) {
8686
r.mapError(if (tp.info.isStableRealizable) Realizable else _)
8787
val r =
8888
// Reject fields that are mutable, by-name, and similar.
89-
if (!sym.isStable)
89+
if (!sym.isStableMember)
9090
patchRealizability(NotStable)
9191
// 3. If the symbol isn't "lazy" and its prefix is realizable
9292
else if (!isLateInitialized(sym)) {

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ object SymDenotations {
600600
)
601601

602602
/** Is this a denotation of a stable term (or an arbitrary type)? */
603-
final def isStable(implicit ctx: Context) = {
603+
final def isStableMember(implicit ctx: Context) = {
604604
def isUnstableValue = is(UnstableValue) || info.isInstanceOf[ExprType]
605605
isType || is(Stable) || !isUnstableValue
606606
}

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ object Types {
151151

152152
/** Does this type denote a stable reference (i.e. singleton type)? */
153153
final def isStable(implicit ctx: Context): Boolean = stripTypeVar match {
154-
case tp: TermRef => tp.termSymbol.isStable && tp.prefix.isStable || tp.info.isStable
154+
case tp: TermRef => tp.termSymbol.isStableMember && tp.prefix.isStable || tp.info.isStable
155155
case _: SingletonType | NoPrefix => true
156156
case tp: RefinedOrRecType => tp.parent.isStable
157157
case tp: ExprType => tp.resultType.isStable
@@ -975,7 +975,7 @@ object Types {
975975
/** Widen type if it is unstable (i.e. an ExprType, or TermRef to unstable symbol */
976976
final def widenIfUnstable(implicit ctx: Context): Type = stripTypeVar match {
977977
case tp: ExprType => tp.resultType.widenIfUnstable
978-
case tp: TermRef if !tp.symbol.isStable => tp.underlying.widenIfUnstable
978+
case tp: TermRef if !tp.symbol.isStableMember => tp.underlying.widenIfUnstable
979979
case _ => this
980980
}
981981

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
329329
} else if (sym.is(Mutable, butNot = Accessor)) {
330330
api.Var.of(sym.name.toString, apiAccess(sym), apiModifiers(sym),
331331
apiAnnotations(sym).toArray, apiType(sym.info))
332-
} else if (sym.isStable) {
332+
} else if (sym.isStableMember) {
333333
api.Val.of(sym.name.toString, apiAccess(sym), apiModifiers(sym),
334334
apiAnnotations(sym).toArray, apiType(sym.info))
335335
} else {

compiler/src/dotty/tools/dotc/transform/Getters.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Getters extends MiniPhase with SymTransformer {
5959
d.hasAnnotation(defn.ScalaStaticAnnot) ||
6060
d.isSelfSym
6161
if (d.isTerm && (d.is(Lazy) || d.owner.isClass) && d.info.isValueType && !noGetterNeeded) {
62-
val maybeStable = if (d.isStable) Stable else EmptyFlags
62+
val maybeStable = if (d.isStableMember) Stable else EmptyFlags
6363
d.copySymDenotation(
6464
initFlags = d.flags | maybeStable | AccessorCreationFlags,
6565
info = ExprType(d.info))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ object RefChecks {
366366
intersectionIsEmpty(member.extendedOverriddenSymbols, other.extendedOverriddenSymbols)) {
367367
overrideError("cannot override a concrete member without a third member that's overridden by both " +
368368
"(this rule is designed to prevent ``accidental overrides'')")
369-
} else if (other.isStable && !member.isStable) { // (1.4)
369+
} else if (other.isStableMember && !member.isStableMember) { // (1.4)
370370
overrideError("needs to be a stable, immutable value")
371371
} else if (member.is(ModuleVal) && !other.isRealMethod && !other.is(Deferred | Lazy)) {
372372
overrideError("may not override a concrete non-lazy value")

0 commit comments

Comments
 (0)