summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-11 05:58:45 +0000
committerPaul Phillips <paulp@improving.org>2010-10-11 05:58:45 +0000
commita350673750d431c4f6159c908e3aca4af43057c4 (patch)
treeb7d38fcbee86031e370d4a2a1ce173a2feedfaee /src/compiler/scala/tools
parent487e5bf895cde949c6c057e029c0bf96c6232431 (diff)
downloadscala-a350673750d431c4f6159c908e3aca4af43057c4.tar.gz
scala-a350673750d431c4f6159c908e3aca4af43057c4.tar.bz2
scala-a350673750d431c4f6159c908e3aca4af43057c4.zip
Some cleanups in the compiler source.
eliminated the import of ambiguously named classes from e.g. collection.mutable, obeyed a todo in the parser regarding dropping lbracket from statement starting tokens. No review.
Diffstat (limited to 'src/compiler/scala/tools')
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala3
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala5
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala8
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Positions.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala9
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala31
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala8
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala10
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala7
-rw-r--r--src/compiler/scala/tools/nsc/transform/Constructors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala10
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/Flatten.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/LazyVals.scala9
-rw-r--r--src/compiler/scala/tools/nsc/transform/LiftCode.scala11
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/Reifiers.scala1
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala7
-rw-r--r--src/compiler/scala/tools/nsc/transform/TypingTransformers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala9
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Duplicators.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala10
-rw-r--r--src/compiler/scala/tools/nsc/util/Statistics.scala1
28 files changed, 81 insertions, 100 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 1ab46b1a25..9571df6fe0 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -13,12 +13,11 @@ import java.net.{ MalformedURLException, URL }
import java.lang.reflect
import reflect.InvocationTargetException
+import scala.collection.{ mutable, immutable }
import scala.PartialFunction.{ cond, condOpt }
import scala.tools.util.PathResolver
import scala.reflect.Manifest
-import scala.collection.mutable
import scala.collection.mutable.{ ListBuffer, HashSet, HashMap, ArrayBuffer }
-import scala.collection.immutable.Set
import scala.tools.nsc.util.ScalaClassLoader
import ScalaClassLoader.URLClassLoader
import scala.util.control.Exception.{ Catcher, catching, ultimately, unwrapping }
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 392afcc14e..6f41b3ac47 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1467,7 +1467,7 @@ self =>
* | val Pattern1 `=' Expr
*/
def enumerators(): List[Enumerator] = {
- val newStyle = in.token != VAL // todo: deprecate old style
+ val newStyle = in.token != VAL
if (!newStyle)
deprecationWarning(in.offset, "for (val x <- ... ) has been deprecated; use for (x <- ... ) instead")
val enums = new ListBuffer[Enumerator]
@@ -2598,7 +2598,6 @@ self =>
in.token == TRAIT ||
in.token == OBJECT ||
in.token == CASEOBJECT ||
- in.token == LBRACKET || //todo: remove
in.token == AT ||
isModifier) {
stats ++= joinComment(List(topLevelTmplDef))
@@ -2649,7 +2648,7 @@ self =>
} else if (isExprIntro) {
in.flushDoc
stats += statement(InTemplate)
- } else if (isDefIntro || isModifier || in.token == LBRACKET /*todo: remove */ || in.token == AT) {
+ } else if (isDefIntro || isModifier || in.token == AT) {
stats ++= joinComment(nonLocalDefOrDcl)
} else if (!isStatSep) {
syntaxErrorOrIncomplete("illegal start of definition", true)
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala
index 654acc7fe9..0e76044977 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala
@@ -8,8 +8,8 @@ package scala.tools.nsc
package backend.icode
package analysis
-import scala.collection.mutable.{HashMap, Map}
-import scala.collection.immutable.{Set, ListSet}
+import scala.collection.{ mutable, immutable }
+import scala.collection.immutable.{ Set, ListSet }
/**
* Compute liveness information for local variables.
@@ -37,8 +37,8 @@ abstract class Liveness {
var method: IMethod = _
- val gen: Map[BasicBlock, Set[Local]] = new HashMap()
- val kill:Map[BasicBlock, Set[Local]] = new HashMap()
+ val gen: mutable.Map[BasicBlock, Set[Local]] = new mutable.HashMap()
+ val kill: mutable.Map[BasicBlock, Set[Local]] = new mutable.HashMap()
def init(m: IMethod) {
this.method = m
diff --git a/src/compiler/scala/tools/nsc/symtab/Positions.scala b/src/compiler/scala/tools/nsc/symtab/Positions.scala
index 58b9164988..2290705bbf 100644
--- a/src/compiler/scala/tools/nsc/symtab/Positions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Positions.scala
@@ -1,9 +1,7 @@
package scala.tools.nsc
package symtab
-import ast.Trees
-import scala.tools.nsc.util.{SourceFile, Position, RangePosition, OffsetPosition, NoPosition, WorkScheduler}
-import scala.collection.mutable.ListBuffer
+import scala.tools.nsc.util.{ SourceFile, Position, OffsetPosition, NoPosition }
trait Positions {
self: scala.tools.nsc.symtab.SymbolTable =>
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index 1f9f1c9701..2452081c05 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -6,17 +6,14 @@
package scala.tools.nsc
package symtab
-import java.io.{File, IOException}
+import java.io.IOException
+import ch.epfl.lamp.compiler.msil.{ Type => MSILType, Attribute => MSILAttribute }
-import ch.epfl.lamp.compiler.msil.{Type => MSILType, Attribute => MSILAttribute}
-
-import scala.collection.mutable.{HashMap, HashSet, ListBuffer}
import scala.compat.Platform.currentTime
import scala.tools.nsc.io.AbstractFile
-import scala.tools.nsc.util.{ ClassPath, JavaClassPath }
+import scala.tools.nsc.util.{ ClassPath }
import classfile.ClassfileParser
import Flags._
-
import util.Statistics._
/** This class ...
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index fb86f75a2e..4c17ea8f50 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -7,10 +7,10 @@
package scala.tools.nsc
package symtab
+import scala.collection.{ mutable, immutable }
import scala.collection.mutable.ListBuffer
-import scala.collection.immutable.Map
import io.AbstractFile
-import util.{Position, NoPosition, BatchSourceFile}
+import util.{ Position, NoPosition, BatchSourceFile }
import util.Statistics._
import Flags._
@@ -31,7 +31,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable =>
protected var lockedSyms = collection.immutable.Set[Symbol]()
/** Used to keep track of the recursion depth on locked symbols */
- private var recursionTable = Map.empty[Symbol, Int]
+ private var recursionTable = immutable.Map.empty[Symbol, Int]
private var nextexid = 0
private def freshExistentialName() = {
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index e68fb73596..d4f322ed9f 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -2,15 +2,14 @@
* Copyright 2005-2010 LAMP/EPFL
* @author Martin Odersky
*/
-//
package scala.tools.nsc
package symtab
-import scala.collection.immutable
-import scala.collection.mutable.{ListBuffer, HashMap, WeakHashMap}
+import scala.collection.{ mutable, immutable }
+import scala.collection.mutable.ListBuffer
import ast.TreeGen
-import util.{HashSet, Position, NoPosition}
+import util.{ Position, NoPosition }
import util.Statistics._
import Flags._
import scala.util.control.ControlThrowable
@@ -146,7 +145,7 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
* It makes use of the fact that these two operations depend only on the parents,
* not on the refinement.
*/
- val intersectionWitness = new WeakHashMap[List[Type], Type]
+ val intersectionWitness = new mutable.WeakHashMap[List[Type], Type]
private object gen extends {
val global : Types.this.type = Types.this
@@ -1478,7 +1477,7 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
private final val Initializing = 1
private final val Initialized = 2
- private type RefMap = Map[Symbol, collection.immutable.Set[Symbol]]
+ private type RefMap = Map[Symbol, immutable.Set[Symbol]]
/** All type parameters reachable from given type parameter
* by a path which contains at least one expansive reference.
@@ -1636,7 +1635,7 @@ trait Types extends reflect.generic.Types { self: SymbolTable =>
}
private var volatileRecursions: Int = 0
- private val pendingVolatiles = new collection.mutable.HashSet[Symbol]
+ private val pendingVolatiles = new mutable.HashSet[Symbol]
/** A class for named types of the form
* `<prefix>.<sym.name>[args]'
@@ -2254,7 +2253,7 @@ A type's typeSymbol should never be inspected directly.
// encapsulate suspension so we can automatically link the suspension of cloned typevars to their original if this turns out to be necessary
def Suspension = new Suspension
class Suspension {
- private val suspended = collection.mutable.HashSet[TypeVar]()
+ private val suspended = mutable.HashSet[TypeVar]()
def suspend(tv: TypeVar): Unit = {
tv.suspended = true
suspended += tv
@@ -2862,13 +2861,13 @@ A type's typeSymbol should never be inspected directly.
// Hash consing --------------------------------------------------------------
private val initialUniquesCapacity = 4096
- private var uniques: HashSet[AnyRef] = _
+ private var uniques: util.HashSet[AnyRef] = _
private var uniqueRunId = NoRunId
private def unique[T <: AnyRef](tp: T): T = {
incCounter(rawTypeCount)
if (uniqueRunId != currentRunId) {
- uniques = new HashSet("uniques", initialUniquesCapacity)
+ uniques = new util.HashSet("uniques", initialUniquesCapacity)
uniqueRunId = currentRunId
}
(uniques findEntryOrUpdate tp).asInstanceOf[T]
@@ -3201,8 +3200,8 @@ A type's typeSymbol should never be inspected directly.
}
}
- private val emptySymMap = scala.collection.immutable.Map[Symbol, Symbol]()
- private val emptySymCount = scala.collection.immutable.Map[Symbol, Int]()
+ private val emptySymMap = immutable.Map[Symbol, Symbol]()
+ private val emptySymCount = immutable.Map[Symbol, Int]()
def typeParamsToExistentials(clazz: Symbol, tparams: List[Symbol]): List[Symbol] = {
val eparams = for ((tparam, i) <- tparams.zipWithIndex) yield {
@@ -4336,9 +4335,9 @@ A type's typeSymbol should never be inspected directly.
*/
def isSameTypes(tps1: List[Type], tps2: List[Type]): Boolean = (tps1 corresponds tps2)(_ =:= _)
- private val pendingSubTypes = new collection.mutable.HashSet[SubTypePair]
+ private val pendingSubTypes = new mutable.HashSet[SubTypePair]
private var basetypeRecursions: Int = 0
- private val pendingBaseTypes = new collection.mutable.HashSet[Type]
+ private val pendingBaseTypes = new mutable.HashSet[Type]
def isSubType(tp1: Type, tp2: Type): Boolean = isSubType(tp1, tp2, AnyDepth)
@@ -5052,8 +5051,8 @@ A type's typeSymbol should never be inspected directly.
isNumericValueType(tp1) && isNumericValueType(tp2) &&
isNumericSubClass(tp1.typeSymbol, tp2.typeSymbol)
- private val lubResults = new HashMap[(Int, List[Type]), Type]
- private val glbResults = new HashMap[(Int, List[Type]), Type]
+ private val lubResults = new mutable.HashMap[(Int, List[Type]), Type]
+ private val glbResults = new mutable.HashMap[(Int, List[Type]), Type]
def lub(ts: List[Type]): Type = try {
lub(ts, lubDepth(ts))
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 602b3a8637..cbc79b215d 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -10,8 +10,8 @@ package classfile
import java.io.{ File, IOException }
import java.lang.Integer.toHexString
-import scala.collection.immutable.{Map, ListMap}
-import scala.collection.mutable.{ListBuffer, ArrayBuffer}
+import scala.collection.{ mutable, immutable }
+import scala.collection.mutable.{ ListBuffer, ArrayBuffer }
import scala.tools.nsc.io.AbstractFile
import scala.annotation.switch
import reflect.generic.PickleBuffer
@@ -690,7 +690,7 @@ abstract class ClassfileParser {
}
def existentialType(tparams: List[Symbol], tp: Type): Type =
if (tparams.isEmpty) tp else ExistentialType(tparams, tp)
- def sig2type(tparams: Map[Name,Symbol], skiptvs: Boolean): Type = {
+ def sig2type(tparams: immutable.Map[Name,Symbol], skiptvs: Boolean): Type = {
val tag = sig(index); index += 1
tag match {
case BYTE_TAG => definitions.ByteClass.tpe
@@ -797,7 +797,7 @@ abstract class ClassfileParser {
}
} // sig2type(tparams, skiptvs)
- def sig2typeBounds(tparams: Map[Name, Symbol], skiptvs: Boolean): Type = {
+ def sig2typeBounds(tparams: immutable.Map[Name, Symbol], skiptvs: Boolean): Type = {
val ts = new ListBuffer[Type]
while (sig(index) == ':') {
index += 1
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index e3bd67ec81..3b63ce2862 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -7,9 +7,9 @@ package scala.tools.nsc
package symtab
package classfile
-import java.lang.{Float, Double}
-import util.{ Position, NoPosition, ShowPickled }
-import collection.mutable.Set
+import java.lang.Float.floatToIntBits
+import java.lang.Double.doubleToLongBits
+import util.{ ShowPickled }
import reflect.generic.{ PickleBuffer, PickleFormat }
import PickleFormat._
import Flags._
@@ -597,8 +597,8 @@ abstract class Pickler extends SubComponent {
case c @ Constant(_) =>
if (c.tag == BooleanTag) writeLong(if (c.booleanValue) 1 else 0)
else if (ByteTag <= c.tag && c.tag <= LongTag) writeLong(c.longValue)
- else if (c.tag == FloatTag) writeLong(Float.floatToIntBits(c.floatValue))
- else if (c.tag == DoubleTag) writeLong(Double.doubleToLongBits(c.doubleValue))
+ else if (c.tag == FloatTag) writeLong(floatToIntBits(c.floatValue))
+ else if (c.tag == DoubleTag) writeLong(doubleToLongBits(c.doubleValue))
else if (c.tag == StringTag) writeRef(newTermName(c.stringValue))
else if (c.tag == ClassTag) writeRef(c.typeValue)
else if (c.tag == EnumTag) writeRef(c.symbolValue)
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
index 05ffc6c7b7..a2e7f425b6 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
@@ -7,13 +7,8 @@ package scala.tools.nsc
package symtab
package classfile
-import java.io.IOException
-import java.lang.{Float, Double}
-
import Flags._
import scala.reflect.generic.PickleFormat._
-import collection.mutable.{HashMap, ListBuffer}
-import annotation.switch
/** @author Martin Odersky
* @version 1.0
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index f1ed9f43a0..252055a63f 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -8,7 +8,8 @@ package transform
import symtab._
import Flags._
-import collection.mutable.{HashMap, ListBuffer}
+import scala.collection.{ mutable, immutable }
+import collection.mutable.ListBuffer
abstract class AddInterfaces extends InfoTransform {
import global._ // the global environment
@@ -38,13 +39,13 @@ abstract class AddInterfaces extends InfoTransform {
/** A lazily constructed map that associates every non-interface trait with
* its implementation class.
*/
- private val implClassMap = new HashMap[Symbol, Symbol]
+ private val implClassMap = new mutable.HashMap[Symbol, Symbol]
/** A lazily constructed map that associates every concrete method in a non-interface
* trait that's currently compiled with its corresponding method in the trait's
* implementation class.
*/
- private val implMethodMap = new HashMap[Symbol, Symbol]
+ private val implMethodMap = new mutable.HashMap[Symbol, Symbol]
override def newPhase(prev: scala.tools.nsc.Phase): StdPhase = {
implClassMap.clear
diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala
index 4c20a901ef..5b30bf59ec 100644
--- a/src/compiler/scala/tools/nsc/transform/Constructors.scala
+++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala
@@ -6,6 +6,7 @@
package scala.tools.nsc
package transform
+import scala.collection.{ mutable, immutable }
import scala.collection.mutable.ListBuffer
import symtab.Flags._
import util.TreeSet
@@ -16,7 +17,6 @@ import util.TreeSet
abstract class Constructors extends Transform with ast.TreeDSL {
import global._
import definitions._
- import collection.mutable
/** the following two members override abstract members in Transform */
val phaseName: String = "constructors"
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 635a1983e2..80f32ec66f 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -7,9 +7,7 @@ package scala.tools.nsc
package transform
import scala.tools.nsc.symtab.classfile.ClassfileConstants._
-import scala.collection.mutable.{HashMap,ListBuffer}
-import scala.collection.immutable.Set
-import scala.util.control.ControlThrowable
+import scala.collection.{ mutable, immutable }
import symtab._
import Flags._
@@ -817,13 +815,13 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer with ast.
* with the erased type of <code>m1</code> in the template.
* </p>
*/
- private def bridgeDefs(owner: Symbol): (List[Tree], Set[Symbol]) = {
- var toBeRemoved: Set[Symbol] = Set()
+ private def bridgeDefs(owner: Symbol): (List[Tree], immutable.Set[Symbol]) = {
+ var toBeRemoved: immutable.Set[Symbol] = immutable.Set()
//println("computing bridges for " + owner)//DEBUG
assert(phase == currentRun.erasurePhase)
val site = owner.thisType
val bridgesScope = new Scope
- val bridgeTarget = new HashMap[Symbol, Symbol]
+ val bridgeTarget = new mutable.HashMap[Symbol, Symbol]
var bridges: List[Tree] = List()
val opc = atPhase(currentRun.explicitOuterPhase) {
new overridingPairs.Cursor(owner) {
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 0e8faa1f1e..1403377367 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -9,7 +9,6 @@ package transform
import symtab._
import Flags.{ CASE => _, _ }
import scala.collection.mutable.ListBuffer
-import scala.collection.mutable
import matching.{ Patterns, ParallelMatching }
/** This class ...
diff --git a/src/compiler/scala/tools/nsc/transform/Flatten.scala b/src/compiler/scala/tools/nsc/transform/Flatten.scala
index 96c050b51f..512c5fe2bd 100644
--- a/src/compiler/scala/tools/nsc/transform/Flatten.scala
+++ b/src/compiler/scala/tools/nsc/transform/Flatten.scala
@@ -8,7 +8,8 @@ package transform
import symtab._
import Flags._
-import scala.collection.mutable.{HashMap, ListBuffer}
+import scala.collection.{ mutable, immutable }
+import scala.collection.mutable.ListBuffer
abstract class Flatten extends InfoTransform {
import global._
@@ -76,7 +77,7 @@ abstract class Flatten extends InfoTransform {
class Flattener extends Transformer {
/** Buffers for lifted out classes */
- private val liftedDefs = new HashMap[Symbol, ListBuffer[Tree]]
+ private val liftedDefs = new mutable.HashMap[Symbol, ListBuffer[Tree]]
override def transform(tree: Tree): Tree = {
tree match {
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index ecf68fa922..034dc04f3c 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -9,7 +9,7 @@ package transform
import symtab._
import Flags._
import util.TreeSet
-import scala.collection.mutable.{HashMap, LinkedHashMap, ListBuffer}
+import scala.collection.mutable.{ LinkedHashMap, ListBuffer }
abstract class LambdaLift extends InfoTransform {
import global._
diff --git a/src/compiler/scala/tools/nsc/transform/LazyVals.scala b/src/compiler/scala/tools/nsc/transform/LazyVals.scala
index ec283f67fd..98b98b06ac 100644
--- a/src/compiler/scala/tools/nsc/transform/LazyVals.scala
+++ b/src/compiler/scala/tools/nsc/transform/LazyVals.scala
@@ -1,8 +1,7 @@
package scala.tools.nsc
-package transform;
+package transform
-import scala.tools.nsc._
-import scala.collection.mutable.HashMap
+import scala.collection.{ mutable, immutable }
abstract class LazyVals extends Transform with TypingTransformers with ast.TreeDSL {
// inherits abstract value `global' and class `Phase' from Transform
@@ -22,7 +21,7 @@ abstract class LazyVals extends Transform with TypingTransformers with ast.TreeD
*/
class LazyValues(unit: CompilationUnit) extends TypingTransformer(unit) {
/** map from method symbols to the number of lazy values it defines. */
- private val lazyVals = new HashMap[Symbol, Int] {
+ private val lazyVals = new mutable.HashMap[Symbol, Int] {
override def default(meth: Symbol) = 0
}
@@ -153,7 +152,7 @@ abstract class LazyVals extends Transform with TypingTransformers with ast.TreeD
Ident(bmp) === (Ident(bmp) INT_| mask)
final val FLAGS_PER_WORD = 32
- val bitmaps = new HashMap[Symbol, List[Symbol]] {
+ val bitmaps = new mutable.HashMap[Symbol, List[Symbol]] {
override def default(meth: Symbol) = Nil
}
diff --git a/src/compiler/scala/tools/nsc/transform/LiftCode.scala b/src/compiler/scala/tools/nsc/transform/LiftCode.scala
index a6a4a8d22c..9438de6390 100644
--- a/src/compiler/scala/tools/nsc/transform/LiftCode.scala
+++ b/src/compiler/scala/tools/nsc/transform/LiftCode.scala
@@ -8,10 +8,9 @@ package transform
import symtab._
import Flags._
-import symtab.Flags._
-import scala.collection.immutable.ListMap
-import scala.collection.mutable.{HashMap, ListBuffer}
-import scala.tools.nsc.util.{FreshNameCreator, TreeSet}
+import scala.collection.{ mutable, immutable }
+import scala.collection.mutable.ListBuffer
+import scala.tools.nsc.util.FreshNameCreator
/** Translate expressions of the form reflect.Code.lift(exp)
* to the lifted "reflect trees" representation of exp.
@@ -44,7 +43,7 @@ abstract class LiftCode extends Transform with Reifiers {
}
- type InjectEnvironment = ListMap[reflect.Symbol, Name]
+ type InjectEnvironment = immutable.ListMap[reflect.Symbol, Name]
class Injector(env: InjectEnvironment, fresh: FreshNameCreator) {
@@ -109,7 +108,7 @@ abstract class LiftCode extends Transform with Reifiers {
def inject(code: reflect.Tree): Tree =
- new Injector(ListMap.empty, new FreshNameCreator.Default).inject(code)
+ new Injector(immutable.ListMap.empty, new FreshNameCreator.Default).inject(code)
def codify (tree: Tree): Tree =
New(TypeTree(appliedType(definitions.CodeClass.typeConstructor,
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 94e5e2561b..71472e1fcf 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -8,7 +8,8 @@ package transform
import symtab._
import Flags._
-import collection.mutable.{ListBuffer, HashMap}
+import scala.collection.{ mutable, immutable }
+import scala.collection.mutable.ListBuffer
abstract class Mixin extends InfoTransform with ast.TreeDSL {
import global._
@@ -203,7 +204,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
}
/** Map a lazy, mixedin field accessor to it's trait member accessor */
- val initializer = new HashMap[Symbol, Symbol]
+ val initializer = new mutable.HashMap[Symbol, Symbol]
/** Add all members to be mixed in into a (non-trait-) class
* These are:
diff --git a/src/compiler/scala/tools/nsc/transform/Reifiers.scala b/src/compiler/scala/tools/nsc/transform/Reifiers.scala
index eef260f5a3..49ae43e1fe 100644
--- a/src/compiler/scala/tools/nsc/transform/Reifiers.scala
+++ b/src/compiler/scala/tools/nsc/transform/Reifiers.scala
@@ -1,5 +1,6 @@
package scala.tools.nsc
package transform
+
import scala.tools.nsc.symtab.SymbolTable
import scala.reflect
import collection.mutable.HashMap
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index 89c44654da..efc727a789 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -7,10 +7,7 @@ package scala.tools.nsc
package transform
import scala.tools.nsc.symtab.Flags
-import scala.tools.nsc.util.FreshNameCreator
-
-import scala.collection.{mutable, immutable}
-import immutable.Set
+import scala.collection.{ mutable, immutable }
/** Specialize code on types.
*/
@@ -711,7 +708,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
* * there is a valid specialization environment that maps the overridden method type to m's type.
*/
def needsSpecialOverride(overriding: Symbol, syms: List[Symbol]): (Symbol, TypeEnv) = {
- def missingSpecializations(baseTvar: Symbol, derivedTvar: Symbol): Set[Type] = {
+ def missingSpecializations(baseTvar: Symbol, derivedTvar: Symbol): immutable.Set[Type] = {
val baseSet = concreteTypes(baseTvar).toSet
val derivedSet = concreteTypes(derivedTvar).toSet
baseSet diff derivedSet
diff --git a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
index de5355de61..61bf972650 100644
--- a/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
+++ b/src/compiler/scala/tools/nsc/transform/TypingTransformers.scala
@@ -6,7 +6,7 @@
package scala.tools.nsc
package transform
-import scala.collection.mutable.{Map, HashMap}
+import scala.collection.{ mutable, immutable }
/** A base class for transforms.
* A transform contains a compiler phase which applies a tree transformer.
@@ -26,7 +26,7 @@ trait TypingTransformers {
protected def typedPos(pos: Position)(tree: Tree) = localTyper typed { atPos(pos)(tree) }
/** a typer for each enclosing class */
- val typers: Map[Symbol, analyzer.Typer] = new HashMap
+ val typers: mutable.Map[Symbol, analyzer.Typer] = new mutable.HashMap
override def atOwner[A](owner: Symbol)(trans: => A): A = atOwner(curTree, owner)(trans)
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 7ca0f089f1..4901ca4d70 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -7,7 +7,7 @@ package scala.tools.nsc
package transform
import symtab.Flags._
-import scala.collection.mutable.{HashMap, HashSet}
+import scala.collection.{ mutable, immutable }
/*<export>*/
/** - uncurry all symbol and tree types (@see UnCurryPhase)
@@ -152,8 +152,8 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
private var needTryLift = false
private var inPattern = false
private var inConstructorFlag = 0L
- private val byNameArgs = new HashSet[Tree]
- private val noApply = new HashSet[Tree]
+ private val byNameArgs = new mutable.HashSet[Tree]
+ private val noApply = new mutable.HashSet[Tree]
override def transformUnit(unit: CompilationUnit) {
freeMutableVars.clear
@@ -201,7 +201,7 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
appliedType(NonLocalReturnControlClass.typeConstructor, List(argtype))
/** A hashmap from method symbols to non-local return keys */
- private val nonLocalReturnKeys = new HashMap[Symbol, Symbol]
+ private val nonLocalReturnKeys = new mutable.HashMap[Symbol, Symbol]
/** Return non-local return key for given method */
private def nonLocalReturnKey(meth: Symbol) =
@@ -700,7 +700,6 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
}
}
- import collection.mutable
/** Set of mutable local variables that are free in some inner method. */
private val freeMutableVars: mutable.Set[Symbol] = new mutable.HashSet
diff --git a/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala b/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala
index 43ac9182c3..077cc1d057 100644
--- a/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/DeVirtualize.scala
@@ -7,8 +7,7 @@ package scala.tools.nsc
package typechecker
import symtab.Flags._
-import transform.{InfoTransform, TypingTransformers}
-import scala.tools.nsc.util.{Position, NoPosition}
+import transform.{ InfoTransform, TypingTransformers }
import scala.collection.mutable.ListBuffer
abstract class DeVirtualize extends InfoTransform with TypingTransformers {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
index dbc3ffbe17..ba827f1421 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
@@ -3,7 +3,7 @@ package typechecker
import scala.tools.nsc.symtab.Flags
-import scala.collection.{mutable, immutable}
+import scala.collection.{ mutable, immutable }
/** Duplicate trees and re-type check them, taking care to replace
* and create fresh symbols for new local definitions.
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 51ace68ddc..2313822663 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -6,6 +6,7 @@
package scala.tools.nsc
package typechecker
+import scala.collection.{ mutable, immutable }
import scala.collection.mutable.ListBuffer
import scala.util.control.ControlThrowable
import symtab.Flags._
@@ -78,7 +79,7 @@ trait Infer {
* @throws NoInstance
*/
object instantiate extends TypeMap {
- private var excludedVars = scala.collection.immutable.Set[TypeVar]()
+ private var excludedVars = immutable.Set[TypeVar]()
def apply(tp: Type): Type = tp match {
case WildcardType | BoundedWildcardType(_) | NoType =>
throw new NoInstance("undetermined type")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 3f4ff066d2..472df80df5 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3,17 +3,17 @@
* @author Martin Odersky
*/
-//todo: rewrite or disllow new T where T is a mixin (currently: <init> not a member of T)
+// Added: Sat Oct 7 16:08:21 2006
//todo: use inherited type info also for vars and values
+
+// Added: Thu Apr 12 18:23:58 2007
//todo: disallow C#D in superclass
//todo: treat :::= correctly
package scala.tools.nsc
package typechecker
-import scala.collection.mutable.{HashMap, ListBuffer}
-import scala.util.control.ControlThrowable
-import scala.tools.nsc.interactive.RangePositions
-import scala.tools.nsc.util.{Set, SourceFile, BatchSourceFile}
+import scala.collection.mutable.{ HashMap, ListBuffer }
+import scala.tools.nsc.util.BatchSourceFile
import symtab.Flags._
import util.Statistics
diff --git a/src/compiler/scala/tools/nsc/util/Statistics.scala b/src/compiler/scala/tools/nsc/util/Statistics.scala
index de51c2778c..9b19f4d6d8 100644
--- a/src/compiler/scala/tools/nsc/util/Statistics.scala
+++ b/src/compiler/scala/tools/nsc/util/Statistics.scala
@@ -3,7 +3,6 @@
* @author Martin Odersky
*/
-
package scala.tools.nsc
package util