Skip to content

Drop swift-macro-testing to unblock SwiftSyntax updates#198

Merged
dfed merged 7 commits intomainfrom
dfed--bump-swift-syntax
Mar 25, 2026
Merged

Drop swift-macro-testing to unblock SwiftSyntax updates#198
dfed merged 7 commits intomainfrom
dfed--bump-swift-syntax

Conversation

@dfed
Copy link
Copy Markdown
Owner

@dfed dfed commented Mar 25, 2026

Summary

  • Remove swift-macro-testing (and transitive swift-snapshot-testing) package dependency
  • Convert all assertMacro calls to assertMacroExpansion across InjectableMacroTests and InstantiableMacroTests
  • Bump dependencies

Motivation

swift-macro-testing is a test-only dependency, but because it is declared as a top-level package dependency, its swift-syntax version constraints lock the entire package to an older resolved version. Removing it allows us to update SwiftSyntax freely without being blocked by a third-party test utility.

dfed and others added 3 commits March 25, 2026 10:50
Replace MacroTesting's `assertMacro` with SwiftSyntaxMacrosTestSupport's
`assertMacroExpansion` across all macro tests. This removes the
swift-macro-testing (and transitive swift-snapshot-testing) dependency,
which was constraining swift-syntax version resolution despite being
test-only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- AttributedTypeSyntax test: wrap @autoclosure in a function parameter
  context, as standalone @autoclosure is no longer parsed as
  AttributedTypeSyntax in 603
- Unexpected nodes test: use :::brokenSyntax at class body level
  instead of broken code inside function/variable bodies, since 603's
  improved error recovery nests those unexpected nodes inside the
  function/variable declarations (which FileVisitor skips)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dfed dfed force-pushed the dfed--bump-swift-syntax branch from f60be3a to 2215552 Compare March 25, 2026 18:05
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.87%. Comparing base (64a28df) to head (51f936b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #198      +/-   ##
==========================================
- Coverage   99.90%   99.87%   -0.04%     
==========================================
  Files          32       32              
  Lines        3274     3274              
==========================================
- Hits         3271     3270       -1     
- Misses          3        4       +1     
Files with missing lines Coverage Δ
Sources/SafeDITool/SafeDITool.swift 99.56% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

dfed and others added 3 commits March 25, 2026 11:21
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
assertMacroExpansion from SwiftSyntaxMacrosTestSupport uses XCTFail
internally, which is silently ignored under Swift Testing's @test.
This meant all 113 macro expansion assertions were no-ops.

Fix by:
- Adding a wrapper that uses SwiftSyntaxMacrosGenericTestSupport's
  assertMacroExpansion with a custom failureHandler that calls
  Issue.record() from Swift Testing
- Fixing expandedSource in all diagnostic tests to match the actual
  expansion of the original source (macro attrs stripped, no generated
  members) rather than the expansion of the fixed source

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers the else branch in generateForwardedProperties (tuple
ForwardedProperties typealias) which was previously only exercised
via MacroTesting's fix-it-then-re-expand flow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dfed dfed self-assigned this Mar 25, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dfed dfed marked this pull request as ready for review March 25, 2026 20:26
@dfed dfed merged commit b81984c into main Mar 25, 2026
25 checks passed
@dfed dfed deleted the dfed--bump-swift-syntax branch March 25, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant