Skip to content

Commit 5399fbe

Browse files
committed
Address review comments of #1188
1 parent 0b1ca2d commit 5399fbe

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/dotty/tools/dotc/Compiler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class Compiler {
6666
new Getters, // Replace non-private vals and vars with getter defs (fields are added later)
6767
new ElimByName, // Expand by-name parameters and arguments
6868
new AugmentScala2Traits, // Expand traits defined in Scala 2.11 to simulate old-style rewritings
69-
new ResolveSuper, // Implement super accessors and add forwarders to trait methods
70-
new ArrayConstructors) // Intercept creation of (non-generic) arrays and intrinsify.
69+
new ResolveSuper, // Implement super accessors and add forwarders to trait methods
70+
new ArrayConstructors), // Intercept creation of (non-generic) arrays and intrinsify.
7171
List(new Erasure), // Rewrite types to JVM model, erasing all type parameters, abstract types and refinements.
7272
List(new ElimErasedValueType, // Expand erased value types to their underlying implmementation types
7373
new VCElideAllocations, // Peep-hole optimization to eliminate unnecessary value class allocations

src/dotty/tools/dotc/transform/ArrayConstructors.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ import ast.Trees._
1717
import dotty.tools.dotc.ast.tpd
1818
import util.Positions._
1919
import Names._
20+
2021
import collection.mutable
2122
import ResolveSuper._
2223

24+
import scala.collection.immutable.::
25+
2326

2427
/** This phase rewrites calls to array constructors to newArray method in Dotty.runtime.Arrays module.
2528
*
@@ -36,12 +39,8 @@ class ArrayConstructors extends MiniPhaseTransform { thisTransform =>
3639
tpd.newArray(elemType, tree.tpe, tree.pos, JavaSeqLiteral(dims, TypeTree(defn.IntClass.typeRef)))
3740

3841
if (tree.fun.symbol eq defn.ArrayConstructor) {
39-
tree.fun match {
40-
case TypeApply(tycon, targ :: Nil) =>
41-
rewrite(targ.tpe, tree.args)
42-
case _ =>
43-
???
44-
}
42+
val TypeApply(tycon, targ :: Nil) = tree.fun
43+
rewrite(targ.tpe, tree.args)
4544
} else if ((tree.fun.symbol.maybeOwner eq defn.ArrayModule) && (tree.fun.symbol.name eq nme.ofDim) && !tree.tpe.isInstanceOf[MethodicType]) {
4645

4746
tree.fun match {

src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,9 @@ trait Applications extends Compatibility { self: Typer =>
645645
fullyDefinedType(tree.tpe, "array", tree.pos)
646646

647647
def newGenericArrayCall =
648-
ref(defn.DottyArraysModule).select(defn.newGenericArrayMethod).withPos(tree.pos).appliedToTypeTrees(targs).appliedToArgs(args)
648+
ref(defn.DottyArraysModule)
649+
.select(defn.newGenericArrayMethod).withPos(tree.pos)
650+
.appliedToTypeTrees(targs).appliedToArgs(args)
649651

650652
if (TypeErasure.isUnboundedGeneric(targ.tpe))
651653
newGenericArrayCall

0 commit comments

Comments
 (0)