aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-03-25 12:18:34 +0100
committerMartin Odersky <odersky@gmail.com>2013-03-25 12:18:34 +0100
commit27a508c50482f4053591ed740f09ecced5bf749b (patch)
tree936cf263cc1236bb308cc786c0f7ee0cdc0f2fa8 /src/dotty/tools/dotc/core/Types.scala
parent4a17f0d1e17adecbdc4755bf719feff18d115318 (diff)
downloaddotty-27a508c50482f4053591ed740f09ecced5bf749b.tar.gz
dotty-27a508c50482f4053591ed740f09ecced5bf749b.tar.bz2
dotty-27a508c50482f4053591ed740f09ecced5bf749b.zip
More fixes for classfile reading.
In particular: Survive malformed type errors. Make trees cloneable. and others more.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 9f5a56df7..c349bc7ba 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -383,13 +383,8 @@ object Types {
/** If this is an alias type, its alias, otherwise the type itself */
final def dealias(implicit ctx: Context): Type = this match {
- case tp: TypeRef =>
- tp.info match {
- case TypeBounds(lo, hi) if lo eq hi => hi.dealias
- case _ => this
- }
- case _ =>
- this
+ case tp: TypeRef if (tp.symbol.isAliasType) => tp.info.bounds.hi
+ case _ => this
}
/** Widen from constant type to its underlying non-constant
@@ -860,8 +855,10 @@ object Types {
lastDenotation.current
} else {
val d = loadDenot
- if (d.exists && !d.symbol.isAliasType && !prefix.isLegalPrefix)
- throw new MalformedType(prefix, d.asInstanceOf[SymDenotation])
+ if (d.exists && !d.symbol.isAliasType && !prefix.isLegalPrefix) {
+ val ex = new MalformedType(prefix, d)
+ if (ctx.checkPrefix) throw ex else ctx.log(ex.getMessage)
+ }
if (d.exists || ctx.phaseId == FirstPhaseId)
d
else // name has changed; try load in earlier phase and make current
@@ -1660,7 +1657,7 @@ object Types {
class TypeError(msg: String) extends Exception(msg)
class FatalTypeError(msg: String) extends TypeError(msg)
- class MalformedType(pre: Type, denot: SymDenotation)
+ class MalformedType(pre: Type, denot: Denotation)
extends FatalTypeError(s"malformed type: $pre is not a legal prefix for $denot")
class CyclicReference(denot: SymDenotation)
extends FatalTypeError(s"cyclic reference involving $denot")