diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 6a15c929b9..7aa15d2e42 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -1224,19 +1224,22 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => /** Is this symbol defined in the same scope and compilation unit as `that' symbol? */ - def isCoDefinedWith(that: Symbol) = (this.rawInfo ne NoType) && { - !this.owner.isPackageClass || - (this.sourceFile eq null) || - (that.sourceFile eq null) || - (this.sourceFile == that.sourceFile) || { - // recognize companion object in separate file and fail, else compilation - // appears to succeed but highly opaque errors come later: see bug #1286 - if (this.sourceFile.path != that.sourceFile.path) - throw InvalidCompanions(this, that) - - false + def isCoDefinedWith(that: Symbol) = ( + (this.rawInfo ne NoType) && + (this.owner == that.owner) && { + !this.owner.isPackageClass || + (this.sourceFile eq null) || + (that.sourceFile eq null) || + (this.sourceFile == that.sourceFile) || { + // recognize companion object in separate file and fail, else compilation + // appears to succeed but highly opaque errors come later: see bug #1286 + if (this.sourceFile.path != that.sourceFile.path) + throw InvalidCompanions(this, that) + + false + } } - } + ) /** The internal representation of classes and objects: * |