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

Conversation

dwijnand
Copy link
Member

@dwijnand dwijnand commented Jan 11, 2023

Extends b848c57 (#7862) to all packages.

Previously when asking for dotty.tools.dotc.util.<init> we'd get a TypeError because both
LinearMap$package's and LinearSet$package's constructors have the same modification time (in the jar).

@dwijnand
Copy link
Member Author

@odersky I'm reading b848c57 (#7862) as accidentally being scala package only.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is OK. For clarity I'd consider changing it like this:

      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 then denots
        else recur(packageObjs, NoDenotation)
      else recur(packageObjs, NoDenotation)

@dwijnand dwijnand marked this pull request as ready for review January 11, 2023 22:22
@dwijnand dwijnand requested a review from odersky January 11, 2023 22:22
@Kordyjan Kordyjan added this to the 3.3.0-RC1 milestone Jan 12, 2023
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@odersky odersky merged commit a90338d into scala:main Jan 13, 2023
@dwijnand dwijnand deleted the ignore-package-objects-inits branch January 13, 2023 09:46
@Kordyjan Kordyjan modified the milestones: 3.3.0-RC1, 3.3.0 Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synthetic top-level <init> member causes Types.member to crash -Wunused:all causes a compilation error
3 participants