Skip to content

[CSApply] For-in: Extend try injector to handle erasure and opened … #61920

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

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Nov 3, 2022

…existential

For synthesized <async iterator>.next() calls expression rewriter
has to check whether witness is throwing and add try when necessary,
in order to do that injector needs to look through opened existentials,
erasures, and other implicitly injected AST nodes.

…existential

For synthesized `<async iterator>.next()` calls expression rewriter
has to check whether witness is throwing and add `try` when necessary,
in order to do that injector needs to look through opened existentials,
erasures, and other implicitly injected AST nodes.
@xedin xedin requested a review from hborla November 3, 2022 22:07
nextCall, nextCall->getType());
// Cannot use `forEachChildExpr` here because we need to
// to wrap a call in `try` and then stop immediately after.
struct TryInjector : ASTWalker {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of injecting 'try' can we just teach the effect checker to do the right thing with ForEachStmt? Seems like a lot of extra work just to appease it. SILGen ignores TryExpr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe @etcwilde has some ideas how to do that but the last time I tried it couldn't make it happen due the fact that this code has been synthesized.

@xedin
Copy link
Contributor Author

xedin commented Nov 4, 2022

@swift-ci please test

@xedin xedin merged commit 6f78e21 into swiftlang:main Nov 4, 2022
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