-
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
Reinterpret Scala 2 case accessors xyz$access$idx
#18907
Reinterpret Scala 2 case accessors xyz$access$idx
#18907
Conversation
c5842db
to
ce831a4
Compare
::.next$access$1
when unpickling from Scala 2xyz$access$idx
when unpickling from Scala 2
xyz$access$idx
when unpickling from Scala 2xyz$access$idx
d3e3d16
to
c71e8a1
Compare
@@ -27,12 +27,14 @@ object TestSources { | |||
|
|||
def runFromTastyBlacklistFile: String = "compiler/test/dotc/run-from-tasty.blacklist" | |||
def runTestPicklingBlacklistFile: String = "compiler/test/dotc/run-test-pickling.blacklist" | |||
def runScalaJSBlacklistFile: String = "compiler/test/dotc/run-scala-js.blacklist" |
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.
Use // scalajs: --skip
in the test file instead.
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.
Done
compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
Outdated
Show resolved
Hide resolved
// undistinguishable from non-case parameter accessors (example | ||
// `case class Foo(private[p] var x: T)(private[p] var y: T)`). | ||
val accessorIndex = name.toString().split('$').last.toInt | ||
val accessors = owner.asClass.info.decls |
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 is too dangerous at this point. Store the necessary information in a map like paramsOfMethodType
and clean up when completing the class decls.
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.
Done
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.
Cleaning up when completing the symbol did not work #18907 (comment).
The other option I found is to use symScope(owner)
. This is also used above when skipping other symbols.
c71e8a1
to
3d8c24d
Compare
compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
Outdated
Show resolved
Hide resolved
3d8c24d
to
88276c5
Compare
compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
Outdated
Show resolved
Hide resolved
88276c5
to
a2d2b8c
Compare
// If there was a `<xyz>$access$<idx>` case accessor, we also need to | ||
// make this accessor a case accessor. | ||
if paramAccessorNeedsCaseAccessor(denot.owner.asClass, denot.name) then | ||
denot.setFlag(CaseAccessor) |
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 is setting the flag too late. We have failures with mirrors where we seem to access the symbol flags before we complete the signature.
tests/run/typeclass-derivation3.scala failed
tests/run/i13332intersection.scala failed
a2d2b8c
to
f857c98
Compare
The implementation that was reviewed had a bug
f857c98
to
b035f76
Compare
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.
Meh ... OK then.
Fixes #18884
Related to #18874