diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-02 14:58:46 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-02 15:03:56 +0200 |
commit | d21f90c2cec03113a7d5971d68bb2d934d8d751f (patch) | |
tree | dc8f288a82d7fb730a1ebe85b282ec00a3ec9435 /src | |
parent | a4785baf83f8655399bcfe865962fe4d1ef48e59 (diff) | |
download | scala-d21f90c2cec03113a7d5971d68bb2d934d8d751f.tar.gz scala-d21f90c2cec03113a7d5971d68bb2d934d8d751f.tar.bz2 scala-d21f90c2cec03113a7d5971d68bb2d934d8d751f.zip |
SI-7147 Diagnostic for unexplained assertion in presentation compiler.
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala index 348c7f688f..9e5186b731 100644 --- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala +++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala @@ -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) } } |