summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-03-12 11:13:41 +0000
committerMartin Odersky <odersky@gmail.com>2007-03-12 11:13:41 +0000
commit661c602630e72f7a9a81e6f21ca5cd6946a9618f (patch)
tree2ade95543be3c135d23aeffa9f68f7716711d6f5 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent439588db9565508147dfad5adba9469ffdc7798c (diff)
downloadscala-661c602630e72f7a9a81e6f21ca5cd6946a9618f.tar.gz
scala-661c602630e72f7a9a81e6f21ca5cd6946a9618f.tar.bz2
scala-661c602630e72f7a9a81e6f21ca5cd6946a9618f.zip
Fixed David Pollacks stack overflow problem.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index cfd18731b2..431d21f5f8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1871,14 +1871,16 @@ trait Typers requires Analyzer {
// update `pre' to be `sym's prefix type in case it is an imported member,
// and compute value of:
- // imported symbols take precedence over package-owned symbols in different
- // compilation units
- if (defSym.exists && impSym.exists &&
- defSym.owner.isPackageClass &&
- (!currentRun.compiles(defSym) ||
- (context.unit ne null) && defSym.sourceFile != context.unit.source.file))
- defSym = NoSymbol
-
+ if (defSym.exists && impSym.exists) {
+ // imported symbols take precedence over package-owned symbols in different
+ // compilation units. Defined symbols take precedence over errenous imports.
+ if (defSym.owner.isPackageClass &&
+ (!currentRun.compiles(defSym) ||
+ (context.unit ne null) && defSym.sourceFile != context.unit.source.file))
+ defSym = NoSymbol
+ else if (impSym.isError)
+ impSym = NoSymbol
+ }
if (defSym.exists) {
if (impSym.exists)
ambiguousError(