Skip to content

Unified: Local scoping followups - #22237

Open
asgerf wants to merge 5 commits into
github:mainfrom
asgerf:unified/local-scoping-followups
Open

Unified: Local scoping followups#22237
asgerf wants to merge 5 commits into
github:mainfrom
asgerf:unified/local-scoping-followups

Conversation

@asgerf

@asgerf asgerf commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

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.

@asgerf asgerf added the no-change-note-required This PR does not need a change note label Jul 27, 2026
@asgerf
asgerf marked this pull request as ready for review July 28, 2026 07:17
@asgerf
asgerf requested a review from a team as a code owner July 28, 2026 07:17
Copilot AI review requested due to automatic review settings July 28, 2026 07:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 where clauses 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}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very good catch, but we'll need to wait for #22233 to merge before fixing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants