Skip to content

WIP Relax realizability for erased members, treat them like lazy ones #4290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Flags.scala
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,10 @@ object Flags {
assert(AfterLoadFlags.isTermFlags && AfterLoadFlags.isTypeFlags)

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

/** Flags that express the variance of a type parameter. */
final val VarianceFlags = Covariant | Contravariant
Expand Down
6 changes: 4 additions & 2 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,10 @@ object SymDenotations {
)

/** Is this a denotation of a stable term (or an arbitrary type)? */
final def isStable(implicit ctx: Context) =
isType || !is(Erased) && (is(Stable) || !(is(UnstableValue) || info.isInstanceOf[ExprType]))
final def isStable(implicit ctx: Context) = {
def isUnstableValue = is(UnstableValue) || info.isInstanceOf[ExprType]
isType || is(Stable) || !isUnstableValue
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be dropped after changes in #4759, achieves effects similar to cccca68.


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