diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-03 04:25:58 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-03 04:25:58 -0700 |
commit | 98ed94678930e336dab3c1b922c44ff6671b4288 (patch) | |
tree | eeb6715c59d659ab95fa2899e4f7d238eb71b50e /src/compiler | |
parent | 695c5359d3ffd68c602d14d42ecd23fe31aef3d9 (diff) | |
parent | d21f90c2cec03113a7d5971d68bb2d934d8d751f (diff) | |
download | scala-98ed94678930e336dab3c1b922c44ff6671b4288.tar.gz scala-98ed94678930e336dab3c1b922c44ff6671b4288.tar.bz2 scala-98ed94678930e336dab3c1b922c44ff6671b4288.zip |
Merge pull request #2344 from retronym/ticket/7147
SI-7147 Diagnostic for unexplained assertion in presentation compiler.
Diffstat (limited to 'src/compiler')
-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) } } |