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
21
21
import ResolveSuper ._
22
22
23
23
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
+ */
30
29
class ArrayConstructors extends MiniPhaseTransform { thisTransform =>
31
30
import ast .tpd ._
32
31
@@ -46,9 +45,9 @@ class ArrayConstructors extends MiniPhaseTransform { thisTransform =>
46
45
} else if ((tree.fun.symbol.maybeOwner eq defn.ArrayModule ) && (tree.fun.symbol.name eq nme.ofDim) && ! tree.tpe.isInstanceOf [MethodicType ]) {
47
46
48
47
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) =>
50
49
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) =>
52
51
Block (t.qualifier :: Nil , rewrite(targ.head.tpe, dims))
53
52
case _ => tree
54
53
}
You can’t perform that action at this time.
0 commit comments