-
Notifications
You must be signed in to change notification settings - Fork 181
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
Unable to capture a variable that is an inflight closure #2236
Labels
Comments
I agree it makes sense to support this, but I think there are workarounds available (for example, using #1448 should fix this |
This produces a new error on Wing 0.17.7, but it's the same error as #2236
|
mergify bot
pushed a commit
that referenced
this issue
May 22, 2023
Fixes a limitation that prevented users from calling inflight functions that were defined in preflight. The main thrust of the strategy is to leverage the fact that inflight functions defined in preflight are compiled into classes with a single inflight method named "handle" (#2411) - we can call these "handler classes". To allow for the possibility that values typed as inflight functions could refer to handler classes OR to plain inflight functions (that were declared in an inflight scope, so they didn't need to get converted into a handler class), we desugar inflight call expressions into `typeof <fn> === "function" ? await <fn>() : await <fn>.handle()` to support either case. Fixes #390 Fixes #2236 Fixes #2242 *By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
Congrats! 🚀 This was released in Wing 0.17.22. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tried this
I expected this:
To be possible
Instead, this happened
Is there a workaround?
No response
Component
Compiler
Wing Version
No response
Wing Console Version
No response
Node.js Version
No response
Platform(s)
No response
Anything else?
No response
Community Notes
The text was updated successfully, but these errors were encountered: