Skip to content

Swift: Update to Swift 6.3#21667

Open
jketema wants to merge 15 commits intogithub:mainfrom
jketema:jketema/swift-6.3
Open

Swift: Update to Swift 6.3#21667
jketema wants to merge 15 commits intogithub:mainfrom
jketema:jketema/swift-6.3

Conversation

@jketema
Copy link
Copy Markdown
Contributor

@jketema jketema commented Apr 8, 2026

Commit-by-commit review recommended.

Most of this is straightforward, although there is quite a bit of getting the mangler into shape again because of new dataset check errors that showed up.

d09e2f6 is probably the most tricky bit. Turns out there is a second place where we need indexing, besides extensions. A module can have fileprivate members. As a module may consist of multiple files, we might actually end up in a situation where there are multiple functions with the same name and signature in the same module; just defined in different source files. This happens for durationComponents(for:clock:) in Swift 6.3:

To get the indexing I've extended the code that was already there for extensions.

@github-actions github-actions bot added the Swift label Apr 8, 2026
@jketema jketema force-pushed the jketema/swift-6.3 branch 2 times, most recently from 2dce37b to efe205e Compare April 9, 2026 12:09
jketema added 4 commits April 9, 2026 15:05
At least in the case of function declarations there can be multiple
identical ones within the same module, causing data set check errors
if not differentiated.
@jketema jketema force-pushed the jketema/swift-6.3 branch from efe205e to 21937c2 Compare April 9, 2026 13:13
Comment on lines -243 to -245
if (flags.isIsolated()) {
ret << "_isolated";
}
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.

Note that this was duplicating the first if from the loop we're in here.

@jketema jketema marked this pull request as ready for review April 9, 2026 14:53
@jketema jketema requested review from a team as code owners April 9, 2026 14:53
Copilot AI review requested due to automatic review settings April 9, 2026 14:53
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

Updates the Swift extractor/QL libraries and bundled resources to support analyzing Swift 6.3, including schema evolution and mangling changes needed to keep identifiers stable/unique under new Swift 6.3 AST behaviors.

Changes:

  • Bump bundled Swift toolchains/resources (macOS/Linux) used by the Swift extractor/tests.
  • Extend the Swift DB schema/QL type hierarchy (introducing BuiltinGenericType) and regenerate affected generated QL and test baselines.
  • Update extractor C++ code (type/stmt translation, mangling) to align with Swift 6.3 API/AST changes and to disambiguate fileprivate declarations.
