From 65455bbcaace514ea34a30a3fc102c8ecee16498 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Thu, 23 Mar 2017 17:31:43 +0100 Subject: Fix #2137: Create dummy companions for top-level objects without a real one Previously, we sometimes ended up forcing a companion class symbol from a previous run or from the classpath which lead to weird issues like in `false-companion`. Even if we end up not forcing such a symbol, its presence can still lead to issue: before this commit incremental compilation of `dotty-compiler-bootstrapped` was broken because we recorded a false dependency on the non-bootstrapped `dotty-compiler` jar. The added test is currently marked pending because it does not work with JUnit (which doesn't handle separate compilation), only partest. I didn't managed to get it to work right, and this won't be necessary once our testing framework is overhauled by https://github.com/lampepfl/dotty/pull/2125 anyway, so I'll just have to remember to enable this test afterwards. --- tests/pending/pos/false-companion/00_outerinnerTest_2.scala | 5 +++++ tests/pending/pos/false-companion/01_outerinnerFoo_2.scala | 5 +++++ tests/pending/pos/false-companion/outerFoo_1.scala | 2 ++ tests/pending/pos/false-companion/outerinnerFoo_1.scala | 5 +++++ 4 files changed, 17 insertions(+) create mode 100644 tests/pending/pos/false-companion/00_outerinnerTest_2.scala create mode 100644 tests/pending/pos/false-companion/01_outerinnerFoo_2.scala create mode 100644 tests/pending/pos/false-companion/outerFoo_1.scala create mode 100644 tests/pending/pos/false-companion/outerinnerFoo_1.scala (limited to 'tests/pending') diff --git a/tests/pending/pos/false-companion/00_outerinnerTest_2.scala b/tests/pending/pos/false-companion/00_outerinnerTest_2.scala new file mode 100644 index 000000000..8f5802343 --- /dev/null +++ b/tests/pending/pos/false-companion/00_outerinnerTest_2.scala @@ -0,0 +1,5 @@ +package outer +package inner +object Test { + val x: Foo = new Foo +} diff --git a/tests/pending/pos/false-companion/01_outerinnerFoo_2.scala b/tests/pending/pos/false-companion/01_outerinnerFoo_2.scala new file mode 100644 index 000000000..111f7fcd5 --- /dev/null +++ b/tests/pending/pos/false-companion/01_outerinnerFoo_2.scala @@ -0,0 +1,5 @@ +package outer +package inner +object Foo { + // val a: Int = 1 +} diff --git a/tests/pending/pos/false-companion/outerFoo_1.scala b/tests/pending/pos/false-companion/outerFoo_1.scala new file mode 100644 index 000000000..8c2ef109c --- /dev/null +++ b/tests/pending/pos/false-companion/outerFoo_1.scala @@ -0,0 +1,2 @@ +package outer +class Foo diff --git a/tests/pending/pos/false-companion/outerinnerFoo_1.scala b/tests/pending/pos/false-companion/outerinnerFoo_1.scala new file mode 100644 index 000000000..29f3df724 --- /dev/null +++ b/tests/pending/pos/false-companion/outerinnerFoo_1.scala @@ -0,0 +1,5 @@ +package outer +package inner +object Foo { + val a: Int = 1 +} -- cgit v1.2.3