aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/tasty/TreePickler.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-10-25 12:54:11 +0100
committerMartin Odersky <odersky@gmail.com>2015-10-25 13:28:34 +0100
commit4b1d08928bd008a23fa40490d2998e58a6f06c4d (patch)
treeccaecfce1b90b2aeef1b851841d20b8531eeb556 /src/dotty/tools/dotc/core/tasty/TreePickler.scala
parentdbc668f074b6e121f00a6a63ea55d1a3077f7eb1 (diff)
downloaddotty-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/tasty/TreePickler.scala')
-rw-r--r--src/dotty/tools/dotc/core/tasty/TreePickler.scala35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/src/dotty/tools/dotc/core/tasty/TreePickler.scala
index 58697c196..86bbc893f 100644
--- a/src/dotty/tools/dotc/core/tasty/TreePickler.scala
+++ b/src/dotty/tools/dotc/core/tasty/TreePickler.scala
@@ -148,27 +148,32 @@ class TreePickler(pickler: TastyPickler) {
pickleType(tpe.info.bounds.hi)
case tpe: WithFixedSym =>
val sym = tpe.symbol
+ def pickleRef() =
+ if (tpe.prefix == NoPrefix) {
+ writeByte(if (tpe.isType) TYPEREFdirect else TERMREFdirect)
+ pickleSymRef(sym)
+ }
+ else {
+ assert(tpe.symbol.isClass)
+ assert(tpe.symbol.is(Flags.Scala2x), tpe.symbol.showLocated)
+ writeByte(TYPEREF) // should be changed to a new entry that keeps track of prefix, symbol & owner
+ pickleName(tpe.name)
+ pickleType(tpe.prefix)
+ }
if (sym.is(Flags.Package)) {
writeByte(if (tpe.isType) TYPEREFpkg else TERMREFpkg)
pickleName(qualifiedName(sym))
}
- else {
- assert(tpe.prefix == NoPrefix)
- def pickleRef() = {
- writeByte(if (tpe.isType) TYPEREFdirect else TERMREFdirect)
- pickleSymRef(sym)
- }
- if (sym is Flags.BindDefinedType) {
- registerDef(sym)
- writeByte(BIND)
- withLength {
- pickleName(sym.name)
- pickleType(sym.info)
- pickleRef()
- }
+ else if (sym is Flags.BindDefinedType) {
+ registerDef(sym)
+ writeByte(BIND)
+ withLength {
+ pickleName(sym.name)
+ pickleType(sym.info)
+ pickleRef()
}
- else pickleRef()
}
+ else pickleRef()
case tpe: TermRefWithSignature =>
if (tpe.symbol.is(Flags.Package)) picklePackageRef(tpe.symbol)
else {