-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
More additions to the standard library #18799
Conversation
45c7724
to
f6cd5c0
Compare
The logic gets refused by the added capture refinements.
Also count abstract types that have a @Sealed annotation on their bound as sealed. That way, we get free propagation into synthesized type parameters. We should probably unify this scheme and `sealed` modifiers.
This needs to be refined further for class members, similar to how we check that private types cannot escape from a class API.
The tricky thing here is how to recognize that a class is pure since that is known only during capture checking and we are at Setup, the phase before. But we can approximate by treating the `Pure` trait as definitely pure.
(capture checks out of the box)
No need for a separate entry in the context's store; we can keep everything in the phase itself, which is more efficient and modular.
Mutable variables can appeal to parametricty only if they are not captured. We use "not captured by any closure" as a sound approximation for that, since variables themselves are currently not tracked, so we cannot use soemthing more finegrained.
@Linyxus Cursory review is fine. Just to get an idea what's in the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the changes to the capture checker and several stdlib files that caught my eyes, but didn't manage to go through every new capture checked library file. LGTM overall!
This is the first version of collections in the standard library that is compiled with capture checking on. We'll use that as a baseline for a comprehensive test case when we refine the capture checking scheme. |
... and fixes to make that happen.