Skip to content

Commit 6be0b81

Browse files
committed
Don't treat Array[_ <: Int] as unbounded generic
1 parent 0b77e07 commit 6be0b81

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ object TypeErasure {
244244
!classify(tp).derivesFrom(defn.ObjectClass) &&
245245
!tp.binder.resultType.isJavaMethod
246246
case tp: TypeAlias => isUnboundedGeneric(tp.alias)
247-
case tp: TypeBounds => !classify(tp.hi).derivesFrom(defn.ObjectClass)
247+
case tp: TypeBounds =>
248+
val upper = classify(tp.hi)
249+
!upper.derivesFrom(defn.ObjectClass) &&
250+
!upper.isPrimitiveValueType
248251
case tp: TypeProxy => isUnboundedGeneric(tp.translucentSuperType)
249252
case tp: AndType => isUnboundedGeneric(tp.tp1) && isUnboundedGeneric(tp.tp2)
250253
case tp: OrType => isUnboundedGeneric(tp.tp1) || isUnboundedGeneric(tp.tp2)

0 commit comments

Comments
 (0)