Skip to content

Commit da176c3

Browse files
Only count associated files of direct members of package objects in dropStale (#22190)
possible fix for #17394
1 parent 2dbb27c commit da176c3

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/SymDenotations.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -2539,7 +2539,9 @@ object SymDenotations {
25392539
)
25402540
if compiledNow.exists then compiledNow
25412541
else
2542-
val assocFiles = multi.aggregate(d => Set(d.symbol.associatedFile.nn), _ union _)
2542+
val assocFiles = multi
2543+
.filterWithPredicate(_.symbol.maybeOwner.isPackageObject)
2544+
.aggregate(d => Set(d.symbol.associatedFile.nn), _ union _)
25432545
if assocFiles.size == 1 then
25442546
multi // they are all overloaded variants from the same file
25452547
else

Diff for: tests/pos/i17394/_1.scala

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package example:
2+
def xd: Int = ???
3+
4+
package bar:
5+
trait A:
6+
def foo: String = ???
7+
8+
package object example extends bar.A:
9+
def foo(x: String): String = ???

Diff for: tests/pos/i17394/_2.scala

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import example.*
2+
3+
@main def main =
4+
val _ = foo

Diff for: tests/pos/i17394b/_1.scala

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package example:
2+
def xd: Int = ???
3+
4+
package bar:
5+
trait A:
6+
def foo: String = ???
7+
8+
package object example extends bar.A:
9+
def foo(x: String): String = ???

Diff for: tests/pos/i17394b/_2.scala

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//> using options -Wunused:imports
2+
3+
import example.{given, *}
4+
5+
@main def main = ()

0 commit comments

Comments
 (0)