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

Detect symbols inherited into package objects in ambiguity warning #10456

Merged
merged 1 commit into from Jul 5, 2023

Conversation

lrytz
Copy link
Member

@lrytz lrytz commented Jul 4, 2023

Symbols defined in package objects are not competing. The corresponding test failed to identify symbols inherited into package objects.

Fixes scala/bug#12816

Another follow-up for #10220

@som-snytt
Copy link
Contributor

Very nice test!

I see in pos/t11921c, I added a test because of a Scaladoc test that exercises the code pattern where "nobody codes like that". But I suspect I did not think analytically about the case.

And I vaguely remember foundCompetingSymbol because of its unusual type (as a function), but not the details. I will never remember the isPackageXXX or hasPackageFlag API without an hour of research, like "cramming" for an exam and immediately forgetting whatever I may have learned.

I was about to say that I'm still not convinced that it's a false positive, while looking at your test, but from that previous pos test, I see that I must have decided the opposite back then. Who am I to argue with my past self?

My only annoying comment is that I prefer code comments to precede the block they document, so that it's easier to read the code as if the comment were folded (because usually I use vi). But it would be rude of me to prefer my quirk over your comfort level. I like the careting [sic], we should do that more often.

// look
if (b) case1
// look again
else case 2
//   ^^^^

Copy link
Contributor

@som-snytt som-snytt left a comment

Choose a reason for hiding this comment

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

You convinced me!

Symbols defined in package objects are not competing. The corresponding
test failed to identify symbols inherited into package objects.
@lrytz lrytz merged commit 364ee69 into scala:2.13.x Jul 5, 2023
3 checks passed
@som-snytt
Copy link
Contributor

@lrytz thanks for updating the dotty PR. I see from the tests that that was where I changed my mind about this issue. Now, of course, I am agnostic, or possibly just apostate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants