diff options
author | Martin Odersky <odersky@gmail.com> | 2013-03-25 21:45:20 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-03-25 21:45:20 +0100 |
commit | 5a039031c165fd9116749f28e9d9e6a0b6d5b0e6 (patch) | |
tree | 0a0b956ad7d384cf31a8d2b7835fe716c33d2834 /src/dotty/tools/dotc/core/Types.scala | |
parent | 27a508c50482f4053591ed740f09ecced5bf749b (diff) | |
download | dotty-5a039031c165fd9116749f28e9d9e6a0b6d5b0e6.tar.gz dotty-5a039031c165fd9116749f28e9d9e6a0b6d5b0e6.tar.bz2 dotty-5a039031c165fd9116749f28e9d9e6a0b6d5b0e6.zip |
More fixes to classfile reading.
Can now read entire contents of scala distribution.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index c349bc7ba..35225e8e7 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -257,6 +257,20 @@ object Types { pdenot & new JointRefDenotation(NoSymbol, tp.refinedInfo.substThis(tp, pre), Period.allInRun(ctx.runId)) else pdenot + case tp: ThisType => + val d = tp.underlying.findMember(name, pre, excluded) + if (d.exists) d + else + // There is a special case to handle: + // trait Super { this: Sub => private class Inner {} println(this.Inner) } + // class Sub extends Super + // When resolving Super.this.Inner, the normal logic goes to the self type and + // looks for Inner from there. But this fails because Inner is private. + // We fix the problem by having the following fallback case, which links up the + // member in Super instead of Sub. + // As an example of this in the wild, see + // loadClassWithPrivateInnerAndSubSelf in ShowClassTests + tp.cls.symbolicRef.findMember(name, pre, excluded) case tp: TypeProxy => tp.underlying.findMember(name, pre, excluded) case tp: ClassInfo => @@ -868,6 +882,11 @@ object Types { lastDenotation } + private[core] final def withDenot(denot: Denotation): this.type = { + lastDenotation = denot + this + } + protected def loadDenot(implicit ctx: Context) = prefix.member(name) def isType = name.isTypeName @@ -1659,7 +1678,7 @@ object Types { class FatalTypeError(msg: String) extends TypeError(msg) class MalformedType(pre: Type, denot: Denotation) extends FatalTypeError(s"malformed type: $pre is not a legal prefix for $denot") - class CyclicReference(denot: SymDenotation) + class CyclicReference(val denot: SymDenotation) extends FatalTypeError(s"cyclic reference involving $denot") // ----- Misc utilities --------------------------------------------------------- |