Skip to content

fix(generator): discovery walkers now process nested types#29

Merged
MarcelRoozekrans merged 1 commit into
mainfrom
fix/discovery-walker-nested-types
May 23, 2026
Merged

fix(generator): discovery walkers now process nested types#29
MarcelRoozekrans merged 1 commit into
mainfrom
fix/discovery-walker-nested-types

Conversation

@MarcelRoozekrans

Copy link
Copy Markdown
Contributor

Summary

Pre-v2.1 bug surfaced during the v2.1 runtime test scaffolding (PR #28). PolicySymbolWalker and RequireSymbolWalker pushed nested types onto the walk-stack but never called ProcessType on 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, call ProcessType on 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

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>
@MarcelRoozekrans
MarcelRoozekrans merged commit c0dd1ee into main May 23, 2026
4 checks passed
@MarcelRoozekrans
MarcelRoozekrans deleted the fix/discovery-walker-nested-types branch May 23, 2026 16:11
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