File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import Decorators._
15
15
import Denotations ._ , SymDenotations ._
16
16
import TypeErasure .erasure
17
17
import DenotTransformers ._
18
+ import NullOpsDecorator ._
18
19
19
20
object ElimRepeated {
20
21
val name : String = " elimRepeated"
@@ -335,6 +336,9 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
335
336
val array = tp.translateFromRepeated(toArray = true ) // Array[? <: T]
336
337
val element = array.elemType.hiBound // T
337
338
338
- if element <:< defn.AnyRefType || element.typeSymbol.isPrimitiveValueClass then array
339
+
340
+ if element <:< defn.AnyRefType
341
+ || ctx.mode.is(Mode .SafeNulls ) && element.stripNull <:< defn.AnyRefType
342
+ || element.typeSymbol.isPrimitiveValueClass then array
339
343
else defn.ArrayOf (TypeBounds .upper(AndType (element, defn.AnyRefType ))) // Array[? <: T & AnyRef]
340
344
}
You can’t perform that action at this time.
0 commit comments