Skip to content

Unified: Extract modifiers for function declarations - #22540

Open
hvitved wants to merge 2 commits into
mainfrom
hvitved-swift-function-modifiers
Open

Unified: Extract modifiers for function declarations#22540
hvitved wants to merge 2 commits into
mainfrom
hvitved-swift-function-modifiers

Conversation

@hvitved

@hvitved hvitved commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Swift function declaration modifiers were omitted from the unified AST, preventing consumers from distinguishing declarations such as consuming, static, and class functions.

Capture the functionDecl.modifiers field for functions both with and without bodies, and emit the translated modifiers on function_declaration. Add focused corpus coverage for static and class functions, while updating the existing consuming function corpus output.

Capture declaration modifiers on Swift functions with and without bodies, and add corpus coverage for consuming, static, and class functions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Copilot review overview

🟡 Changes recommended

The newly modified bodyless-function branch lacks modifier-focused corpus coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity unified/​extractor/​src/​languages/​swift/​swift.rs — This bodyless-function branch now propagates modifiers, but the added static/class fixtures and…
What changed in this PR

Adds Swift function modifiers to unified AST function declarations.

Changes:

  • Propagates modifiers for functions with and without bodies.
  • Adds corpus coverage for static, class, and existing consuming functions.
File Description
unified/​extractor/​src/​languages/​swift/​swift.rs Emits function declaration modifiers.
unified/​extractor/​tests/​corpus/​swift/​types/​static-function.swift Adds a static-function fixture.
unified/​extractor/​tests/​corpus/​swift/​types/​static-function.output Records static modifier output.
unified/​extractor/​tests/​corpus/​swift/​types/​class-function.swift Adds a class-function fixture.
unified/​extractor/​tests/​corpus/​swift/​types/​class-function.output Records class modifier output.
unified/​extractor/​tests/​corpus/​swift/​control-flow/​discard-statement.output Records the consuming modifier.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread unified/extractor/src/languages/swift/swift.rs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hvitved
hvitved marked this pull request as ready for review September 10, 2026 11:36
@hvitved
hvitved requested a review from a team as a code owner September 10, 2026 11:36
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Sep 10, 2026
@hvitved hvitved changed the title Extract modifiers for Swift function declarations Unified: Extract modifiers function declarations Sep 10, 2026
@hvitved
hvitved requested a review from asgerf September 10, 2026 12:41
@hvitved hvitved changed the title Unified: Extract modifiers function declarations Unified: Extract modifiers for function declarations Sep 10, 2026

@tausbn tausbn 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.

Looks good to me. 👍

@hvitved

hvitved commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

I'll hold this back until #22498 is merged, to avoid further merge conflicts on that PR.

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.

3 participants