Skip to content

Commit ddb8d0f

Browse files
committed
Rename: SymDenotations.isStable -> isStableMember
1 parent 4fc5e25 commit ddb8d0f

File tree

10 files changed

+15
-15
lines changed

10 files changed

+15
-15
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
400400
def isKnownPureOp(sym: Symbol) =
401401
sym.owner.isPrimitiveValueClass || sym.owner == defn.StringClass
402402
if (tree.tpe.isInstanceOf[ConstantType] && isKnownPureOp(tree.symbol) // A constant expression with pure arguments is pure.
403-
|| (fn.symbol.isStable && !fn.symbol.is(Lazy))
403+
|| (fn.symbol.isStableMember && !fn.symbol.is(Lazy))
404404
|| fn.symbol.isPrimaryConstructor && fn.symbol.owner.isNoInitsClass) // TODO: include in isStable?
405405
minOf(exprPurity(fn), args.map(exprPurity)) `min` Pure
406406
else if (fn.symbol.is(Erased)) Pure
407-
else if (fn.symbol.isStable /* && fn.symbol.is(Lazy) */)
407+
else if (fn.symbol.isStableMember /* && fn.symbol.is(Lazy) */)
408408
minOf(exprPurity(fn), args.map(exprPurity)) `min` Idempotent
409409
else Impure
410410
case Typed(expr, _) =>
@@ -439,7 +439,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
439439
val sym = tree.symbol
440440
if (!tree.hasType) Impure
441441
else if (!tree.tpe.widen.isParameterless || sym.isEffectivelyErased) SimplyPure
442-
else if (!sym.isStable) Impure
442+
else if (!sym.isStableMember) Impure
443443
else if (sym.is(Module))
444444
if (sym.moduleClass.isNoInitsClass) Pure else Idempotent
445445
else if (sym.is(Lazy)) Idempotent
@@ -521,7 +521,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
521521
case tpe: PolyType => maybeGetterType(tpe.resultType)
522522
case _ => false
523523
}
524-
sym.owner.isClass && !sym.isStable && maybeGetterType(sym.info)
524+
sym.owner.isClass && !sym.isStableMember && maybeGetterType(sym.info)
525525
}
526526

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

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class CheckRealizable(implicit ctx: Context) {
7272
if (sym.is(StableRealizable)) realizability(tp.prefix)
7373
else {
7474
val r =
75-
if (sym.isStable && !isLateInitialized(sym))
75+
if (sym.isStableMember && !isLateInitialized(sym))
7676
// it's realizable because we know that a value of type `tp` has been created at run-time
7777
Realizable
7878
else if (!sym.isEffectivelyFinal)
@@ -83,7 +83,7 @@ class CheckRealizable(implicit ctx: Context) {
8383
// roughly: it's realizable if the info does not have bad bounds
8484
tpInfoRealizable.mapError(r => new ProblemInUnderlying(tp, r))
8585
r andAlso {
86-
if (sym.isStable) sym.setFlag(StableRealizable) // it's known to be stable and realizable
86+
if (sym.isStableMember) sym.setFlag(StableRealizable) // it's known to be stable and realizable
8787
realizability(tp.prefix)
8888
} mapError { r =>
8989
if (tp.info.isStable && tpInfoRealizable == Realizable) Realizable else r

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ object SymDenotations {
609609
)
610610

611611
/** Is this a denotation of a stable term (or an arbitrary type)? */
612-
final def isStable(implicit ctx: Context): Boolean = {
612+
final def isStableMember(implicit ctx: Context): Boolean = {
613613
def isUnstableValue = is(UnstableValue) || info.isInstanceOf[ExprType]
614614
isType || is(StableRealizable) || !isUnstableValue
615615
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ object Types {
149149

150150
/** Does this type denote a stable reference (i.e. singleton type)? */
151151
final def isStable(implicit ctx: Context): Boolean = stripTypeVar match {
152-
case tp: TermRef => tp.symbol.isStable && tp.prefix.isStable || tp.info.isStable
152+
case tp: TermRef => tp.symbol.isStableMember && tp.prefix.isStable || tp.info.isStable
153153
case _: SingletonType | NoPrefix => true
154154
case tp: RefinedOrRecType => tp.parent.isStable
155155
case tp: ExprType => tp.resultType.isStable
@@ -1005,7 +1005,7 @@ object Types {
10051005
/** Widen type if it is unstable (i.e. an ExprType, or TermRef to unstable symbol */
10061006
final def widenIfUnstable(implicit ctx: Context): Type = stripTypeVar match {
10071007
case tp: ExprType => tp.resultType.widenIfUnstable
1008-
case tp: TermRef if !tp.symbol.isStable => tp.underlying.widenIfUnstable
1008+
case tp: TermRef if !tp.symbol.isStableMember => tp.underlying.widenIfUnstable
10091009
case _ => this
10101010
}
10111011

compiler/src/dotty/tools/dotc/interactive/Completion.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ object Completion {
260260
!sym.is(Artifact) &&
261261
(
262262
(mode.is(Mode.Term) && sym.isTerm)
263-
|| (mode.is(Mode.Type) && (sym.isType || sym.isStable))
263+
|| (mode.is(Mode.Type) && (sym.isType || sym.isStableMember))
264264
)
265265

266266
/**

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
328328
} else if (sym.is(Mutable, butNot = Accessor)) {
329329
api.Var.of(sym.name.toString, apiAccess(sym), apiModifiers(sym),
330330
apiAnnotations(sym).toArray, apiType(sym.info))
331-
} else if (sym.isStable && !sym.isRealMethod) {
331+
} else if (sym.isStableMember && !sym.isRealMethod) {
332332
api.Val.of(sym.name.toString, apiAccess(sym), apiModifiers(sym),
333333
apiAnnotations(sym).toArray, apiType(sym.info))
334334
} else {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Getters extends MiniPhase with SymTransformer {
6161

6262
var d1 =
6363
if (d.isTerm && (d.is(Lazy) || d.owner.isClass) && d.info.isValueType && !noGetterNeeded) {
64-
val maybeStable = if (d.isStable) StableRealizable else EmptyFlags
64+
val maybeStable = if (d.isStableMember) StableRealizable else EmptyFlags
6565
d.copySymDenotation(
6666
initFlags = d.flags | maybeStable | AccessorCreationFlags,
6767
info = ExprType(d.info))

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
913913
case tpe: NamedType if tpe.symbol.exists && !tpe.symbol.isAccessibleFrom(tpe.prefix, superAccess) =>
914914
tpe.info match {
915915
case TypeAlias(alias) => return ensureAccessible(alias, superAccess, pos)
916-
case info: ConstantType if tpe.symbol.isStable => return info
916+
case info: ConstantType if tpe.symbol.isStableMember => return info
917917
case _ =>
918918
}
919919
case _ =>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ object PrepareInlineable {
5959
sym.isTerm &&
6060
(sym.is(AccessFlags) || sym.privateWithin.exists) &&
6161
!sym.isContainedIn(inlineSym) &&
62-
!(sym.isStable && sym.info.widenTermRefExpr.isInstanceOf[ConstantType]) &&
62+
!(sym.isStableMember && sym.info.widenTermRefExpr.isInstanceOf[ConstantType]) &&
6363
!sym.isInlineMethod
6464

6565
def preTransform(tree: Tree)(implicit ctx: Context): Tree

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ object RefChecks {
382382
intersectionIsEmpty(member.extendedOverriddenSymbols, other.extendedOverriddenSymbols)) {
383383
overrideError("cannot override a concrete member without a third member that's overridden by both " +
384384
"(this rule is designed to prevent ``accidental overrides'')")
385-
} else if (other.isStable && !member.isStable) { // (1.4)
385+
} else if (other.isStableMember && !member.isStableMember) { // (1.4)
386386
overrideError("needs to be a stable, immutable value")
387387
} else if (member.is(ModuleVal) && !other.isRealMethod && !other.is(Deferred | Lazy)) {
388388
overrideError("may not override a concrete non-lazy value")

0 commit comments

Comments
 (0)