diff options
author | Martin Odersky <odersky@gmail.com> | 2006-10-30 17:29:19 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-10-30 17:29:19 +0000 |
commit | 7ebc41cda22ee26d4242e305782a14f7e6bf63aa (patch) | |
tree | 2ead03fe1fae2466677cdcddcbb5ac2e7c4778ed /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 640ecf38b7125ff0d2c926a9a634593640cd95b1 (diff) | |
download | scala-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.scala | 11 |
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 + |