-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow override protected[C] in companion #14105
Conversation
b1196f3
to
536778b
Compare
Getting the local companion fails under |
tests/pos/t12494.scala
Outdated
/* | ||
object X { | ||
// restriction in Scala 2 for local companions | ||
// restriction in Scala 3 under -from-tasty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's going on with -from-tasty exactly here? If something can be compiled it should also work from tasty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asking for companionModule
fails for local class. Perhaps you mean, conversely, if it fails from tasty, it must also fail always. Probably there is a convenient is(Local)
flag check to add to the condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asking for companionModule fails for local class
Hmm that might be a bug since I could see that leading to different behavior in other situations. Also I tried uncommenting this code and running it with testCompilation but the pickling tests didn't fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try again, against the moving target of HEAD.
Maybe something has progressed.
I had to consult the page on how to test your changes:
Same after rebase. |
When extending C in its companion, allow override protected[C] where C denotes the enclosing companion module of C. Lookup of local companion is broken under `-from-tasty`, so this accommodation is disallowed for local companions.
536778b
to
5979401
Compare
Did not research the problem with getting local companion under |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM.
Co-authored-by: Guillaume Martres <smarter@ubuntu.com>
When extending C in its companion, allow
override protected[C] where C denotes the
enclosing companion module of C.
Forward ports scala/scala#9814