summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/dependencies/Changes.scala28
-rw-r--r--src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala25
2 files changed, 28 insertions, 25 deletions
diff --git a/src/compiler/scala/tools/nsc/dependencies/Changes.scala b/src/compiler/scala/tools/nsc/dependencies/Changes.scala
index 87e38d8909..db0567993b 100644
--- a/src/compiler/scala/tools/nsc/dependencies/Changes.scala
+++ b/src/compiler/scala/tools/nsc/dependencies/Changes.scala
@@ -101,7 +101,7 @@ abstract class Changes {
case (ExistentialType(tparams1, res1), ExistentialType(tparams2, res2)) =>
sameTypeParams(tparams1, tparams2) && sameType(res1, res2)
case (TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
- sameType(lo1, lo2) && sameType(hi1, hi2)
+ sameType(lo1, lo2) && sameType(hi1, hi2)
case (BoundedWildcardType(bounds), _) =>
bounds containsType tp2
case (_, BoundedWildcardType(bounds)) =>
@@ -133,36 +133,36 @@ abstract class Changes {
}
private def sameTypeParams(tparams1: List[Symbol], tparams2: List[Symbol]) =
- sameTypes(tparams1 map (_.info), tparams2 map (_.info))
+ sameTypes(tparams1 map (_.info), tparams2 map (_.info)) &&
+ sameTypes(tparams1 map (_.tpe), tparams2 map (_.tpe))
def sameTypes(tps1: List[Type], tps2: List[Type]): Boolean =
(tps1.length == tps2.length) && ((tps1, tps2).zipped forall sameType)
- /** Return the list of changes between 'from' and 'to'.
+ /** Return the list of changes between 'from' and 'toSym.info'.
*/
- def changeSet(from: Symbol, to: Symbol): List[Change] = {
+ def changeSet(from: Type, toSym: Symbol): List[Change] = {
implicit val defaultReason = "types"
-// println("changeSet " + from + "(" + from.info + ")"
-// + " vs " + to + "(" + to.info + ")")
+ val to = toSym.info
def omitSymbols(s: Symbol): Boolean = !s.hasFlag(LOCAL | LIFTED | PRIVATE)
val cs = new mutable.ListBuffer[Change]
- if ((from.info.parents zip to.info.parents) exists { case (t1, t2) => !sameType(t1, t2) })
- cs += Changed(toEntity(from))(from.info.parents.zip(to.info.parents).toString)
- if (from.typeParams != to.typeParams)
- cs += Changed(toEntity(from))(" tparams: " + from.typeParams.zip(to.typeParams))
+ if ((from.parents zip to.parents) exists { case (t1, t2) => !sameType(t1, t2) })
+ cs += Changed(toEntity(toSym))(from.parents.zip(to.parents).toString)
+ if (!sameTypeParams(from.typeParams, to.typeParams))
+ cs += Changed(toEntity(toSym))(" tparams: " + from.typeParams.zip(to.typeParams))
// new members not yet visited
val newMembers = mutable.HashSet[Symbol]()
- newMembers ++= to.info.decls.iterator filter omitSymbols
+ newMembers ++= to.decls.iterator filter omitSymbols
- for (o <- from.info.decls.iterator filter omitSymbols) {
- val n = to.info.decl(o.name)
+ for (o <- from.decls.iterator filter omitSymbols) {
+ val n = to.decl(o.name)
newMembers -= n
if (o.isClass)
- cs ++= changeSet(o, n)
+ cs ++= changeSet(o.info, n)
else if (n == NoSymbol)
cs += Removed(toEntity(o))
else {
diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
index 5414b53e0c..9ca9a740df 100644
--- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
+++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
@@ -40,15 +40,15 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
protected def newCompiler(settings: Settings) = new BuilderGlobal(settings)
val compiler = newCompiler(settings)
- import compiler.{Symbol, atPhase, currentRun}
+ import compiler.{Symbol, Type, atPhase, currentRun}
- private case class Symbols(sym: Symbol, symBefErasure: Symbol)
+ private case class SymWithHistory(sym: Symbol, befErasure: Type)
/** Managed source files. */
private val sources: mutable.Set[AbstractFile] = new mutable.HashSet[AbstractFile]
- private val definitions: mutable.Map[AbstractFile, List[Symbols]] =
- new mutable.HashMap[AbstractFile, List[Symbols]] {
+ private val definitions: mutable.Map[AbstractFile, List[SymWithHistory]] =
+ new mutable.HashMap[AbstractFile, List[SymWithHistory]] {
override def default(key: AbstractFile) = Nil
}
@@ -72,7 +72,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
*/
private def invalidatedByRemove(files: Set[AbstractFile]): Set[AbstractFile] = {
val changes = new mutable.HashMap[Symbol, List[Change]]
- for (f <- files; Symbols(sym, _) <- definitions(f))
+ for (f <- files; SymWithHistory(sym, _) <- definitions(f))
changes += sym -> List(Removed(Class(sym.fullNameString)))
invalidated(files, changes)
}
@@ -125,13 +125,12 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
definitions(src).find(
s => (s.sym.fullNameString == sym.fullNameString) &&
isCorrespondingSym(s.sym, sym)) match {
- case Some(Symbols(oldSym, oldSymEras)) =>
- val changes = changeSet(oldSym, sym)
+ case Some(SymWithHistory(oldSym, info)) =>
+ val changes = changeSet(oldSym.info, sym)
val changesErasure =
atPhase(currentRun.erasurePhase.prev) {
- changeSet(oldSymEras, sym)
+ changeSet(info, sym)
}
-
changesOf(oldSym) = (changes ++ changesErasure).removeDuplicates
case _ =>
// a new top level definition
@@ -142,7 +141,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
}
}
// Create a change for the top level classes that were removed
- val removed = definitions(src) filterNot ((s:Symbols) =>
+ val removed = definitions(src) filterNot ((s:SymWithHistory) =>
syms.find(_.fullNameString == (s.sym.fullNameString)) != None)
for (s <- removed) {
changesOf(s.sym) = List(removeChangeSet(s.sym))
@@ -279,7 +278,11 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
private def updateDefinitions(files: Set[AbstractFile]) {
for (src <- files; val localDefs = compiler.dependencyAnalysis.definitions(src)) {
definitions(src) = (localDefs map (s => {
- Symbols(s.cloneSymbol, atPhase(currentRun.erasurePhase.prev) {s.cloneSymbol})
+ SymWithHistory(
+ s.cloneSymbol,
+ atPhase(currentRun.erasurePhase.prev) {
+ s.info.cloneInfo(s)
+ })
}))
}
this.references = compiler.dependencyAnalysis.references