Skip to content

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Oct 8, 2025

They don't need an intersection when computing member types. Previously we did that
for augmented constructor types through the refinedOverride annotation. But that does
not apply to RefinedTypes with capset variables created in Setup. That's why we
still needed withCollapsedFresh to avoid non-sensical types in intersections.

Based on #24136

odersky added 16 commits October 4, 2025 19:14
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
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
Needed for use checking, since if we just take the leftmost prefix
we sometimes end up with a `this`.
Private fields in publicly accessible classes that contribute fresh caps to their
class still need an explicitly declared type, so that separate compilation can work.
 - Print <skolem> and this as prefix only under -Ycc-verbose
 - Compose a "in new instance of class C" owner for skolem prefixes
They don't need an intersection when computing member types. Previously we did that
for augmented constructor types through the refinedOverride annotation. But that does
not apply to RefinedTypes with capset variables created in Setup. That's why we
still needed withCollapsedFresh to avoid non-sensical types in intersections.
@odersky odersky requested a review from a team as a code owner October 8, 2025 16:53
@odersky
Copy link
Contributor Author

odersky commented Oct 8, 2025

I am leaving thee withCollapsedFresh in for now, since it still might be needed for use-written refinements.

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.

2 participants