diff options
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/Compiler.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/ArrayConstructors.scala | 11 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 4 |
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 |