Integrate Swift Binary Parsing#11
Merged
Merged
Conversation
Add apple/swift-binary-parsing as a dependency on Swift 6.2+ toolchains. TLVTypeCode, TLVItem and TLVContainer now conform to ExpressibleByParsing for throwing, span-based parsing, and TLVContainer.init(data:) is backed by the safe bounds-checked parser when the module is available. The dependency raises Apple platform deployment targets to macOS 13 / iOS 16 / watchOS 9 / tvOS 16 and can be disabled with SWIFTPM_ENABLE_BINARY_PARSING=0 (required for Embedded Swift builds). swift-syntax resolves to 602.x when enabled, matching the pin in swift-binary-parsing 0.0.2.
colemancda
force-pushed
the
feature/binary-parsing
branch
from
July 18, 2026 14:09
02bf6c6 to
79f272d
Compare
SwiftPM's index-store-based XCTest discovery fails when cross-compiling
a package whose test target uses macros ("error: index store path does
not exist", swiftlang/swift-package-manager#6950), breaking the
emulator job for every commit since the macro rewrite. Replace it with
an x86_64 cross-compile check until test discovery works for
macro-using packages.
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.
Summary
Integrates apple/swift-binary-parsing for safe, bounds-checked TLV8 parsing on Swift 6.2+ toolchains.
TLVTypeCode,TLVItem, andTLVContainerconform toExpressibleByParsing, adding throwing, span-based APIs:try TLVContainer(parsing: data)and incrementalTLVItem(parsing: &input)consumption from aParserSpan.TLVContainer.init(data:)is now backed by the BinaryParsing parser when the module is available; the hand-rolled parser remains as the fallback, so the public API and wire format are unchanged.SWIFTPM_ENABLE_BINARY_PARSING=0(required for Embedded Swift builds, since the standard BinaryParsing product doesn't build for bare-metal triples).Notes
602.0.0..<603.0.0, so the macros' swift-syntax version is forced to602.0.0when the gate is on. Theirmainalready relaxed this tofrom: "602.0.0", so the pin can be dropped with their next release.Test plan
swift test— 9 tests pass, including newtestBinaryParsing(span parsing, equivalence withinit(data:), truncation errors)SWIFTPM_ENABLE_BINARY_PARSING=0 swift test— fallback parser pathSWIFTPM_ENABLE_MACROS=0 swift buildSWIFTPM_ENABLE_MACROS=0 SWIFTPM_ENABLE_BINARY_PARSING=0 swift build --target TLVCoding --triple armv7em-none-none-eabi -Xswiftc -enable-experimental-feature -Xswiftc Embedded -Xswiftc -wmo