File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,11 @@ import collection.mutable
2121import ResolveSuper ._
2222
2323
24- /** This phase rewrites calls to array constructors to newArray and newGenericArray methods
25- * in Dotty.runtime.Arrays module.
26- *
27- * Additionally it optimizes calls to scala.Array.ofDim functions
28- *
29- */
24+ /** This phase rewrites calls to array constructors to newArray method in Dotty.runtime.Arrays module.
25+ *
26+ * It assummes that generic arrays have already been handled by typer(see Applications.convertNewGenericArray).
27+ * Additionally it optimizes calls to scala.Array.ofDim functions by replacing them with calls to newArray with specific dimensions
28+ */
3029class ArrayConstructors extends MiniPhaseTransform { thisTransform =>
3130 import ast .tpd ._
3231
@@ -46,9 +45,9 @@ class ArrayConstructors extends MiniPhaseTransform { thisTransform =>
4645 } else if ((tree.fun.symbol.maybeOwner eq defn.ArrayModule ) && (tree.fun.symbol.name eq nme.ofDim) && ! tree.tpe.isInstanceOf [MethodicType ]) {
4746
4847 tree.fun match {
49- case Apply (TypeApply (t : Ident , targ), dims) =>
48+ case Apply (TypeApply (t : Ident , targ), dims) if ! TypeErasure .isUnboundedGeneric(targ.head.tpe) =>
5049 rewrite(targ.head.tpe, dims)
51- case Apply (TypeApply (t : Select , targ), dims) =>
50+ case Apply (TypeApply (t : Select , targ), dims) if ! TypeErasure .isUnboundedGeneric(targ.head.tpe) =>
5251 Block (t.qualifier :: Nil , rewrite(targ.head.tpe, dims))
5352 case _ => tree
5453 }
You can’t perform that action at this time.
0 commit comments