Skip to content

Commit

Permalink
SI-7147 Diagnostic for unexplained assertion in presentation compiler.
Browse files Browse the repository at this point in the history
We don't have a reproducible test for this, so the best we can
do is beef up the assertion to shine a little light on the problem.
  • Loading branch information
retronym committed Apr 2, 2013
1 parent a4785ba commit d21f90c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
Expand Up @@ -97,8 +97,15 @@ abstract class SymbolLoaders {
val clazz = enterClass(root, name, completer)
val module = enterModule(root, name, completer)
if (!clazz.isAnonymousClass) {
assert(clazz.companionModule == module, module)
assert(module.companionClass == clazz, clazz)
// Diagnostic for SI-7147
def msg: String = {
def symLocation(sym: Symbol) = if (sym == null) "null" else s"${clazz.fullLocationString} (from ${clazz.associatedFile})"
sm"""Inconsistent class/module symbol pair for `$name` loaded from ${symLocation(root)}.
|clazz = ${symLocation(clazz)}; clazz.companionModule = ${clazz.companionModule}
|module = ${symLocation(module)}; module.companionClass = ${module.companionClass}"""
}
assert(clazz.companionModule == module, msg)
assert(module.companionClass == clazz, msg)
}
}

Expand Down

0 comments on commit d21f90c

Please sign in to comment.