@@ -1760,7 +1760,6 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
17601760
17611761 /** Is this symbol defined in the same scope and compilation unit as `that` symbol? */
17621762 def isCoDefinedWith (that : Symbol ) = {
1763- import language .reflectiveCalls
17641763 (this .rawInfo ne NoType ) &&
17651764 (this .effectiveOwner == that.effectiveOwner) && {
17661765 ! this .effectiveOwner.isPackageClass ||
@@ -2431,7 +2430,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
24312430
24322431 override def moduleClass = referenced
24332432 override def companionClass =
2434- flatOwnerInfo.decl(name.toTypeName).suchThat(_ isCoDefinedWith this )
2433+ flatOwnerInfo.decl(name.toTypeName).suchThat(sym => sym.isClass && (sym isCoDefinedWith this ) )
24352434
24362435 override def owner = {
24372436 Statistics .incCounter(ownerCount)
@@ -2796,7 +2795,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
27962795 */
27972796 protected final def companionModule0 : Symbol =
27982797 flatOwnerInfo.decl(name.toTermName).suchThat(
2799- sym => sym.hasFlag( MODULE ) && (sym isCoDefinedWith this ) && ! sym.isMethod)
2798+ sym => sym.isModule && (sym isCoDefinedWith this ) && ! sym.isMethod)
28002799
28012800 override def companionModule = companionModule0
28022801 override def companionSymbol = companionModule0
@@ -3119,7 +3118,6 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
31193118 }
31203119
31213120 case class InvalidCompanions (sym1 : Symbol , sym2 : Symbol ) extends Throwable ({
3122- import language .reflectiveCalls
31233121 " Companions '" + sym1 + " ' and '" + sym2 + " ' must be defined in same file:\n " +
31243122 " Found in " + sym1.sourceFile.canonicalPath + " and " + sym2.sourceFile.canonicalPath
31253123 }) {
0 commit comments