We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 73bfead + 7c77611 commit b44cafaCopy full SHA for b44cafa
compiler/src/dotty/tools/dotc/core/Types.scala
@@ -237,7 +237,7 @@ object Types {
237
}
238
239
def isBottomType(using Context): Boolean =
240
- if ctx.explicitNulls && !ctx.phase.erasedTypes then hasClassSymbol(defn.NothingClass)
+ if ctx.mode.is(Mode.SafeNulls) && !ctx.phase.erasedTypes then hasClassSymbol(defn.NothingClass)
241
else isBottomTypeAfterErasure
242
243
def isBottomTypeAfterErasure(using Context): Boolean =
tests/explicit-nulls/unsafe-common/unsafe-select-type-member.scala
@@ -0,0 +1,7 @@
1
+import java.util.ArrayList
2
+
3
+def f[T]: ArrayList[T] = {
4
+ val cz = Class.forName("java.util.ArrayList")
5
+ val o = cz.newInstance() // error: T of Class[?] | Null
6
+ o.asInstanceOf[ArrayList[T]]
7
+}
0 commit comments