Skip to content

Properly report clashes between classes and objects #10928

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
Jan 4, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 27, 2020

Properly report clashes between classes and objects defined in
different source files.

Fixes #9472

Properly report clashes between classes and objects defined in
different source files.

Fixes scala#9472
*/
def checkNoModuleClash(sym: Symbol)(using Context): Unit =
if sym.effectiveOwner.is(Package)
&& sym.owner.info.member(sym.name.moduleClassName).symbol.isAbsent()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the logic here. It seems that we always call checkNoModuleClash with a module symbol. If that's the case, then shouldn't this symbol always be non-absent? Or is it that this symbol was marked absent when we added the clashing class's symbol as a member?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the latter.

@odersky odersky merged commit 74a653d into scala:master Jan 4, 2021
@odersky odersky deleted the fix-#9472 branch January 4, 2021 10:42
@Kordyjan Kordyjan added this to the 3.0.0 milestone 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.

Compilation loop when companion object is in other file than class
3 participants