@@ -292,6 +292,21 @@ object SymDenotations {
292292 if (isType) fn.toTypeName else fn.toTermName
293293 }
294294
295+
296+ /** The encoded flat name of this denotation, where joined names are separated by `separator` characters. */
297+ def flatName (separator : Char = '$' )(implicit ctx : Context ): Name =
298+ if (symbol == NoSymbol || owner == NoSymbol || owner.isEffectiveRoot || (owner is PackageClass )) name
299+ else {
300+ var owner = this
301+ var sep = " "
302+ do {
303+ owner = owner.owner
304+ sep += separator
305+ } while (! owner.isClass && ! owner.isPackageObject)
306+ val fn = owner.flatName(separator) ++ sep ++ name
307+ if (isType) fn.toTypeName else fn.toTermName
308+ }
309+
295310 /** `fullName` where `.' is the separator character */
296311 def fullName (implicit ctx : Context ): Name = fullNameSeparated('.' )
297312
@@ -622,15 +637,22 @@ object SymDenotations {
622637 * the completers.
623638 */
624639 /** The class implementing this module, NoSymbol if not applicable. */
625- final def moduleClass (implicit ctx : Context ): Symbol =
640+ final def moduleClass (implicit ctx : Context ): Symbol = {
641+ def notFound = {println(s " missing module class for $name: $myInfo" ); NoSymbol }
626642 if (this is ModuleVal )
627643 myInfo match {
628644 case info : TypeRef => info.symbol
629645 case ExprType (info : TypeRef ) => info.symbol // needed after uncurry, when module terms might be accessor defs
630646 case info : LazyType => info.moduleClass
631- case _ => println(s " missing module class for $name: $myInfo" ); NoSymbol
647+ case t : MethodType =>
648+ t.resultType match {
649+ case info : TypeRef => info.symbol
650+ case _ => notFound
651+ }
652+ case _ => notFound
632653 }
633654 else NoSymbol
655+ }
634656
635657 /** The module implemented by this module class, NoSymbol if not applicable. */
636658 final def sourceModule (implicit ctx : Context ): Symbol = myInfo match {
0 commit comments