diff options
-rw-r--r-- | src/dotty/tools/dotc/transform/ArrayConstructors.scala | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/transform/ArrayConstructors.scala b/src/dotty/tools/dotc/transform/ArrayConstructors.scala index ec3bfa47f..74213d332 100644 --- a/src/dotty/tools/dotc/transform/ArrayConstructors.scala +++ b/src/dotty/tools/dotc/transform/ArrayConstructors.scala @@ -42,11 +42,14 @@ class ArrayConstructors extends MiniPhaseTransform { thisTransform => val TypeApply(tycon, targ :: Nil) = tree.fun rewrite(targ.tpe, tree.args) } else if ((tree.fun.symbol.maybeOwner eq defn.ArrayModule) && (tree.fun.symbol.name eq nme.ofDim) && !tree.tpe.isInstanceOf[MethodicType]) { - + val Apply(Apply(TypeApply(_, List(tp)), _), _) = tree + val cs = tp.tpe.widen.classSymbol tree.fun match { - case Apply(TypeApply(t: Ident, targ), dims) if !TypeErasure.isUnboundedGeneric(targ.head.tpe) => + case Apply(TypeApply(t: Ident, targ), dims) + if !TypeErasure.isUnboundedGeneric(targ.head.tpe) && !ValueClasses.isDerivedValueClass(cs) => rewrite(targ.head.tpe, dims) - case Apply(TypeApply(t: Select, targ), dims) if !TypeErasure.isUnboundedGeneric(targ.head.tpe) => + case Apply(TypeApply(t: Select, targ), dims) + if !TypeErasure.isUnboundedGeneric(targ.head.tpe) && !ValueClasses.isDerivedValueClass(cs) => Block(t.qualifier :: Nil, rewrite(targ.head.tpe, dims)) case _ => tree } @@ -54,4 +57,3 @@ class ArrayConstructors extends MiniPhaseTransform { thisTransform => } else tree } } - |