@@ -61,10 +61,10 @@ class VCArrays extends MiniPhaseTransform with InfoTransformer {
61
61
62
62
override def transformTypeApply (tree : TypeApply )(implicit ctx : Context , info : TransformerInfo ): Tree =
63
63
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
68
68
case TypeApply (fun, args) =>
69
69
val tree1 = cpy.TypeApply (tree)(fun, args.map(transformTypeOfTree(_)))
70
70
transformTypeOfTree(tree1)
@@ -96,15 +96,17 @@ class VCArrays extends MiniPhaseTransform with InfoTransformer {
96
96
97
97
override def transformApply (tree : Apply )(implicit ctx : Context , info : TransformerInfo ): Tree = {
98
98
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 {
103
104
case JavaArrayType (ErasedValueType (tr, underlying)) =>
104
105
val cls = tr.symbol.asClass
105
106
val mod = cls.companionModule
107
+ val arTpe = JavaArrayType (underlying)
106
108
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 ),
108
110
ref(mod)))
109
111
case _ =>
110
112
tree
0 commit comments