File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -243,8 +243,8 @@ object Types {
243243 // then the OrType derivesFrom the class. Otherwise, we need to check both sides
244244 // derivesFrom the class.
245245 loop(tp.tp1) && loop(tp.tp2)
246- || tp.tp1.isNullType && loop(tp.tp2)
247- || tp.tp2.isNullType && loop(tp.tp2 )
246+ || tp.tp1.isNullOrNothingType && loop(tp.tp2)
247+ || tp.tp2.isNullOrNothingType && loop(tp.tp1 )
248248 case tp : JavaArrayType =>
249249 cls == defn.ObjectClass
250250 case _ =>
@@ -1534,6 +1534,9 @@ object Types {
15341534 /** Is this (an alias of) the `scala.Null` type? */
15351535 final def isNullType (using Context ) = isRef(defn.NullClass )
15361536
1537+ /** Is this (an alias of) the `scala.Null` or `scala.Nothing` type? */
1538+ final def isNullOrNothingType (using Context ) = isNullType || isRef(defn.NothingClass )
1539+
15371540 /** The resultType of a LambdaType, or ExprType, the type itself for others */
15381541 def resultType (using Context ): Type = this
15391542
You can’t perform that action at this time.
0 commit comments