Skip to content
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

Fix try/await expressions in NoAssignmentInExpressions. #533

Merged
merged 1 commit into from
May 26, 2023

Conversation

allevato
Copy link
Member

This rule only checked whether the immediate parent of an expression like x = y was a CodeBlockItem. In cases like try x = y, the try wraps the entire expression and the CodeBlockItem would be the parent of that. So we look through any TryExprs or AwaitExprs we see when searching for the CodeBlockItem.

This rule only checked whether the _immediate_ parent of an expression
like `x = y` was a `CodeBlockItem`. In cases like `try x = y`, the `try`
wraps the entire expression and the `CodeBlockItem` would be the parent
of that. So we look through any `TryExpr`s or `AwaitExpr`s we see when
searching for the `CodeBlockItem`.
@allevato
Copy link
Member Author

cc @dylansturg

@allevato allevato merged commit e2d247c into swiftlang:main May 26, 2023
@allevato allevato deleted the no-assignment-fixes branch May 26, 2023 19:14
allevato added a commit to allevato/swift-format that referenced this pull request Jun 29, 2023
Fix `try`/`await` expressions in `NoAssignmentInExpressions`.
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.

2 participants