Skip to content

Commit b0b409e

Browse files
committed
Move scala2Mode test from isStable to isRealizable
This prepares the way for using isRealizable in different contexts.
1 parent 6fc3bd6 commit b0b409e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,7 @@ object SymDenotations {
522522
final def isStable(implicit ctx: Context) = {
523523
val isUnstable =
524524
(this is UnstableValue) ||
525-
is(Lazy, butNot = Module) &&
526-
!(info.isRealizable || ctx.scala2Mode) &&
527-
!hasAnnotation(defn.UncheckedStableAnnot)
525+
is(Lazy, butNot = Module) && !info.isRealizable && !hasAnnotation(defn.UncheckedStableAnnot)
528526
(this is Stable) || isType || {
529527
if (isUnstable) false
530528
else { setFlag(Stable); true }

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ object Types {
138138
case tp: AndOrType => isConcrete(tp.tp1) && isConcrete(tp.tp2)
139139
case _ => false
140140
}
141-
isConcrete(tp) && tp.abstractTypeMembers.forall { m =>
141+
isConcrete(tp) &&
142+
tp.abstractTypeMembers.forall { m =>
142143
val bounds = m.info.bounds
143144
bounds.lo <:< bounds.hi
144-
}
145+
} ||
146+
ctx.scala2Mode
145147
}
146148

147149
/** Does this type refer exactly to class symbol `sym`, instead of to a subclass of `sym`?

0 commit comments

Comments
 (0)