Change @SafeDIConfiguration to #SafeDIConfiguration freestanding macro#227
Merged
Change @SafeDIConfiguration to #SafeDIConfiguration freestanding macro#227
Conversation
Replace the attached peer macro `@SafeDIConfiguration` (which decorated an enum with required properties) with a freestanding declaration macro `#SafeDIConfiguration(...)` that takes parameters with default values. This improves library evolution (adding new parameters is non-breaking) and ergonomics (no enum boilerplate needed). The simplest valid invocation is now just `#SafeDIConfiguration()`. Key changes: - Public API: `@freestanding(declaration)` macro with defaulted parameters - Macro impl: `DeclarationMacro` validates literal arguments - SafeDIConfigurationVisitor: now an enum with static extraction method - FileVisitor: handles both MacroExpansionDeclSyntax and MacroExpansionExprSyntax - RootScanner: text-based scanning updated for `#` prefix and argument list - Delete FixableSafeDIConfigurationError (fix-its no longer needed) - Update migration plugin, examples, all tests, and documentation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #227 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 40 39 -1
Lines 6143 6015 -128
==========================================
- Hits 6143 6015 -128
🚀 New features to boost your workflow:
|
- Add macro tests for unlabeled and unknown argument errors - Add visitor tests for unknown labels and interpolated string literals - Remove dead MacroExpansionDeclSyntax path in FileVisitor (parser always produces MacroExpansionExprSyntax for freestanding macros) - Remove unreachable loop in RootScanner that skipped between label and colon - All changed files now at 100% line coverage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dfed
commented
Apr 7, 2026
Use if/else if/else expression instead of sequential bare if statements with early returns, matching the project's code style rules. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
@SafeDIConfiguration(attached peer macro decorating an enum) with#SafeDIConfiguration(...)(freestanding declaration macro with defaulted parameters)#SafeDIConfiguration()replaces a multi-line enum declarationTest plan
#SafeDIConfiguration(...)argument extraction🤖 Generated with Claude Code