summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2010-01-22 16:50:55 +0000
committerMartin Odersky <odersky@gmail.com>2010-01-22 16:50:55 +0000
commitac9fb6ad28b88ee4e7896c93d26c76e80bd3ece3 (patch)
tree7f20bbda87a04c390c3fdf154643b4d7065b0cf8
parent1ab0d9ea486254cc2093bba687b7c9b24bcf23da (diff)
downloadscala-ac9fb6ad28b88ee4e7896c93d26c76e80bd3ece3.tar.gz
scala-ac9fb6ad28b88ee4e7896c93d26c76e80bd3ece3.tar.bz2
scala-ac9fb6ad28b88ee4e7896c93d26c76e80bd3ece3.zip
Second attempt to fix #2926.
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala13
2 files changed, 5 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 35d212071e..0a8477a489 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -466,8 +466,8 @@ self =>
/** The typer run */
class TyperRun extends Run {
// units is always empty
- // symSource, symData are ignored
- override def compiles(sym: Symbol) = false
+
+ //override def compiles(sym: Symbol) = false
def typeCheck(unit: CompilationUnit): Unit = applyPhase(typerPhase, unit)
@@ -503,6 +503,7 @@ self =>
def typedTree(unit: RichCompilationUnit): Tree = {
assert(unit.status >= JustParsed)
unit.targetPos = NoPosition
+ symSource.clear()
typeCheck(unit)
unit.body
}
@@ -511,6 +512,7 @@ self =>
* @return true iff typechecked correctly
*/
private def applyPhase(phase: Phase, unit: CompilationUnit) {
+ symSource.clear()
val oldSource = reporter.getSource
reporter.withSource(unit.source) {
atPhase(phase) { phase.asInstanceOf[GlobalPhase] applyPhase unit }
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 3ef6f3165e..3fd1c2f36b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2076,17 +2076,6 @@ trait Typers { self: Analyzer =>
def includesTargetPos(tree: Tree) =
tree.pos.isRange && context.unit != null && (tree.pos includes context.unit.targetPos)
val localTarget = stats exists includesTargetPos
- val companionOfTarget: Option[Tree] =
- if (localTarget) {
- stats span (!includesTargetPos(_)) match {
- case (pre, (cd: ClassDef) :: _) if cd.symbol hasFlag CASE =>
- pre find {
- case md: ModuleDef => md.symbol.name == cd.symbol.name
- case _ => false
- }
- case _ => None
- }
- } else None
def typedStat(stat: Tree): Tree = {
if (context.owner.isRefinementClass && !treeInfo.isDeclaration(stat))
errorTree(stat, "only declarations allowed here")
@@ -2101,7 +2090,7 @@ trait Typers { self: Analyzer =>
} else
EmptyTree
case _ =>
- if (localTarget && !includesTargetPos(stat) && companionOfTarget != Some(stat)) {
+ if (localTarget && !includesTargetPos(stat)) {
stat
} else {
val localTyper = if (inBlock || (stat.isDef && !stat.isInstanceOf[LabelDef])) this