Skip to content

Commit 0723400

Browse files
committed
Fix typo
1 parent 78c58a0 commit 0723400

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)