diff options
author | Paul Phillips <paulp@improving.org> | 2009-05-04 21:28:24 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-05-04 21:28:24 +0000 |
commit | f5508bac2c012b9a43468c863c2d7186e78ef079 (patch) | |
tree | 0865d295b3af98c473a7a6164dfd83edde250af4 /src/compiler | |
parent | 036b3851c1598fa78f5fa4c4bd671f02cc291f0b (diff) | |
download | scala-f5508bac2c012b9a43468c863c2d7186e78ef079.tar.gz scala-f5508bac2c012b9a43468c863c2d7186e78ef079.tar.bz2 scala-f5508bac2c012b9a43468c863c2d7186e78ef079.zip |
Fix and test case for #1286.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 106b737672..6cae7d5835 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -1045,6 +1045,15 @@ trait Symbols { (that.sourceFile eq null) || (this.sourceFile eq that.sourceFile) || (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 (res == false) { + val (f1, f2) = (this.sourceFile, that.sourceFile) + if (f1 != null && f2 != null && f1 != f2) + throw FatalError("Companions '" + this + "' and '" + that + "' must be defined in same file.") + } + res } |