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

Reinterpret Scala 2 case accessors xyz$access$idx #18907

Merged

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 13, 2023

Fixes #18884
Related to #18874

@nicolasstucki nicolasstucki self-assigned this Nov 13, 2023
@nicolasstucki nicolasstucki force-pushed the remove-list-cons-next-access-1 branch 2 times, most recently from c5842db to ce831a4 Compare November 13, 2023 12:07
@nicolasstucki nicolasstucki changed the title Reinterpret ::.next$access$1 when unpickling from Scala 2 Reinterpret case accessors xyz$access$idx when unpickling from Scala 2 Nov 13, 2023
@nicolasstucki nicolasstucki changed the title Reinterpret case accessors xyz$access$idx when unpickling from Scala 2 Reinterpret Scala 2 case accessors xyz$access$idx Nov 13, 2023
@nicolasstucki nicolasstucki force-pushed the remove-list-cons-next-access-1 branch 5 times, most recently from d3e3d16 to c71e8a1 Compare November 14, 2023 08:15
@nicolasstucki nicolasstucki marked this pull request as ready for review November 14, 2023 12:34
@nicolasstucki nicolasstucki assigned sjrd and unassigned nicolasstucki Nov 14, 2023
@@ -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"
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// 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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

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.

// 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)
Copy link
Contributor Author

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

@nicolasstucki nicolasstucki dismissed sjrd’s stale review November 17, 2023 08:42

The implementation that was reviewed had a bug

Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

Meh ... OK then.

@nicolasstucki nicolasstucki merged commit 50498d8 into scala:main Nov 17, 2023
18 checks passed
@nicolasstucki nicolasstucki deleted the remove-list-cons-next-access-1 branch November 17, 2023 10:31
@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 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.

Cons next leaks through next$access$1
3 participants