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._
1515import Denotations ._ , SymDenotations ._
1616import TypeErasure .erasure
1717import DenotTransformers ._
18+ import NullOpsDecorator ._
1819
1920object ElimRepeated {
2021 val name : String = " elimRepeated"
@@ -335,6 +336,9 @@ class ElimRepeated extends MiniPhase with InfoTransformer { thisPhase =>
335336 val array = tp.translateFromRepeated(toArray = true ) // Array[? <: T]
336337 val element = array.elemType.hiBound // T
337338
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
339343 else defn.ArrayOf (TypeBounds .upper(AndType (element, defn.AnyRefType ))) // Array[? <: T & AnyRef]
340344}
You can’t perform that action at this time.
0 commit comments