diff options
author | Martin Odersky <odersky@gmail.com> | 2013-04-04 14:45:17 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-04-04 14:45:17 +0200 |
commit | e8b9ef29f6e0a0ba4f0e51943c80ba2974b0e27e (patch) | |
tree | 91e3be26d625b7c55c0d81a18ba25446a0a347da /src/dotty/tools/dotc/core/SymDenotations.scala | |
parent | 9cd15421432871b920d377af86e1cd1b3edb270e (diff) | |
download | dotty-e8b9ef29f6e0a0ba4f0e51943c80ba2974b0e27e.tar.gz dotty-e8b9ef29f6e0a0ba4f0e51943c80ba2974b0e27e.tar.bz2 dotty-e8b9ef29f6e0a0ba4f0e51943c80ba2974b0e27e.zip |
Fxing cyclic references during findMember
1) Classes and alias type now take precedence over abstract types.
2) When computing members, parents are visited right to left, which corresponds to existing taking precedence
over new in mergeDenot.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 3f0ad171a..1d806edc1 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -825,24 +825,22 @@ object SymDenotations { println(s"$this.member($name), ownDenots = $ownDenots") def collect(denots: PreDenotation, parents: List[TypeRef]): PreDenotation = parents match { case p :: ps => - val denots1 = p.symbol.denot match { + val denots1 = collect(denots, ps) + p.symbol.denot match { case parentd: ClassDenotation => if (debugTrace) { // DEBUG val s1 = parentd.membersNamed(name) val s2 = s1.filterExcluded(Private) - val s3 = s2.asSeenFrom(thisType) - val s4 = s3.filterDisjoint(ownDenots) - println(s"$this.member($name) $s1 $s2 $s3 $s4") + val s3 = s2.disjointAsSeenFrom(ownDenots, thisType) + println(s"$this.member($name) $s1 $s2 $s3") } - denots union + denots1 union parentd.membersNamed(name) .filterExcluded(Private) - .asSeenFrom(thisType) - .filterDisjoint(ownDenots) + .disjointAsSeenFrom(ownDenots, thisType) case _ => - denots + denots1 } - collect(denots1, ps) case _ => denots } @@ -895,7 +893,7 @@ object SymDenotations { NoType } - ctx.traceIndented(s"$tp.baseType($this)") { + ctx.traceIndented(s"$tp.baseType($this) ${tp.typeSymbol.fullName} ${this.fullName}") { if (symbol.isStatic) symbol.typeConstructor else tp match { case tp: CachedType => @@ -905,10 +903,10 @@ object SymDenotations { } var basetp = baseTypeCache get tp if (basetp == null) { - baseTypeCache.put(tp, NoType) + baseTypeCache.put(tp, NoPrefix) basetp = computeBaseTypeOf(tp) baseTypeCache.put(tp, basetp) - } else if (basetp == NoType) { + } else if (basetp == NoPrefix) { throw new CyclicReference(symbol) } basetp |