Skip to content

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 5, 2025

A fresh in the capture set of a class field now causes a fresh
to be added to the capture set of every instance of that class.

This caused 18 failures in stdlib of which 2 were significant (the rest was deprecated stuff). So far, we make
this compile with the @caps.unsafe.untrackedCaptures annotation. #24137 explains what would be needed
to fix this in a safer way.

The prefix is mapped as a normal type. It determines whether
the hidden set allows to add new elements. ThisType and NoPrefix
prefixes allow it, other prefixes forbid it.

The pathRoot and ccOwner of a FreshCap now depend on the prefix.
Also: add another test that demonstrates some  behavior relating to default
parameters.

Also: Rename a test so that we don't accidentally get the test file.
In general, it's a bad idea to use a source file name in the compiler code
for a test since we often get the wrong file when loading it into the editor.
Was cap.rd before, which was a left-over of the old model.
Refine the isField test in SymUtils to exclude non-members and phantom symbols
@odersky odersky requested a review from a team as a code owner October 5, 2025 17:47
@odersky odersky added the area:capabilities Issues tied with scala.caps.Capabilities label Oct 5, 2025
A fresh in the capture set of a class field now causes a fresh
to be added to the capture set of every instance of that class.
 - Drop the assertion and handle the case of empty overlap
 - At the same time, avoid the empty overlap by taking complete
   instead of direct footprints.

Also: Improve printing of FreshCap prefixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:capabilities Issues tied with scala.caps.Capabilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant