Skip to content

Commit bdfdc24

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

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
@@ -399,7 +399,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
399399
*/
400400
private def refPurity(tree: Tree)(implicit ctx: Context): PurityLevel =
401401
if (!tree.tpe.widen.isParameterless || tree.symbol.is(Erased)) SimplyPure
402-
else if (!tree.symbol.isStable) Impure
402+
else if (!tree.symbol.isStableMember) Impure
403403
else if (tree.symbol.is(Lazy)) Idempotent // TODO add Module flag, sinxce Module vals or not Lazy from the start.
404404
else SimplyPure
405405

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

468468
/** 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
@@ -599,7 +599,7 @@ object SymDenotations {
599599
)
600600

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

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

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

149149
/** Does this type denote a stable reference (i.e. singleton type)? */
150150
final def isStable(implicit ctx: Context): Boolean = stripTypeVar match {
151-
case tp: TermRef => tp.termSymbol.isStable && tp.prefix.isStable || tp.info.isStable
151+
case tp: TermRef => tp.termSymbol.isStableMember && tp.prefix.isStable || tp.info.isStable
152152
case _: SingletonType | NoPrefix => true
153153
case tp: RefinedOrRecType => tp.parent.isStable
154154
case tp: ExprType => tp.resultType.isStable
@@ -960,7 +960,7 @@ object Types {
960960
/** Widen type if it is unstable (i.e. an ExprType, or TermRef to unstable symbol */
961961
final def widenIfUnstable(implicit ctx: Context): Type = stripTypeVar match {
962962
case tp: ExprType => tp.resultType.widenIfUnstable
963-
case tp: TermRef if !tp.symbol.isStable => tp.underlying.widenIfUnstable
963+
case tp: TermRef if !tp.symbol.isStableMember => tp.underlying.widenIfUnstable
964964
case _ => this
965965
}
966966

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
278278
} else if (sym.is(Mutable, butNot = Accessor)) {
279279
new api.Var(apiType(sym.info), sym.name.toString,
280280
apiAccess(sym), apiModifiers(sym), apiAnnotations(sym).toArray)
281-
} else if (sym.isStable) {
281+
} else if (sym.isStableMember) {
282282
new api.Val(apiType(sym.info), sym.name.toString,
283283
apiAccess(sym), apiModifiers(sym), apiAnnotations(sym).toArray)
284284
} 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
@@ -367,7 +367,7 @@ object RefChecks {
367367
intersectionIsEmpty(member.extendedOverriddenSymbols, other.extendedOverriddenSymbols)) {
368368
overrideError("cannot override a concrete member without a third member that's overridden by both " +
369369
"(this rule is designed to prevent ``accidental overrides'')")
370-
} else if (other.isStable && !member.isStable) { // (1.4)
370+
} else if (other.isStableMember && !member.isStableMember) { // (1.4)
371371
overrideError("needs to be a stable, immutable value")
372372
} else if (member.is(ModuleVal) && !other.isRealMethod && !other.is(Deferred | Lazy)) {
373373
overrideError("may not override a concrete non-lazy value")

0 commit comments

Comments
 (0)