Skip to content

Commit 397926b

Browse files
committed
Address review comments of #1188
1 parent 0b1ca2d commit 397926b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ import Decorators._
1313
import DenotTransformers._
1414
import StdNames._
1515
import NameOps._
16-
import ast.Trees._
16+
import ast.Trees.{TypeApply, _}
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)