@@ -61,10 +61,10 @@ class VCArrays extends MiniPhaseTransform with InfoTransformer {
6161
6262 override def transformTypeApply (tree : TypeApply )(implicit ctx : Context , info : TransformerInfo ): Tree =
6363 tree match {
64- case TypeApply (sel @ Select (_, _), _) if (sel.symbol == defn.newRefArrayMethod) =>
65- // Preserve the semi-erased type of the array so that we can properly transform
66- // it in transformApply
67- tree
64+ // case TypeApply(sel @ Select(_, _), _) if (sel.symbol == defn.newRefArrayMethod) =>
65+ // // Preserve the semi-erased type of the array so that we can properly transform
66+ // // it in transformApply
67+ // tree
6868 case TypeApply (fun, args) =>
6969 val tree1 = cpy.TypeApply (tree)(fun, args.map(transformTypeOfTree(_)))
7070 transformTypeOfTree(tree1)
@@ -96,15 +96,17 @@ class VCArrays extends MiniPhaseTransform with InfoTransformer {
9696
9797 override def transformApply (tree : Apply )(implicit ctx : Context , info : TransformerInfo ): Tree = {
9898 tree match {
99- // newRefArray[ErasedValueType(V, U)[]](args) => New VCXArray(newXArray(args), V)
100- case Apply (ta @ TypeApply (sel @ Select (_, _), List (targ)), args)
101- if (sel.symbol == defn.newRefArrayMethod) =>
102- targ.tpe match {
99+ // newArray(args) => New VCXArray(newXArray(args'), V)
100+ case ap@ Apply (fun, List (compTpt, retTpt, dims))
101+ if (fun.symbol == defn.newArrayMethod) =>
102+ val Literal (Constant (ins)) = retTpt
103+ ins match {
103104 case JavaArrayType (ErasedValueType (tr, underlying)) =>
104105 val cls = tr.symbol.asClass
105106 val mod = cls.companionModule
107+ val arTpe = JavaArrayType (underlying)
106108 New (defn.vcArrayOf(cls).typeRef,
107- List (newArray(TypeTree ( underlying), tree.pos).appliedToArgs(args ),
109+ List (newArray(underlying, arTpe, tree.pos, dims. asInstanceOf [ JavaSeqLiteral ]).ensureConforms(arTpe ),
108110 ref(mod)))
109111 case _ =>
110112 tree
0 commit comments