Repository navigation
fix C# and Go identifier and member name collisions - #1761
Merged
alexcrichton merged 2 commits intoOct 30, 2026
Merged
alexcrichton merged 2 commits into
alexcrichton merged 2 commits into
Conversation
Fixes duplicate definitions and member name collisions in C# (and Go) bindings generation (bytecodealliance#1731, bytecodealliance#1641, bytecodealliance#1703, bytecodealliance#1515): - Disambiguate variant `Tag` field, `Tags` nested class, `Tags.<Case>` constants, `As<Case>` payload accessors, and static factory methods when variant names or case names collide. - Disambiguate resource `Handle` property, `THandle` struct, `WasmInterop` nested class, `Dispose` implementation, and resource method/static function names when resource or method names collide. - Qualify `global::System.GC.SuppressFinalize(this)` in exported resources. - Allocate `cleanups`, `cleanup`, and async `result` locals via `Ns` so they do not shadow function parameters. - Convert WIT identifiers to camelCase before checking against C# keywords in `to_csharp_ident` / `to_csharp_ident_upper`. - Repeat `*/` sanitization in `print_docs` to handle nested comment closures like `**/`. - Use the mangled payload getter name (`<Case>_()`) when lowering variants in Go if the case name collides with a reserved variant method.
alexcrichton
approved these changes
Oct 30, 2026
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.
Fixes duplicate definitions and member name collisions in C# (and Go) bindings generation (#1731, #1641, #1703, #1515):
Tagfield,Tagsnested class,Tags.<Case>constants,As<Case>payload accessors, and static factory methods when variant names or case names collide.Handleproperty,THandlestruct,WasmInteropnested class,Disposeimplementation, and resource method/static function names when resource or method names collide.global::System.GC.SuppressFinalize(this)in exported resources.cleanups,cleanup, and asyncresultlocals viaNsso they do not shadow function parameters.to_csharp_ident/to_csharp_ident_upper.*/sanitization inprint_docsto handle nested comment closures like**/.<Case>_()) when lowering variants in Go if the case name collides with a reserved variant method.