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

Handle case where abstract overrides miss an implementation #14893

Merged
merged 1 commit into from
Apr 20, 2022

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 8, 2022

Fixes #11170

import apackage._
import bpackage._

case class C(override protected val x: Int) extends A with B // error
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should compile. "It's just a protected member." The ticket says it compiles if everything is in a single package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But Scala 2.13 also refuses this one. Is that a known bug?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see Scala 3 has a different definition of protected. It disalllows access to protected Java members from traits

illegal access to protected method test in class Base from trait Ext

at scala/bug#3564

Maybe Scala just makes everything public if it wants to do something like that.

Copy link
Contributor

Choose a reason for hiding this comment

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

The Scala 3 ticket was noticed at scala/bug#12249 which is just Scala classes. The other link is a Java base class with protected member. I haven't reflected deeply yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure about it either. But at least we don't crash anymore, and do the same thing as Scala 2.13 does.

@bishabosha bishabosha merged commit fa59847 into scala:main Apr 20, 2022
@bishabosha bishabosha deleted the fix-11170 branch April 20, 2022 15:34
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 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.

AssertionError in rebindSuper
4 participants