aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2016-04-18 14:49:18 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2016-04-18 15:01:29 +0200
commit5399fbed6d33dca132ca27314f2eba414aea4415 (patch)
tree30ea8adc3cf6d1e0f20edb3aedb7c7ffa774ee2c /src/dotty/tools
parent0b1ca2d823ba0eac5558c3bcd1750c84a250cd18 (diff)
downloaddotty-5399fbed6d33dca132ca27314f2eba414aea4415.tar.gz
dotty-5399fbed6d33dca132ca27314f2eba414aea4415.tar.bz2
dotty-5399fbed6d33dca132ca27314f2eba414aea4415.zip
Address review comments of #1188
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/Compiler.scala4
-rw-r--r--src/dotty/tools/dotc/transform/ArrayConstructors.scala11
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala4
3 files changed, 10 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala
index f1a3c526b..b63e0236d 100644
--- a/src/dotty/tools/dotc/Compiler.scala
+++ b/src/dotty/tools/dotc/Compiler.scala
@@ -66,8 +66,8 @@ class Compiler {
new Getters, // Replace non-private vals and vars with getter defs (fields are added later)
new ElimByName, // Expand by-name parameters and arguments
new AugmentScala2Traits, // Expand traits defined in Scala 2.11 to simulate old-style rewritings
- new ResolveSuper, // Implement super accessors and add forwarders to trait methods
- new ArrayConstructors) // Intercept creation of (non-generic) arrays and intrinsify.
+ new ResolveSuper, // Implement super accessors and add forwarders to trait methods
+ new ArrayConstructors), // Intercept creation of (non-generic) arrays and intrinsify.
List(new Erasure), // Rewrite types to JVM model, erasing all type parameters, abstract types and refinements.
List(new ElimErasedValueType, // Expand erased value types to their underlying implmementation types
new VCElideAllocations, // Peep-hole optimization to eliminate unnecessary value class allocations
diff --git a/src/dotty/tools/dotc/transform/ArrayConstructors.scala b/src/dotty/tools/dotc/transform/ArrayConstructors.scala
index fe79627ea..ec3bfa47f 100644
--- a/src/dotty/tools/dotc/transform/ArrayConstructors.scala
+++ b/src/dotty/tools/dotc/transform/ArrayConstructors.scala
@@ -17,9 +17,12 @@ import ast.Trees._
import dotty.tools.dotc.ast.tpd
import util.Positions._
import Names._
+
import collection.mutable
import ResolveSuper._
+import scala.collection.immutable.::
+
/** This phase rewrites calls to array constructors to newArray method in Dotty.runtime.Arrays module.
*
@@ -36,12 +39,8 @@ class ArrayConstructors extends MiniPhaseTransform { thisTransform =>
tpd.newArray(elemType, tree.tpe, tree.pos, JavaSeqLiteral(dims, TypeTree(defn.IntClass.typeRef)))
if (tree.fun.symbol eq defn.ArrayConstructor) {
- tree.fun match {
- case TypeApply(tycon, targ :: Nil) =>
- rewrite(targ.tpe, tree.args)
- case _ =>
- ???
- }
+ val TypeApply(tycon, targ :: Nil) = tree.fun
+ rewrite(targ.tpe, tree.args)
} else if ((tree.fun.symbol.maybeOwner eq defn.ArrayModule) && (tree.fun.symbol.name eq nme.ofDim) && !tree.tpe.isInstanceOf[MethodicType]) {
tree.fun match {
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index 2cec4bf08..37a9f0ba0 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -645,7 +645,9 @@ trait Applications extends Compatibility { self: Typer =>
fullyDefinedType(tree.tpe, "array", tree.pos)
def newGenericArrayCall =
- ref(defn.DottyArraysModule).select(defn.newGenericArrayMethod).withPos(tree.pos).appliedToTypeTrees(targs).appliedToArgs(args)
+ ref(defn.DottyArraysModule)
+ .select(defn.newGenericArrayMethod).withPos(tree.pos)
+ .appliedToTypeTrees(targs).appliedToArgs(args)
if (TypeErasure.isUnboundedGeneric(targ.tpe))
newGenericArrayCall