Unified: Local scoping followups - #22237
Open
asgerf wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Swift local-scoping follow-ups and preserves switch-case where clauses in the unified AST.
Changes:
- Extends variable-shadowing and guarded-case tests.
- Maps switch
whereclauses to case guards. - Removes a redundant name-binding override.
Show a summary per file
| File | Description |
|---|---|
unified/ql/test/library-tests/variables/test.swift |
Expands local-scoping coverage. |
unified/ql/lib/codeql/unified/internal/Variables.qll |
Removes the redundant lookup override. |
unified/extractor/tests/corpus/swift/control-flow/switch-case-where-clauses.swift |
Adds switch-case fixtures. |
unified/extractor/tests/corpus/swift/control-flow/switch-case-where-clauses.output |
Records expected AST output. |
unified/extractor/src/languages/swift/swift.rs |
Maps case guards into the unified AST. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Medium
| (switch_entry default: (default_keyword) statement: _* @body) | ||
| (switch_entry | ||
| default: (default_keyword) | ||
| where: (where_clause expr: @guard)? |
Comment on lines
+741
to
+743
| (switch_case | ||
| pattern: (or_pattern pattern: {first} pattern: {rest}) | ||
| guard: {guard} |
Contributor
Author
There was a problem hiding this comment.
This is a very good catch, but we'll need to wait for #22233 to merge before fixing it.
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.
Follows up on some comments @hvitved left on this PR, which was merged to unblock @tausbn.
Also contains a fix to the AST mapping since one of the comments pointed to a bug whose root cause was in the AST mapping.