Skip to content

Handle SendExpr in RemoveRedundantParentheses exhaustive switches - #2846

Draft
ktoso wants to merge 1 commit into
swiftlang:mainfrom
ktoso:wip-send-expr
Draft

ktoso wants to merge 1 commit into
swiftlang:mainfrom
ktoso:wip-send-expr

Conversation

@ktoso

@ktoso ktoso commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Companion to swiftlang/swift-syntax#3498, which adds SendExprSyntax for the send call expression (experimental feature SendCalls, see also swiftlang/swift#93958).

Without a .sendExpr case, the exhaustive switch expr.as(ExprSyntaxEnum.self) statements fail to compile against that swift-syntax branch (switch must be exhaustive), which breaks toolchain CI that pairs the two PRs:

Sources/SwiftSyntaxCodeActions/RemoveRedundantParentheses.swift:165:5: error: switch must be exhaustive
    `- note: add missing case: '.sendExpr(_)'
Sources/SwiftSyntaxCodeActions/RemoveRedundantParentheses.swift:288:5: error: switch must be exhaustive
    `- note: add missing case: '.sendExpr(_)'

send is an effect specifier like await/unsafe, so treat it the same way:

  • it does not bind tighter than effects in hasTighterBindingThanEffect
  • it is simple iff its sub-expression is simple in isSimpleExpression

Draft: only compiles against a swift-syntax that has SendExpr (the swiftlang/swift-syntax#3498 branch); merge after that PR lands and the swift-syntax pin here is bumped.

Companion to swiftlang/swift-syntax#3498, which adds `SendExprSyntax` for
the `send` call expression (experimental feature `SendCalls`,
swiftlang/swift#93958). Without a `.sendExpr` case the exhaustive
`switch expr.as(ExprSyntaxEnum.self)` statements fail to compile against
that swift-syntax branch ("switch must be exhaustive"), which breaks
toolchain CI that pairs the two PRs.

`send` is an effect specifier like `await`/`unsafe`, so treat it the
same way: it does not bind tighter than effects, and it is simple iff its
sub-expression is simple.

Only compiles against a swift-syntax that has `SendExpr` (the
swiftlang/swift-syntax#3498 branch); merge after that PR lands and the
swift-syntax pin is bumped.
@ktoso

ktoso commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

swiftlang/swift-syntax#3498
@swift-ci please test

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.

1 participant