Skip to content

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Nov 27, 2025

This reverts one commit in #24556 but keeps its logic. It just moves the code elsewhere.

 - Completely drop all retains-like annotations if cc is not enabled somewhere.
   This is the same as in the reverted commit but now done in Annotation.mapWith

 - Strip nonsensical parts of retains-like annotations to avoid blowup.

 - Revise Annotation#refersToParamOf to account for type arguments (this is
   a correctness fix; we could have gotten wrog behavior before).
if arg.isType then
arg.tpe.existsPart(isLambdaParam, stopAt = StopAt.Static)
else
arg.existsSubTree:
Copy link
Member

@mbovel mbovel Nov 28, 2025

Choose a reason for hiding this comment

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

Great, that partially (or completely?) fixes #22008 (and is similar to what I suggested in #22001 (comment)).

Copy link
Contributor Author

@odersky odersky Nov 29, 2025

Choose a reason for hiding this comment

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

Ah, good. I had not seen that issue before! I discovered this after a lengthy debug session where I wondered why my changes to mapWith would cause lots of errors with orphan parameters in pickling. So I assume we can close #22008? I see that not: Term trees generated by macros might still cause problems.

Copy link
Member

Choose a reason for hiding this comment

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

I discovered this after a lengthy debug session

Sorry for the loss of time; we should probably have added a TODO when we discussed the bug first.

I see that not: Term trees generated by macros might still cause problems.

Yes, that's a concern.

And outside of macros, are we sure that TermParamRef really can't appear in types of trees other than Ident, This or TypeTree? I don't know how to validate that assumption. Morally, I still feel the safe and correct implementation should be to visit each type part of each tree as in #22001 (comment). But that might be a performance hit.


def sanitize(tp: Type): Type = tp match
case SkolemType(_) =>
SkolemType(defn.AnyType)
Copy link
Member

Choose a reason for hiding this comment

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

I trust the author about the capture checking part 😄

Co-authored-by: Matt Bovel <matthieu@bovel.net>
@mbovel
Copy link
Member

mbovel commented Nov 29, 2025

Unrelated intermittent network failure in scala-library-sjs, I relaunched it.

@mbovel mbovel merged commit 2953eab into scala:main Nov 29, 2025
85 of 86 checks passed
@mbovel mbovel deleted the fix-24556 branch November 29, 2025 12:59
@WojciechMazur WojciechMazur added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Dec 3, 2025
@WojciechMazur WojciechMazur added this to the 3.8.0 milestone Dec 3, 2025
@WojciechMazur WojciechMazur added backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" and removed backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. labels Dec 3, 2025
WojciechMazur pushed a commit that referenced this pull request Dec 3, 2025
This reverts one commit in #24556 but keeps its logic. It just moves the
code elsewhere.

---------

Co-authored-by: Matt Bovel <matthieu@bovel.net>
[Cherry-picked 2953eab]
WojciechMazur added a commit that referenced this pull request Dec 3, 2025
…8.0 (#24639)

Backports #24564 to the 3.8.0-RC3.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur added backport:done This PR was successfully backported. and removed backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" labels Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:done This PR was successfully backported.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants