Remove SymbolTestsCore fixtures for ABI-invisible features#63
Conversation
These features leave no trace in Mach-O metadata that SwiftInterface can recover from a release binary, so the fixtures only added noise to the symbol tests: - @Frozen / resilience contrast: compile-time ABI attribute only - typealias: expanded at compile time - access levels (public/private/internal/open): do not change mangling - @available: compile-time availability check - willSet/didSet: setter implementation detail, not in metadata - default parameter values: not encoded in method signatures - rethrows: mangles identically to throws - nested functions: no nominal type descriptor emitted Verified via nm + swift-demangle on the built .o files and by diffing against the SwiftInterface snapshot output.
There was a problem hiding this comment.
Code Review
This pull request removes several Swift test files related to access levels, availability, default arguments, and other metadata-driven features, while updating the Xcode scheme to include a new build entry for SwiftInspection. Feedback was provided regarding an unintentional downgrade of the LastUpgradeVersion in the scheme file, which should be reverted to ensure consistency across development environments.
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Scheme | ||
| LastUpgradeVersion = "2640" | ||
| LastUpgradeVersion = "2630" |
There was a problem hiding this comment.
Pull request overview
This PR removes several SymbolTestsCore test fixture source files whose language features are not recoverable from Mach-O binary metadata, reducing noise in SwiftInterface-based symbol/snapshot tests.
Changes:
- Delete 9
SymbolTestsCorefixture files covering ABI-/compile-time-only features (e.g.@frozen,typealias, default args,@available,rethrows, nested functions, property observers, access levels). - Update the Xcode SwiftPM generated scheme (
MachOSwiftSection-Package.xcscheme) includingLastUpgradeVersionand an addedSwiftInspectionbuild entry.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Projects/SymbolTests/SymbolTestsCore/Typealiases.swift | Remove typealias-focused fixture namespace |
| Tests/Projects/SymbolTests/SymbolTestsCore/RethrowingFunctions.swift | Remove rethrows-focused fixture namespace |
| Tests/Projects/SymbolTests/SymbolTestsCore/PropertyObservers.swift | Remove willSet/didSet fixture namespace |
| Tests/Projects/SymbolTests/SymbolTestsCore/NestedFunctions.swift | Remove nested/local-function + local-type fixture namespace |
| Tests/Projects/SymbolTests/SymbolTestsCore/FrozenResilienceContrast.swift | Remove @frozen vs resilient contrast fixture namespace |
| Tests/Projects/SymbolTests/SymbolTestsCore/Frozen.swift | Remove @frozen/@inlinable/@usableFromInline fixture namespace |
| Tests/Projects/SymbolTests/SymbolTestsCore/DefaultArguments.swift | Remove default-argument fixture namespace |
| Tests/Projects/SymbolTests/SymbolTestsCore/Availability.swift | Remove @available fixture namespace |
| Tests/Projects/SymbolTests/SymbolTestsCore/AccessLevels.swift | Remove access-level variation fixture namespace |
| .swiftpm/xcode/xcshareddata/xcschemes/MachOSwiftSection-Package.xcscheme | Scheme metadata/build-entry changes (appears incidental to fixture removal) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <Scheme | ||
| LastUpgradeVersion = "2640" | ||
| LastUpgradeVersion = "2630" | ||
| version = "2.2"> |
There was a problem hiding this comment.
LastUpgradeVersion was changed to "2630", but the other shared Xcode schemes in .swiftpm/xcode/xcshareddata/xcschemes/ use "2640". Unless this downgrade is intentional, please keep LastUpgradeVersion consistent to avoid unnecessary scheme churn across Xcode versions.
| <BuildActionEntry | ||
| buildForTesting = "YES" | ||
| buildForRunning = "YES" | ||
| buildForProfiling = "YES" | ||
| buildForArchiving = "YES" | ||
| buildForAnalyzing = "YES"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "SwiftInspection" | ||
| BuildableName = "SwiftInspection" | ||
| BlueprintName = "SwiftInspection" | ||
| ReferencedContainer = "container:"> | ||
| </BuildableReference> | ||
| </BuildActionEntry> |
There was a problem hiding this comment.
This scheme change adds a BuildActionEntry for the SwiftInspection target, which is unrelated to the PR’s stated goal (removing SymbolTestsCore fixtures). If this isn’t required to keep builds/tests working, consider reverting it to keep the PR focused and reduce incidental Xcode scheme diffs.
| <BuildActionEntry | ||
| buildForTesting = "YES" | ||
| buildForRunning = "YES" | ||
| buildForProfiling = "YES" | ||
| buildForArchiving = "YES" | ||
| buildForAnalyzing = "YES"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "SwiftInspection" | ||
| BuildableName = "SwiftInspection" | ||
| BlueprintName = "SwiftInspection" | ||
| ReferencedContainer = "container:"> | ||
| </BuildableReference> | ||
| </BuildActionEntry> |
There was a problem hiding this comment.
Removing these SymbolTestsCore fixture sources will change the SwiftInterface output, but the PR does not update the existing snapshot baseline (e.g. Tests/SwiftInterfaceTests/Snapshots/__Snapshots__/MachOFileInterfaceSnapshotTests/interfaceSnapshot.1.txt currently contains enum AccessLevels, enum Availability, enum DefaultArguments, etc.). Please regenerate/update the affected snapshots in the same PR so snapshot tests don’t fail.
Code reviewFound 2 issues:
🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Address code review feedback: - Restore NestedFunctions.swift with only `outerWithLocalClass()` and its function-local `LocalClass`. The fixture covers `_LXXX` local-symbol mangling — `LocalClass` emits a nominal type descriptor visible in SwiftInterface output. The truly-ABI-invisible pieces (inner functions, local struct) remain removed. - Regenerate MachOFileInterfaceSnapshotTests and MachOFileDumpSnapshotTests snapshots so SymbolTestsCore-backed tests match the pruned fixture set.
Summary
移除
SymbolTestsCore中 9 个测试 fixture 文件,它们测试的特性在 Mach-O 二进制/metadata 中完全不可还原,只会作为噪音干扰SwiftInterface的符号测试。删除的文件与理由
Frozen.swift、FrozenResilienceContrast.swift@frozenTypealiases.swifttypealiasAccessLevels.swiftpublic/private/internal/openAvailability.swift@availablePropertyObservers.swiftwillSet/didSetDefaultArguments.swift= value全部丢失RethrowingFunctions.swiftrethrowsthrows相同,snapshot 里变成throwsNestedFunctions.swiftnm验证 inner function 和LocalStruct均无 nominal type descriptor验证方式
nm -gU <file>.o | xcrun swift-demangle检查符号表Tests/SwiftInterfaceTests/Snapshots现有快照验证特性在 SwiftInterface 输出中消失Test plan
swift build通过swift test --filter SymbolTestsCoreIntegrationTests通过(测试可能引用这些类型,需要检查)swift test --filter MachOFileInterfaceSnapshotTests通过(snapshot 需要重新生成)