Skip to content

Commit 7d012f9

Browse files
committed
Use SafeNulls for isSubClass
1 parent 530ffb7 commit 7d012f9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

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

+8-6
Original file line numberDiff line numberDiff line change
@@ -1824,12 +1824,14 @@ object SymDenotations {
18241824
)
18251825

18261826
final override def isSubClass(base: Symbol)(using Context): Boolean =
1827-
derivesFrom(base) ||
1828-
base.isClass && (
1829-
(symbol eq defn.NothingClass) ||
1830-
(!ctx.explicitNulls || ctx.phase.erasedTypes)
1831-
&& (symbol eq defn.NullClass)
1832-
&& (base ne defn.NothingClass))
1827+
derivesFrom(base)
1828+
|| base.isClass
1829+
&& (
1830+
(symbol eq defn.NothingClass)
1831+
|| (symbol eq defn.NullClass)
1832+
&& (!ctx.mode.is(Mode.SafeNulls) || ctx.phase.erasedTypes)
1833+
&& (base ne defn.NothingClass)
1834+
)
18331835

18341836
/** Is it possible that a class inherits both `this` and `that`?
18351837
*

0 commit comments

Comments
 (0)