-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #3638: Fix protected setter generation #3715
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
Conversation
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.
"Fix #3638" should appear somewhere in the commit message.
@@ -0,0 +1,12 @@ | |||
package p { | |||
package a { | |||
class JavaInteraction(arr: Array[Char]) |
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.
It looks like this test was minimized from https://github.com/scala/scala/blob/2.13.x/test/files/jvm/protectedacc.scala, it might be worthwhile to port over the whole test (I think it's a run test but it's in /jvm and not /run so it might need to be run in a special way?).
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 think it can't run on JS because it uses Java classes, that's why it's in jvm. I added the full test to run.
@nicolasstucki The FromTasty test fails on protectedacc.scala. Can you take a look to find out what's wrong? |
I will have a look |
I minimized that issue to package a {
class PolyA {
protected def m(): Unit = ()
}
}
class X extends a.PolyA {
trait Inner {
m()
}
} which can be reproduced with
and fails with
|
The failure is after |
The bug in |
The previous logic made a super accessor private if it is put in a class (on behalf of a nested trait). This caused compilation from Tasty to fail, since at the point of Tasty generation the RHS of the accessor has not yet been generated (it will be generated later in resolveSuper), and therefore Unpickler concluded that the method is private and deferred, which is illegal. Making it private is anyway pointless, since the super accessor is referred to from an inner trait (that's why it was generated in the first place!) and therefore will be made non-private later on.
@@ -80,10 +80,10 @@ class SuperAccessors(thisPhase: DenotTransformer) { | |||
val superAcc = clazz.info.decl(superName) | |||
.suchThat(_.signature == superInfo.signature).symbol | |||
.orElse { | |||
ctx.debuglog(s"add super acc ${sym.showLocated} to $clazz") | |||
val deferredOrPrivate = if (clazz is Trait) Deferred else Private | |||
ctx.debugLog(s"add super acc ${sym.showLocated} to $clazz") |
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.
ctx.debugLog
-> ctx.debuglog
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.
This commit should also Fix #3738
Otherwise LGTM |
No description provided.