summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-11-29 14:40:59 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-11-29 14:48:53 +1000
commitb47aaf6445afe4a6818c31a0ed10e680e6b82c24 (patch)
tree6594622674e008021d083b9c14b829c6022e2d81
parent2bc92e0b2fa9f6de2b2a6c8f9ef4b85492e7df4d (diff)
downloadscala-b47aaf6445afe4a6818c31a0ed10e680e6b82c24.tar.gz
scala-b47aaf6445afe4a6818c31a0ed10e680e6b82c24.tar.bz2
scala-b47aaf6445afe4a6818c31a0ed10e680e6b82c24.zip
SI-8502 Rework handling of stub symbols in unpickler
- Rework previous fixes for SI-8502 to move the creation of a term or type stub symbol during unpickling to the initial point of stub creation, based on the tag. - Just set the PACKAGE flag on class stub symbols created during unpickling `ThisType`, rather than bothering with a different subclass of `StubSymbol` for (assumed) packages.
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala3
-rw-r--r--src/reflect/scala/reflect/internal/pickling/UnPickler.scala7
2 files changed, 4 insertions, 6 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 56b6dc078d..6a7b3fc9a2 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -488,7 +488,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
* often to the point of never.
*/
def newStubSymbol(name: Name, missingMessage: String, isPackage: Boolean = false): Symbol = name match {
- case n: TypeName => if (isPackage) new StubPackageClassSymbol(this, n, missingMessage) else new StubClassSymbol(this, n, missingMessage)
+ case n: TypeName => new StubClassSymbol(this, n, missingMessage)
case _ => new StubTermSymbol(this, name.toTermName, missingMessage)
}
@@ -3423,7 +3423,6 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
override def companionSymbol = fail(NoSymbol)
}
class StubClassSymbol(owner0: Symbol, name0: TypeName, val missingMessage: String) extends ClassSymbol(owner0, owner0.pos, name0) with StubSymbol
- class StubPackageClassSymbol(owner0: Symbol, name0: TypeName, val missingMessage: String) extends PackageClassSymbol(owner0, owner0.pos, name0) with StubSymbol
class StubTermSymbol(owner0: Symbol, name0: TermName, val missingMessage: String) extends TermSymbol(owner0, owner0.pos, name0) with StubSymbol
trait FreeSymbol extends Symbol {
diff --git a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
index 6dea184826..3bc845557f 100644
--- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
+++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
@@ -267,7 +267,8 @@ abstract class UnPickler {
|because it (or its dependencies) are missing. Check your build definition for
|missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
|A full rebuild may help if '$filename' was compiled against an incompatible version of ${owner.fullName}.$advice""".stripMargin
- owner.newStubSymbol(name, missingMessage)
+ val stubName = if (tag == EXTref) name else name.toTypeName
+ owner.newStubSymbol(stubName, missingMessage)
}
}
}
@@ -392,9 +393,7 @@ abstract class UnPickler {
def readThisType(): Type = {
val sym = readSymbolRef() match {
- case stub: StubSymbol if !stub.isClass =>
- // SI-8502 This allows us to create a stub for a unpickled reference to `missingPackage.Foo`.
- stub.owner.newStubSymbol(stub.name.toTypeName, stub.missingMessage, isPackage = true)
+ case stub: StubSymbol => stub.setFlag(PACKAGE)
case sym => sym
}
ThisType(sym)