Skip to content

Commit

Permalink
Don't treat package object's <init> methods as package members
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Jan 11, 2023
1 parent f56089b commit 63ff0c6
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit 63ff0c6

Please sign in to comment.