Show a summary per file
File Description
swift/third_party/resources/swift-prebuilt-macos.tar.zst Update bundled macOS Swift prebuilt toolchain (LFS pointer).
swift/third_party/resources/swift-prebuilt-linux.tar.zst Update bundled Linux Swift prebuilt toolchain (LFS pointer).
swift/third_party/resources/resource-dir-macos.zip Update bundled macOS Swift resource directory (LFS pointer).
swift/third_party/resources/resource-dir-linux.zip Update bundled Linux Swift resource directory (LFS pointer).
swift/schema.py Add BuiltinGenericType and make BuiltinFixedArrayType derive from it.
swift/ql/test/library-tests/controlflow/graph/Cfg.expected Regenerate CFG expected output for Swift 6.3 extraction changes.
swift/ql/test/library-tests/ast/PrintAst.expected Regenerate AST printing expected output (iterator-var and location changes).
swift/ql/test/extractor-tests/generated/type/IntegerType/IntegerType.expected Regenerate integer type extraction expected output.
swift/ql/test/extractor-tests/generated/stmt/ForEachStmt/ForEachStmt.expected Regenerate foreach stmt extraction expected output (iterator var locations).
swift/ql/test/extractor-tests/generated/expr/ObjectLiteralExpr/ObjectLiteralExpr.expected Update object literal type expectations (error type to _).
swift/ql/test/extractor-tests/generated/decl/ParamDecl/ParamDecl.expected Regenerate param decl expected output for backing-var bindings.
swift/ql/test/extractor-tests/generated/decl/MacroDecl/MacroRole.expected Update macro role expectations (new attached(extension) role).
swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected Regenerate var decl wrapper-related expected output with locations.
swift/ql/test/extractor-tests/generated/decl/CapturedDecl/PrintAst.expected Update type repr rendering expectation (Optional<Int>Int?).
swift/ql/test/extractor-tests/errors/Errors.expected Update error-type expectations (use _ in place of <<error type>>).
swift/ql/test/extractor-tests/declarations/all.expected Regenerate declaration list expected output (new binding node emission).
swift/ql/lib/upgrades/33e5e5e03bd3f98322f4c67aefa81015be832b88/upgrade.properties Add Swift 6.3 dbscheme upgrade metadata.
swift/ql/lib/upgrades/33e5e5e03bd3f98322f4c67aefa81015be832b88/old.dbscheme Add prior dbscheme snapshot for Swift 6.3 upgrade step.
swift/ql/lib/swift.dbscheme Evolve dbscheme to include @builtin_generic_type and adjust hierarchy.
swift/ql/lib/codeql/swift/generated/type/BuiltinGenericType.qll New generated QL type wrapper for BuiltinGenericType.
swift/ql/lib/codeql/swift/generated/type/BuiltinFixedArrayType.qll Adjust generated inheritance to go via BuiltinGenericType.
swift/ql/lib/codeql/swift/generated/Synth.qll Update synthesized type unions/conversions for TBuiltinGenericType.
swift/ql/lib/codeql/swift/generated/Raw.qll Update raw wrappers to introduce BuiltinGenericType and rebase fixed arrays.
swift/ql/lib/codeql/swift/generated/ParentChild.qll Regenerate parent/child helpers after raw type hierarchy changes.
swift/ql/lib/codeql/swift/elements/type/internal/BuiltinGenericTypeImpl.qll New internal hand-modifiable wrapper for BuiltinGenericType.
swift/ql/lib/codeql/swift/elements/type/BuiltinGenericType.qll New public QL element type BuiltinGenericType.
swift/ql/lib/codeql/swift/elements/type/BuiltinFixedArrayType.qll Update imports to reflect new base type.
swift/ql/lib/codeql/swift/elements.qll Export new BuiltinGenericType in umbrella module.
swift/ql/lib/change-notes/2026-04-06-swift-6.3.md Add changenote announcing Swift 6.3 support.
swift/ql/integration-tests/posix/deduplication/BuiltinTypes.expected Update deduplication integration-test expected results for builtins.
swift/ql/.gitattributes Mark new generated QL files as linguist-generated.
swift/ql/.generated.list Update generated file manifest/hashes after regeneration.
swift/extractor/translators/TypeTranslator.h Add translation entrypoint for BuiltinFixedArrayType; remove unresolved-type handling.
swift/extractor/translators/TypeTranslator.cpp Implement BuiltinFixedArrayType translation and remove UnresolvedType translation.
swift/extractor/translators/StmtTranslator.cpp Adjust CaseStmt variable extraction for updated Swift API.
swift/extractor/mangler/SwiftMangler.h Extend mangler indexing to include fileprivate values and add fixed-array type mangling hook.
swift/extractor/mangler/SwiftMangler.cpp Implement fileprivate disambiguation indexing, fixed-array mangling, and other Swift 6.3 mangling updates.
swift/extractor/infra/SwiftTagTraits.h Update AST/type tag mappings for Swift 6.3 (BuiltinGenericType, remove UnresolvedType, etc.).
swift/downgrades/ee3053b673c901a325b361b18c50b18342752bf8/upgrade.properties Add Swift 6.3 downgrade/upgrade metadata.
swift/downgrades/ee3053b673c901a325b361b18c50b18342752bf8/swift.dbscheme Add Swift 6.3 downgrade dbscheme snapshot.
docs/codeql/reusables/supported-versions-compilers.rst Update documented supported Swift versions to 5.4–6.3.

Copilot's findings

  • Files reviewed: 31/43 changed files
  • Comments generated: 1

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.

3 participants