Skip to content

Commit cf65da9

Browse files
committed
Clean up logic for isStable
1 parent a7c6ff7 commit cf65da9

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,10 @@ object Flags {
474474
assert(AfterLoadFlags.isTermFlags && AfterLoadFlags.isTypeFlags)
475475

476476
/** A value that's unstable unless complemented with a Stable flag */
477-
final val UnstableValue = Mutable | Method
477+
final val UnstableValue =
478+
Mutable | Method | Erased
479+
// TODO: Erased should be treated as stable just like final lazy is.
480+
// Otherwise the usefulness of Erased is very much reduced.
478481

479482
/** Flags that express the variance of a type parameter. */
480483
final val VarianceFlags = Covariant | Contravariant

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,10 @@ object SymDenotations {
599599
)
600600

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

605607
/** Is this a "real" method? A real method is a method which is:
606608
* - not an accessor

0 commit comments

Comments
 (0)