summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc
diff options
context:
space:
mode:
authorMiles Sabin <miles@milessabin.com>2010-01-25 16:14:02 +0000
committerMiles Sabin <miles@milessabin.com>2010-01-25 16:14:02 +0000
commit02c6aa766b53523dbb126fd5f8236becfe09036e (patch)
tree0e5c3f2d83d603ddac96ec4cf350ace85877d27a /src/compiler/scala/tools/nsc
parent34bc787b0884dda9e6ad0a75f66ea88b43d8304e (diff)
downloadscala-02c6aa766b53523dbb126fd5f8236becfe09036e.tar.gz
scala-02c6aa766b53523dbb126fd5f8236becfe09036e.tar.bz2
scala-02c6aa766b53523dbb126fd5f8236becfe09036e.zip
Use file paths for equality and hashCode to dea...
Use file paths for equality and hashCode to deal with mixed-type file equality test issues in the IDE. Fixes #2931.
Diffstat (limited to 'src/compiler/scala/tools/nsc')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/SourceFile.scala4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 08671526e6..3504f019d4 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -701,12 +701,12 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
// ----------- Units and top-level classes and objects --------
private var unitbuf = new ListBuffer[CompilationUnit]
- var compiledFiles = new HashSet[AbstractFile]
+ var compiledFiles = new HashSet[String]
/** add unit to be compiled in this run */
private def addUnit(unit: CompilationUnit) {
unitbuf += unit
- compiledFiles += unit.source.file
+ compiledFiles += unit.source.file.path
}
/* An iterator returning all the units being compiled in this run */
@@ -855,7 +855,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
" was found\n(This file cannot be loaded as a source file)"
inform(msg)
throw new FatalError(msg)
- } else if (!(compiledFiles contains file)) {
+ } else if (!(compiledFiles contains file.path)) {
compileLate(new CompilationUnit(getSourceFile(file)))
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 3fd1c2f36b..d8a0d0a166 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -553,7 +553,7 @@ trait Typers { self: Analyzer =>
sym.rawInfo.isInstanceOf[loaders.ClassfileLoader] && {
sym.rawInfo.load(sym)
(sym.sourceFile ne null) &&
- (currentRun.compiledFiles contains sym.sourceFile)
+ (currentRun.compiledFiles contains sym.sourceFile.path)
}
}
diff --git a/src/compiler/scala/tools/nsc/util/SourceFile.scala b/src/compiler/scala/tools/nsc/util/SourceFile.scala
index e8b6a1c63c..e864c1e153 100644
--- a/src/compiler/scala/tools/nsc/util/SourceFile.scala
+++ b/src/compiler/scala/tools/nsc/util/SourceFile.scala
@@ -55,10 +55,10 @@ class BatchSourceFile(val file : AbstractFile, val content: Array[Char]) extends
def this(file: AbstractFile, cs: Seq[Char]) = this(file, cs.toArray)
override def equals(that : Any) = that match {
- case that : BatchSourceFile => file == that.file
+ case that : BatchSourceFile => file.path == that.file.path
case _ => false
}
- override def hashCode = file.hashCode
+ override def hashCode = file.path.hashCode
val length = content.length
// in SourceFileFragments, these are overridden to compensate during offset calculation