fix(generator): discovery walkers now process nested types#29
Merged
Conversation
PolicySymbolWalker and RequireSymbolWalker pushed nested types onto the walk-stack via type.GetTypeMembers() but only iterated the popped nested type's members — the nested type itself was never passed to ProcessType. Result: [Policy] / [RequirePolicy] on a nested class were silently ignored. Surfaced during v2.1 runtime test scaffolding (Mediator.Authorization PR #28). Workaround was to declare fixtures at file scope; this fix removes that constraint. Added regression tests covering both walkers. Co-Authored-By: Claude Opus 4.7 (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
Pre-v2.1 bug surfaced during the v2.1 runtime test scaffolding (PR #28).
PolicySymbolWalkerandRequireSymbolWalkerpushed nested types onto the walk-stack but never calledProcessTypeon the popped nested type — only iterated its members.[Policy]/[RequirePolicy]declared on a nested class was silently ignored.Fix
Added a 3-line check at the top of each walker's main loop: if the popped item is a
INamedTypeSymbol, callProcessTypeon it before iterating its members.Tests
Two new regression tests in
NestedTypeDiscoveryTests.cs:Policy_OnNestedClass_IsDiscovered— nested[Policy]produces no diagnostics.RequirePolicy_OnNestedRecord_IsDiscovered— nested[RequirePolicy]resolves correctly against a top-level[Policy].Existing baseline preserved (19 generator + 37 runtime + 3 packsmoke).
Generated with Claude Code