Conversation
|
@tkremenek @rjmccall Following discussions on LLVM Dev Meeting, this is a stripped-down version of #78508:
Essentially the PR contains AST-related bits for coroutine declarations and coroutine function types as well as required boilerplate for AST mangling, dumping, serialization, etc. @xedin comments from the original PR were addressed as well. |
|
Please test with following pull request: swiftlang/llvm-project#11396 |
8805213 to
29ab221
Compare
|
Please test with following pull request: swiftlang/llvm-project#11396 |
29ab221 to
28dadc4
Compare
|
Please test with following pull request: swiftlang/llvm-project#11396 |
|
Please test with following pull request: swiftlang/llvm-project#11396 |
|
@rjmccall ping |
|
@rjmccall Ping. Will you please check it out? |
rjmccall
left a comment
There was a problem hiding this comment.
Sorry for letting this slip. I'm confused about the structure of yields that we're modeling here, because we seem to allow a list of (ownership, type) pairs in some places but only a single type in others.
This is a good question :) And I'd suppose this is the similar to what @slavapestov asked about thrown error types: should we allow multiple thrown error types? Or tuple with types, etc. At SIL level we can have multiple yields each could be direct and indirect. Currently declarations only support a single yield type (similar to thrown error type) and it could only be optionally I can potentially support multiple yield types on declarations and all different value ownership, if you think it would make sense. |
|
Error types are different — listing multiple error types is really just saying that the error could be any of the given types. With yields, yeah, I think it's more like a parameter list in the sense that it makes sense to be able to yield multiple independent values at once. Even if accessors don't need it, I think it's consistent to just go ahead and use a type that allows that to be modeled directly. Plus that way you can just have a The grammar you're using already delimits the yields, like |
Right, there is no ambiguity here. Looks like then we will need to extend I will extend the declarations then, looks straightforward. |
- Basic boilerplate for AST coroutines and yields - Coroutine AST types - Parsing of @yield_once and @yields attributes and corresponding type checks
|
@rjmccall This new version allows for multiple yields on declarations as well. Will you please take a look? |
This is a proof-of-concept PR adding AST representation for coroutines
Further background at https://forums.swift.org/t/pitch-yield-once-functions-first-class-coroutines/77081