From bf0e26c04577690bc15dd08eeb706ba0f6fa4cf4 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 9 Oct 2012 19:06:26 +0200 Subject: Proposed fix for SI-6490. Issues a "companions must be in same file" error only if both class and module exist. This can certainly do no harm. I believe it should adress SI-6490, but, lacking a test case, I don't have evidence for that. --- src/compiler/scala/tools/nsc/typechecker/Namers.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 1b2225f5f2..a37dc77d44 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -377,6 +377,8 @@ trait Namers extends MethodSynthesis { && (clazz.sourceFile ne null) && (module.sourceFile ne null) && !(module isCoDefinedWith clazz) + && module.exists + && clazz.exists ) if (fails) { context.unit.error(tree.pos, ( -- cgit v1.2.3