Repository navigation
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| final override string getAPrimaryQlClass() { result = "ModifiedTypeExpr" } | ||
|
|
||
| /** Gets the node corresponding to the field `modifier`. */ | ||
| final F::Modifier getModifier(int i) { unified_modified_type_expr_modifier(this, i, result) } |
Preserve the base type of attributed types (`inout T`, `sending T`, `@escaping () -> T`) and keep their specifiers and attributes as modifiers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
paldepind
force-pushed
the
unified/swift-extract-attributed-types
branch
from
October 13, 2026 09:47
d8fb01b to
4fcecf2
Compare
paldepind
marked this pull request as ready for review
October 13, 2026 09:55
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The schema, mapping, generated artifacts, and representative corpus coverage are consistent with the stated scope.
0 open findings
What changed in this PR
Adds structural extraction support for Swift attributed types while preserving modifiers and underlying type context.
Changes:
- Introduces
ModifiedTypeExprin the unified AST schema. - Maps Swift type specifiers and attributes to modifiers.
- Adds and updates extractor and control-flow expectations.
| File | Description |
|---|---|
unified/extractor/ast_types.yml |
Defines modified type expressions. |
unified/extractor/src/languages/swift/swift.rs |
Maps Swift attributed types. |
unified/ql/lib/unified.dbscheme |
Regenerates database schema. |
unified/ql/lib/codeql/unified/internal/Ast.qll |
Regenerates QL AST classes. |
unified/ql/lib/codeql/unified/internal/ExprPositions.qll |
Marks wrapped types as type-context expressions. |
unified/extractor/tests/corpus/swift/functions/attributed-parameter-types.swift |
Tests attributed parameters. |
unified/extractor/tests/corpus/swift/functions/attributed-parameter-types.output |
Records generated attributed-parameter AST. |
unified/extractor/tests/corpus/swift/functions/function-with-inout-parameter.output |
Updates inout extraction expectation. |
unified/extractor/tests/corpus/swift/types/function-type-with-inout-parameter.swift |
Tests inout in function types. |
unified/extractor/tests/corpus/swift/types/function-type-with-inout-parameter.output |
Records generated function-type AST. |
unified/extractor/tests/corpus/swift/types/function-type-with-sendable-attribute.output |
Updates @Sendable extraction. |
unified/extractor/tests/corpus/swift/types/function-type-with-convention-attribute.output |
Updates attributed function-type extraction. |
unified/ql/test/library-tests/controlflow/cfg.swift |
Annotates newly exposed type syntax. |
unified/ql/test/library-tests/controlflow/cfg.expected |
Updates generated CFG expectations. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
asgerf
approved these changes
Oct 15, 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.
Attributed types such as
inout D,sending Tand@escaping () -> Tare currently unsupported.This PR adds a new
modified_type_exprnode and mapsattributedTypeto it.Some thoughts for future changes:
@escapingare currently just mapped to modifiers (which is just a token). However, they can takes arguments, so maybe we want to add a new attribute/annotation AST node to represent these better.