Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Ignored parameters and labeled enum-case wildcards are still translated as identifiers.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds a dedicated unified AST node for Swift wildcard and discard patterns.
Changes:
- Adds
ignore_patternto the schema and generated QL definitions. - Updates Swift translation rules and corpus expectations.
| File | Reviewed change |
|---|---|
unified/ql/lib/unified.dbscheme |
Registers the new schema type. |
unified/ql/lib/codeql/unified/internal/Ast.qll |
Exposes IgnorePattern to QL. |
unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence.output |
Updates wildcard expectations. |
unified/extractor/tests/corpus/swift/operators/unresolved-operator-sequence-with-casts.output |
Updates wildcard expectations involving casts. |
unified/extractor/tests/corpus/swift/expressions/super-expression.output |
Updates discard-assignment expectations. |
unified/extractor/src/languages/swift/swift.rs |
Adds wildcard translation rules; some parameter and labeled enum-case forms remain unhandled. |
unified/extractor/ast_types.yml |
Defines ignore_pattern; closure shorthand mapping still emits _ as an identifier. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // the target AST represents it as a `name_node` over the `_` token. | ||
| rule!((discardAssignmentExpr wildcard: @@w) => (identifier #{w})), | ||
| // assignment `_ = x`. swift-syntax models it as a `discardAssignmentExpr`. | ||
| rule!((discardAssignmentExpr wildcard: @@w) => (ignore_pattern #{w})), |
Contributor
Author
There was a problem hiding this comment.
Good catch. This is already fixed in #22657 since it removes the nested rule, so I'll wait for that to merge first.
hvitved
approved these changes
Sep 23, 2026
This branch has not been deployed
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.

No description provided.