Skip to content
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

Expand Capability types T to T^ only if no explicit capture set is given #21375

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Aug 12, 2024

If C is a class extending caps.Capability we used to always expand C to C^, even if there was an explicitly given capture set. For instance C^{x} got expanded to C^{cap}^{x} which caused a redundant capture x warning.

We now do this expansion only if there is no explicitly given capture set.

@natsukagami I hope this helps the Async use case.

We now also use cap as the default for the self type's capture set if a base class
has an explicit self type, but that type's capture set is universal. This requires
fewer self type annotations.
@odersky odersky changed the title Expand Capability types T to T^ only if not explicit capture set is given Expand Capability types T to T^ only if no explicit capture set is given Aug 12, 2024
@odersky odersky requested a review from bracevac August 12, 2024 19:06
@odersky odersky force-pushed the capability-refinements branch from 5e7de2e to 5dd0bf7 Compare August 12, 2024 19:27
Copy link
Contributor

@bracevac bracevac left a comment

Choose a reason for hiding this comment

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

LGTM!

@bracevac bracevac merged commit 99f431e into scala:main Aug 15, 2024
28 checks passed
@bracevac bracevac deleted the capability-refinements branch August 15, 2024 13:10
@WojciechMazur WojciechMazur added this to the 3.6.0 milestone Oct 8, 2024
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.

3 participants