fix: skip view generation on FooView name collision (#32)#37
Open
th0114nd wants to merge 1 commit intoanthropics:mainfrom
Open
fix: skip view generation on FooView name collision (#32)#37th0114nd wants to merge 1 commit intoanthropics:mainfrom
th0114nd wants to merge 1 commit intoanthropics:mainfrom
Conversation
…ng (anthropics#32) When a user-defined message `FooView` exists alongside `Foo`, the generated `FooView<'a>` view type for `Foo` would collide. Previously this was a hard `ViewNameConflict` error blocking the entire crate. Now the codegen skips generating the view for `Foo` and continues. The user-defined `FooView` message (and its own view `FooViewView`) are generated normally. Downstream code that references `Foo`'s view will get a targeted compile error rather than a blanket codegen failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Made-with: Cursor
d324e6f to
6061e0e
Compare
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
ViewNameConflicterror with graceful view skipping when a user-defined messageFooViewcollides with the generated view type for sibling messageFoo.generate_viewcalls at both the top-level and nested message recursion points.ViewNameConflicterror variant fromCodeGenError.Fixes #32.
Stacked on #3 (fix/oneof-shadows-parent-name).
Test plan
test_view_name_collision_skips_view_generation— verifies both owned structs exist,FooViewViewis generated, andFoo'sMessageViewimpl is absent.test_view_name_conflict_not_checked_when_views_disabled— unchanged, still passes.cargo test --workspace).cargo clippy --all-targetsclean.Made with Cursor