File tree 1 file changed +13
-1
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ object Types {
175
175
// see: tests/explicit-nulls/pos/flow-stable.scala.disabled
176
176
tp.tp1.isStable && (realizability(tp.tp2) eq Realizable ) ||
177
177
tp.tp2.isStable && (realizability(tp.tp1) eq Realizable )
178
- case AppliedType ( tycon : TypeRef , args) if defn.isCompiletimeAppliedType(tycon.symbol) && args.forall(_.isStable) => true
178
+ case tp : AppliedType => tp.appliedTypeIsStable
179
179
case _ => false
180
180
}
181
181
@@ -4161,11 +4161,23 @@ object Types {
4161
4161
// Boolean caches: 0 = uninitialized, -1 = false, 1 = true
4162
4162
private var myStableHash : Byte = 0
4163
4163
private var myGround : Byte = 0
4164
+ private var myIsStable : Byte = 0
4165
+
4164
4166
4165
4167
def isGround (acc : TypeAccumulator [Boolean ])(using Context ): Boolean =
4166
4168
if myGround == 0 then myGround = if acc.foldOver(true , this ) then 1 else - 1
4167
4169
myGround > 0
4168
4170
4171
+ inline def appliedTypeIsStable (using Context ): Boolean =
4172
+ if myIsStable == 0 then
4173
+ val isStable : Byte = tycon match
4174
+ case tycon : TypeRef if defn.isCompiletimeAppliedType(tycon.symbol) && args.forall(_.isStable) => 1
4175
+ case _ => - 1
4176
+ if ! isProvisional then myIsStable = isStable
4177
+ isStable > 0
4178
+ else
4179
+ myIsStable > 0
4180
+
4169
4181
override def underlying (using Context ): Type = tycon
4170
4182
4171
4183
override def superType (using Context ): Type =
You can’t perform that action at this time.
0 commit comments