Repository navigation
Unified: Handle additionalTrailingClosures for more expression kinds - #22785
Merged
Merged
Conversation
trailing closure Previously the callee was handled differently depending on whether the call had a trailing closure. This merges the two rules for `functionCallExpr` into one to erase the difference.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The specialized array-constructor mapping lacks direct coverage for its new additional-trailing-closure behavior.
1 open finding
What changed in this PR
Extends Swift unified AST translation to preserve additional trailing closures across function, macro, and subscript expressions.
Changes:
- Unifies function-call handling and normalizes callee translation.
- Maps trailing closures for function and subscript calls.
- Adds Swift corpus coverage and generated expectations.
| File | Description |
|---|---|
unified/extractor/src/languages/swift/swift.rs |
Extends trailing-closure translation rules. |
unified/extractor/tests/corpus/swift/functions/function-call.swift |
Tests multiple function-call trailing closures. |
unified/extractor/tests/corpus/swift/functions/function-call.output |
Records generated function-call AST output. |
unified/extractor/tests/corpus/swift/expressions/subscript-call.swift |
Tests subscript calls with trailing closures. |
unified/extractor/tests/corpus/swift/expressions/subscript-call.output |
Records generated subscript-call AST output. |
unified/extractor/tests/corpus/swift/control-flow/nested-enum-case-pattern.swift |
Tests trailing-closure calls in expression patterns. |
unified/extractor/tests/corpus/swift/control-flow/nested-enum-case-pattern.output |
Records generated pattern AST output. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
| arguments: _* @args | ||
| trailingClosure: @tc) | ||
| trailingClosure: @tc | ||
| additionalTrailingClosures: _* @additional) |
asgerf
previously approved these changes
Oct 8, 2026
Contributor
Author
|
Ready for re-review. Nothing substantially changed, I only expanded on a test at the behest of Copilot. |
asgerf
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

With this PR we handle
additionalTrailingClosuresfor all expression kinds that have the fields (exceptmacroExpansionDeclwhich we don't extract).Before that we unify two cases for
functionCallExprwhich I think fixes a problem where the callee was handled differently for calls that had a trailing closure.