From 0527b2549bcada2fda2201daa630369b377d0877 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Sun, 28 Oct 2012 18:57:30 +0100 Subject: Fixes SI-5031 for separate compilation scenario. When you have a conflicting member in package object and normal package that share the same namespace we remove the latter ClassSymbol from the scope. Now, this has an unpleasant consequence that companionClass/companionModule/companionSymbol no longer work correctly as they rely on finding the correspondent symbol using decls of the owner. This fixes the problem of SI-5031 for separate compilation. Why the above change matters for finding foo.bar.Foo? Because when parsing the class we needed information about the static module (and we have the correct module symbol when completing the info). It's just that 043ce6d0565c9d5d960 relied on no longer valid assumptions. So we were getting NoSymbol and sym.exist was failing. Obviously a more complete solution would be better if we didn't rely on the scope but that's too big to change for 2.10.0. --- test/files/pos/t5031_3/Foo_1.scala | 5 +++++ test/files/pos/t5031_3/Main_2.scala | 6 ++++++ test/files/pos/t5031_3/package.scala | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100644 test/files/pos/t5031_3/Foo_1.scala create mode 100644 test/files/pos/t5031_3/Main_2.scala create mode 100644 test/files/pos/t5031_3/package.scala (limited to 'test') diff --git a/test/files/pos/t5031_3/Foo_1.scala b/test/files/pos/t5031_3/Foo_1.scala new file mode 100644 index 0000000000..5934a6ba79 --- /dev/null +++ b/test/files/pos/t5031_3/Foo_1.scala @@ -0,0 +1,5 @@ +package foo.bar + +object Foo { + def bar = 42 +} diff --git a/test/files/pos/t5031_3/Main_2.scala b/test/files/pos/t5031_3/Main_2.scala new file mode 100644 index 0000000000..2079460b83 --- /dev/null +++ b/test/files/pos/t5031_3/Main_2.scala @@ -0,0 +1,6 @@ +package org.example + +object Main extends App { + println(foo.bar.Foo.bar) +} + diff --git a/test/files/pos/t5031_3/package.scala b/test/files/pos/t5031_3/package.scala new file mode 100644 index 0000000000..23fede7d04 --- /dev/null +++ b/test/files/pos/t5031_3/package.scala @@ -0,0 +1,6 @@ +package foo + +package object bar { + type Foo = Int => String +} + -- cgit v1.2.3