summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/reflect/scala/reflect/internal/pickling/UnPickler.scala')
-rw-r--r--src/reflect/scala/reflect/internal/pickling/UnPickler.scala21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
index b4152c9b8c..16fbab7103 100644
--- a/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
+++ b/src/reflect/scala/reflect/internal/pickling/UnPickler.scala
@@ -246,14 +246,15 @@ abstract class UnPickler {
adjust(mirrorThatLoaded(owner).missingHook(owner, name)) orElse {
// (4) Create a stub symbol to defer hard failure a little longer.
val advice = moduleAdvice(s"${owner.fullName}.$name")
+ val lazyCompletingSymbol = completingStack.headOption.getOrElse(NoSymbol)
val missingMessage =
- s"""|missing or invalid dependency detected while loading class file '$filename'.
- |Could not access ${name.longString} in ${owner.kindString} ${owner.fullName},
- |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.)
+ s"""|Symbol '${name.nameKind} ${owner.fullName}.$name' is missing from the classpath.
+ |This symbol is required by '${lazyCompletingSymbol.kindString} ${lazyCompletingSymbol.fullName}'.
+ |Make sure that ${name.longString} is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
|A full rebuild may help if '$filename' was compiled against an incompatible version of ${owner.fullName}.$advice""".stripMargin
val stubName = if (tag == EXTref) name else name.toTypeName
- owner.newStubSymbol(stubName, missingMessage)
+ // The position of the error message is set by `newStubSymbol`
+ NoSymbol.newStubSymbol(stubName, missingMessage)
}
}
}
@@ -696,11 +697,18 @@ abstract class UnPickler {
new TypeError(e.msg)
}
+ /** Keep track of the symbols pending to be initialized.
+ *
+ * Useful for reporting on stub errors and cyclic errors.
+ */
+ private var completingStack = List.empty[Symbol]
+
/** A lazy type which when completed returns type at index `i`. */
private class LazyTypeRef(i: Int) extends LazyType with FlagAgnosticCompleter {
private val definedAtRunId = currentRunId
private val p = phase
protected def completeInternal(sym: Symbol) : Unit = try {
+ completingStack = sym :: completingStack
val tp = at(i, () => readType(sym.isTerm)) // after NMT_TRANSITION, revert `() => readType(sym.isTerm)` to `readType`
// This is a temporary fix allowing to read classes generated by an older, buggy pickler.
@@ -723,7 +731,10 @@ abstract class UnPickler {
}
catch {
case e: MissingRequirementError => throw toTypeError(e)
+ } finally {
+ completingStack = completingStack.tail
}
+
override def complete(sym: Symbol) : Unit = {
completeInternal(sym)
if (!isCompilerUniverse) markAllCompleted(sym)