refactor(util): avoid usingnamespace in Bitflags#329
Conversation
WalkthroughThis pull request refactors how bitflag utilities are exposed across multiple modules. It replaces Zig's Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #329 +/- ##
==========================================
- Coverage 91.67% 91.67% -0.01%
==========================================
Files 91 91
Lines 7809 7808 -1
==========================================
- Hits 7159 7158 -1
Misses 650 650 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/util/bitflags_test.zig (1)
14-28: Test structs correctly refactored.Both TestFlags and PaddedFlags properly demonstrate the explicit export pattern. The consistent application across padded and unpadded variants validates the approach.
Optional maintenance consideration: The 14-line export boilerplate must be kept in sync across all usage sites if the Bitflags API evolves. Consider whether a compile-time check or codegen helper could reduce this maintenance burden in the future, though this is not urgent for this PR.
Also applies to: 38-52
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/Semantic/Reference.zig(1 hunks)src/Semantic/Scope.zig(1 hunks)src/Semantic/Symbol.zig(1 hunks)src/util/bitflags.zig(3 hunks)src/util/bitflags_test.zig(2 hunks)
🔇 Additional comments (5)
src/Semantic/Reference.zig (1)
55-69: LGTM! Clean refactor for Zig 0.15.0 compatibility.The explicit public constant pattern correctly replaces
usingnamespacewhile maintaining the same public API surface. All Bitflags members are properly exposed.src/Semantic/Scope.zig (1)
43-57: LGTM! Consistent refactor applied.The explicit export pattern is correctly applied, mirroring the approach in Reference.zig.
src/util/bitflags.zig (2)
5-29: Well-documented migration pattern.The updated example clearly demonstrates the new explicit export pattern, which will help users migrate their own code away from
usingnamespace.
195-197: Test correctly demonstrates the new pattern.The Position struct update validates that the explicit export approach works correctly.
src/Semantic/Symbol.zig (1)
130-144: LGTM! Refactor correctly applied.All Bitflags members are properly exposed through explicit public constants.
Part of DonIsaac#323 Gets rid of `usingnamespace` usage with Bitflags. `usingnamespace` has been removed in Zig 0.15.0.
Part of #323
Gets rid of
usingnamespaceusage with Bitflags.usingnamespacehas been removed in Zig 0.15.0.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.