Swift: Expose the generic arguments of BuiltinFixedArrayTypes#21723
Open
jketema wants to merge 3 commits intogithub:mainfrom
Open
Swift: Expose the generic arguments of BuiltinFixedArrayTypes#21723jketema wants to merge 3 commits intogithub:mainfrom
BuiltinFixedArrayTypes#21723jketema wants to merge 3 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
BuiltinFixedArrayTypeto includesizeandelement_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
BuiltinFixedArraysBuiltinFixedArrayTypes
jketema
commented
Apr 17, 2026
| class SubscriptDecl(AbstractStorageDecl, GenericContext): | ||
| params: list[ParamDecl] | child | ||
| element_type: Type | ||
| element_type: Type |
Contributor
Author
There was a problem hiding this comment.
Removed as it was duplicating the line just above it. This didn't change the generated database scheme.
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.
No description provided.