-
Notifications
You must be signed in to change notification settings - Fork 200
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
feat: identify invalid captures (and other improvements) #1743
Conversation
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.
Looks good to me (added a few non-blocking questions)
Rewrite the algorithm which analyzes the expressions captured by inflight methods so that it is able to identify more cases and emit errors when captures cannot be qualified (i.e. a resource is captured but we cannot determine which operations are performed on it without static analysis). Merge all `inflight_ref_resource_*` valid tests into `resource_captures` and all negative tests as well.
8c2f74c
to
220f5ed
Compare
@yoav-steinberg @Chriscbr can you take another look here? I think this is done. |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Congrats! 🚀 This was released in Wing 0.5.134. |
Following up on #1682 to identify cases where we cannot infer which operations are performed on a captured resource.
See positive/negative tests for examples.
Rewrite the algorithm which analyzes the expressions captured by inflight methods so that it is able to identify more cases and emit errors when captures cannot be qualified (i.e. a resource is captured but we cannot determine which operations are performed on it without static analysis).
For each method, we identify all expressions that start with
this.xxx
and break them down into parts (using nested references). Then, we traverse the list of parts and split the expression into preflight and inflight. The preflight part is what we are capturing and the first inflight component qualifies which operations are performed on the captured object.Reorganized capture tests into
resource_captures
(both under valid and invalid).This does not address #76 but it explicitly identifies these cases. We will follow up at some point with a way to allow users to explicitly qualify the reference.
By submitting this pull request, I confirm that my contribution is made under the terms of the Monada Contribution License.