diff options
author | Martin Odersky <odersky@gmail.com> | 2015-10-25 12:54:11 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-10-25 13:28:34 +0100 |
commit | 4b1d08928bd008a23fa40490d2998e58a6f06c4d (patch) | |
tree | ccaecfce1b90b2aeef1b851841d20b8531eeb556 /src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala | |
parent | dbc668f074b6e121f00a6a63ea55d1a3077f7eb1 (diff) | |
download | dotty-4b1d08928bd008a23fa40490d2998e58a6f06c4d.tar.gz dotty-4b1d08928bd008a23fa40490d2998e58a6f06c4d.tar.bz2 dotty-4b1d08928bd008a23fa40490d2998e58a6f06c4d.zip |
Represent references to Scala2 inner classes as WithFixedSym types
Reason: An inner Scala2 class might be shadowed by a same-named class in a subtype.
In Dotty this is disallowed butin Scala 2 it is possible. For instance, math.Numeric
and math.Ordering both have an inner class "Ops". Normal TypeRef types could not
select the shadowed class in Ordering is the prefix is of type Numeric.
Diffstat (limited to 'src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index a746d81db..c7df3c400 100644 --- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -686,7 +686,10 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas case _ => } val tycon = - if (isLocal(sym) || pre == NoPrefix) { + if (sym.isClass && sym.is(Scala2x) && !sym.owner.is(Package)) + // used fixed sym for Scala 2 inner classes, because they might be shadowed + TypeRef.withFixedSym(pre, sym.name.asTypeName, sym.asType) + else if (isLocal(sym) || pre == NoPrefix) { val pre1 = if ((pre eq NoPrefix) && (sym is TypeParam)) sym.owner.thisType else pre pre1 select sym } |