@@ -246,15 +246,15 @@ object Erasure extends TypeTestsCasts{
246
246
* e -> unbox(e, PT) otherwise, if `PT` is an erased value type
247
247
* e -> box(e) if `e` is of primitive type and `PT` is not a primitive type
248
248
* e -> unbox(e, PT) if `PT` is a primitive type and `e` is not of primitive type
249
- * e -> cast(e, PT) otherwise
249
+ * e -> cast(e, PT) otherwise, including if `PT` is a bottom type.
250
250
*/
251
251
def adaptToType (tree : Tree , pt : Type )(implicit ctx : Context ): Tree =
252
252
if (pt.isInstanceOf [FunProto ]) tree
253
253
else tree.tpe.widen match {
254
254
case MethodType (Nil , _) if tree.isTerm =>
255
255
adaptToType(tree.appliedToNone, pt)
256
256
case tpw =>
257
- if (pt.isInstanceOf [ProtoType ] || ((! pt.isValueType || ! isNonJVMBottomType (tree.tpe)) && (tree.tpe <:< pt)))
257
+ if (pt.isInstanceOf [ProtoType ] || ((! pt.isValueType || ! defn.isBottomType (tree.tpe)) && (tree.tpe <:< pt)))
258
258
tree
259
259
else if (tpw.isErasedValueType)
260
260
adaptToType(box(tree), pt)
@@ -268,11 +268,6 @@ object Erasure extends TypeTestsCasts{
268
268
cast(tree, pt)
269
269
}
270
270
271
-
272
- /** Is `tpe` a type which is a bottom type for Dotty, but not a bottom type for JVM */
273
- def isNonJVMBottomType (tpe : Type )(implicit ctx : Context ): Boolean = {
274
- tpe.derivesFrom(ctx.definitions.NothingClass ) || tpe.derivesFrom(ctx.definitions.NullClass )
275
- }
276
271
}
277
272
278
273
class Typer extends typer.ReTyper with NoChecking {
0 commit comments