Skip to content

Swift: Expose the generic arguments of BuiltinFixedArrayTypes#21723

Open
jketema wants to merge 3 commits intogithub:mainfrom
jketema:swift-fixed-array
Open

Swift: Expose the generic arguments of BuiltinFixedArrayTypes#21723
jketema wants to merge 3 commits intogithub:mainfrom
jketema:swift-fixed-array

Conversation

@jketema
Copy link
Copy Markdown
Contributor

@jketema jketema commented Apr 16, 2026

No description provided.

@github-actions github-actions bot added the Swift label Apr 16, 2026
@jketema jketema marked this pull request as ready for review April 17, 2026 11:24
@jketema jketema requested review from a team as code owners April 17, 2026 11:24
Copilot AI review requested due to automatic review settings April 17, 2026 11:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Swift extractor schema and generated QL libraries to expose Builtin.FixedArray<N, T>’s generic arguments (size and element type) as first-class properties, with accompanying dbscheme updates, upgrades/downgrades, and extractor tests.

Changes:

  • Extend the Swift schema/dbscheme for BuiltinFixedArrayType to include size and element_type.
  • Update the Swift extractor (C++) and generated QL API to surface getSize() / getElementType().
  • Add/adjust generated extractor tests plus schema upgrade/downgrade artifacts for compatibility.
Show a summary per file
File Description
swift/schema.py Adds size and element_type fields to BuiltinFixedArrayType; removes a duplicate SubscriptDecl.element_type line.
swift/extractor/translators/TypeTranslator.cpp Populates BuiltinFixedArrayType entries with size and element_type labels during extraction.
swift/ql/lib/swift.dbscheme Extends builtin_fixed_array_types relation to include size/element type columns.
swift/ql/lib/codeql/swift/generated/Raw.qll Adds raw accessors for BuiltinFixedArrayType.getSize() / getElementType().
swift/ql/lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll Adds generated (resolved + immediate) API for size/element type.
swift/ql/lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll Updates public type module imports to support the new API surface.
swift/ql/test/extractor-tests/generated/type/BuiltinFixedArrayType/fixed_array.swift New extractor test source exercising both value-generic and concrete sizes.
swift/ql/test/extractor-tests/generated/type/BuiltinFixedArrayType/BuiltinFixedArrayType.ql New generated QL test query for the new accessors.
swift/ql/test/extractor-tests/generated/type/BuiltinFixedArrayType/BuiltinFixedArrayType.expected Expected results verifying size/element type extraction.
swift/ql/test/extractor-tests/generated/type/BuiltinType/BuiltinType.expected Adjusts expected BuiltinType output (removing FixedArray entries from this aggregate expected file).
swift/ql/lib/upgrades/ee3053b673c901a325b361b18c50b18342752bf8/upgrade.ql Upgrade logic to backfill new columns and emit helpful errors if missing.
swift/ql/lib/upgrades/ee3053b673c901a325b361b18c50b18342752bf8/upgrade.properties Registers the upgrade predicates for the new relation shape.
swift/ql/lib/upgrades/ee3053b673c901a325b361b18c50b18342752bf8/swift.dbscheme New-scheme snapshot for the upgrade step.
swift/ql/lib/upgrades/ee3053b673c901a325b361b18c50b18342752bf8/old.dbscheme Old-scheme snapshot for the upgrade step.
swift/downgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/upgrade.properties Registers downgrade mapping for builtin_fixed_array_types.
swift/downgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/swift.dbscheme Old-scheme dbscheme used as downgrade target.
swift/downgrades/5738be6bb04742c424efdbf9f4de11f0b10fa37d/builtin_fixed_array_types.ql Downgrade query projecting the new relation back to the old unary form.
swift/ql/lib/change-notes/2026-04-17-fixed-array.md Adds a change note describing the new getSize / getElementType API.
swift/ql/.gitattributes Marks the newly added generated test query as linguist-generated.
swift/ql/.generated.list Updates generated-file hashes to reflect regenerated QL sources/tests.

Copilot's findings

  • Files reviewed: 15/21 changed files
  • Comments generated: 1

Comment thread swift/ql/lib/change-notes/2026-04-17-fixed-array.md Outdated
@jketema jketema changed the title Swift: Expose the generic arguments of BuiltinFixedArrays Swift: Expose the generic arguments of BuiltinFixedArrayTypes Apr 17, 2026
Comment thread swift/schema.py
class SubscriptDecl(AbstractStorageDecl, GenericContext):
params: list[ParamDecl] | child
element_type: Type
element_type: Type
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.

Removed as it was duplicating the line just above it. This didn't change the generated database scheme.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants