@@ -330,24 +330,15 @@ class SpaceEngine(using Context) extends SpaceLogic {
330330
331331 private val constantNullType = ConstantType (Constant (null ))
332332
333- /** Does the given tree stand for the literal `null`? */
334- def isNullLit (tree : Tree ): Boolean = tree match {
335- case Literal (Constant (null )) => true
336- case _ => false
337- }
338-
339333 override def intersectUnrelatedAtomicTypes (tp1 : Type , tp2 : Type ): Space = trace(s " atomic intersection: ${AndType (tp1, tp2).show}" , debug) {
340334 // Precondition: !isSubType(tp1, tp2) && !isSubType(tp2, tp1).
341- if ( ! ctx.explicitNulls && (tp1.isNullType || tp2.isNullType)) {
335+ if ! ctx.mode.is( Mode . SafeNulls ) && (tp1.isNullType || tp2.isNullType) then
342336 // Since projections of types don't include null, intersection with null is empty.
343337 Empty
344- }
345- else {
338+ else
346339 val res = TypeComparer .provablyDisjoint(tp1, tp2)
347-
348- if (res) Empty
340+ if res then Empty
349341 else Typ (AndType (tp1, tp2), decomposed = true )
350- }
351342 }
352343
353344 /** Return the space that represents the pattern `pat` */
@@ -549,7 +540,8 @@ class SpaceEngine(using Context) extends SpaceLogic {
549540
550541 /** Is `tp1` a subtype of `tp2`? */
551542 def isSubType (tp1 : Type , tp2 : Type ): Boolean = trace(i " $tp1 <:< $tp2" , debug, show = true ) {
552- if tp1 == constantNullType && ! ctx.explicitNulls then tp2 == constantNullType
543+ if tp1 == constantNullType && ! ctx.mode.is(Mode .SafeNulls )
544+ then tp2 == constantNullType
553545 else adaptType(tp1, tp2) <:< tp2
554546 }
555547
0 commit comments