Skip to content

Only count associated files of direct members of package objects in dropStale #22190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,9 @@ object SymDenotations {
)
if compiledNow.exists then compiledNow
else
val assocFiles = multi.aggregate(d => Set(d.symbol.associatedFile.nn), _ union _)
val assocFiles = multi
.filterWithPredicate(_.symbol.maybeOwner.isPackageObject)
.aggregate(d => Set(d.symbol.associatedFile.nn), _ union _)
if assocFiles.size == 1 then
multi // they are all overloaded variants from the same file
else
Expand Down
9 changes: 9 additions & 0 deletions tests/pos/i17394/_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package example:
def xd: Int = ???

package bar:
trait A:
def foo: String = ???

package object example extends bar.A:
def foo(x: String): String = ???
4 changes: 4 additions & 0 deletions tests/pos/i17394/_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import example.*

@main def main =
val _ = foo
9 changes: 9 additions & 0 deletions tests/pos/i17394b/_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package example:
def xd: Int = ???

package bar:
trait A:
def foo: String = ???

package object example extends bar.A:
def foo(x: String): String = ???
5 changes: 5 additions & 0 deletions tests/pos/i17394b/_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//> using options -Wunused:imports

import example.{given, *}

@main def main = ()
Loading