Skip to content

Fixes for capture checking case class methods#25278

Open
odersky wants to merge 3 commits intoscala:mainfrom
dotty-staging:fix-23823
Open

Fixes for capture checking case class methods#25278
odersky wants to merge 3 commits intoscala:mainfrom
dotty-staging:fix-23823

Conversation

@odersky
Copy link
Contributor

@odersky odersky commented Feb 15, 2026

Fixes #23823.

We special treat primary constructors when we compute the result capture set. We need to do the same for case class apply and copy methods.

The result type is patched when we instantiate one of these methods with arguments. I tried to do that as a transform of the info of these methods instead. That almost worked, but failed because of the unbox operation needed in refineConctructorInstance which needs to know the actual arguments. This is a tricky bit. I added some comments to refineConctructorInstance.

As part of this amandoned attempt to work on info transformers in Setup, I moved a lot of machinery needed by
refineConctructorInstance from CheckCaptures into CaptureOps. It's not strictly necessary to do that since in the final PR the only root call is from CheckCaptures. But it might be needed later, so kept the refactoring.

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.

Local fresh caps are ignored in classes

2 participants

Comments