Skip to content
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

Don't treat package object's <init> methods as package members #16667

Merged
merged 1 commit into from
Jan 13, 2023
Merged
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
7 changes: 5 additions & 2 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2515,9 +2515,12 @@ object SymDenotations {
multi.filterWithPredicate(_.symbol.associatedFile == chosen)
end dropStale

if symbol eq defn.ScalaPackageClass then
if name == nme.CONSTRUCTOR then
NoDenotation // packages don't have constructors, even if package objects do.
else if symbol eq defn.ScalaPackageClass then
// revert order: search package first, then nested package objects
val denots = super.computeMembersNamed(name)
if denots.exists || name == nme.CONSTRUCTOR then denots
if denots.exists then denots
else recur(packageObjs, NoDenotation)
else recur(packageObjs, NoDenotation)
end computeMembersNamed
Expand Down