summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-10-30 17:29:19 +0000
committerMartin Odersky <odersky@gmail.com>2006-10-30 17:29:19 +0000
commit7ebc41cda22ee26d4242e305782a14f7e6bf63aa (patch)
tree2ead03fe1fae2466677cdcddcbb5ac2e7c4778ed /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent640ecf38b7125ff0d2c926a9a634593640cd95b1 (diff)
downloadscala-7ebc41cda22ee26d4242e305782a14f7e6bf63aa.tar.gz
scala-7ebc41cda22ee26d4242e305782a14f7e6bf63aa.tar.bz2
scala-7ebc41cda22ee26d4242e305782a14f7e6bf63aa.zip
fixed bugs 54, 415
Improved avoidance of MalformedType's
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index f8461e52ef..3e3193f964 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -186,6 +186,8 @@ trait Typers requires Analyzer {
}
if (context.retyping) context.error(pos, msg)
else context.unit.error(pos, msg)
+ if (sym == ObjectClass)
+ throw new FatalError("cannot redefine root "+sym)
case _ =>
context.error(pos, ex)
}
@@ -291,7 +293,14 @@ trait Typers requires Analyzer {
if (badSymbol == NoSymbol) tree
else if (badSymbol.isErroneous) setError(tree)
else {
- val tp1 = heal(tree.tpe)
+ val tp1 = try {
+ heal(tree.tpe)
+ } catch {
+ case ex: MalformedType =>
+ tree.tpe
+ // revert to `tree.tpe', because the healing widening operation would introduce
+ // a malformed type
+ }
if (tp1 eq tree.tpe) {
error(tree.pos,
(if (badSymbol hasFlag PRIVATE) "private " else "") + badSymbol +