Skip to content

Refactoring: Capabilities as a separate type #23180

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 18, 2025

Split out Capability from Type. There is some overlap: NamedTypes, ParamRefs and ThisTypes are types as well as capabilities. But there are capabilities that are not types (root capabilities and derived capabilities such as x.rd and y*). And there are many kinds of types that are not capabilitities.

The PR does away with the encodings of derived and root capabilities as annotated types and the encoding of cap as a Termref. Both proved to be very fragile in practice, since it was easy to apply some general logic to TermRefs or AnnotatedTypes while overlooking that these need special treatment for encoded capabilities.

Based on #23171. The main commit that introduces the split of capabilities from types is 1b7e08c.

odersky added 5 commits May 15, 2025 17:16
Note i15923 does not signal a leak anymore. I moved it and some variants to pending.
Note: There seems to be something more fundamentally wrong with this test: We get an
infinite recursion for variant i15923b.
There was some accidental type confusion which made every capture root type end up
with cap as pathRoot and caps as pathOwner.
Split out Capability from Type. For now we keep most of the overall structure. E.g. capability handling code is
in file CaptureRef.scala. We will change this afterwards in separate refactorings.
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.

1 participant