Extend struct-typed constants onto their struct under extensionReceiver#1743
Open
JeremyKuhne wants to merge 1 commit into
Open
Extend struct-typed constants onto their struct under extensionReceiver#1743JeremyKuhne wants to merge 1 commit into
JeremyKuhne wants to merge 1 commit into
Conversation
When `extensionReceiver` is configured, a constant typed as a typedef struct (HRESULT, NTSTATUS, HWND, BOOL, HKEY, ...) whose struct is owned by a referenced assembly is now attached to that struct through a C# 14 `extension(<Struct>)` block, so it reads as `<Struct>.<Name>` -- matching how the owning assembly surfaces its own constants of that type. Previously these constants only reached the host constants class. Details: * Decoupled from receiver resolvability: a cross-namespace extender whose own receiver (e.g. Windows.Wdk.PInvoke) does not resolve still attaches constants to a resolvable struct such as Windows.Win32.Foundation.NTSTATUS. * When the struct is generated in the same assembly it is injected directly as before (no extension block). * Deduped against the struct's existing members so a lower layer that already exposes the constant is not duplicated. * Silent fallback to the host class when the struct is not in any referenced assembly. Adds unit tests (attach-to-struct-not-receiver, dedup, local-injection-unchanged, compiles-under-C#14) and documents the behavior in composition.md.
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.
When
extensionReceiveris configured, a constant typed as a typedef struct (HRESULT, NTSTATUS, HWND, BOOL, HKEY, ...) whose struct is owned by a referenced assembly is now attached to that struct through a C# 14extension(<Struct>)block, so it reads as<Struct>.<Name>-- matching how the owning assembly surfaces its own constants of that type. Previously these constants only reached the host constants class.Details:
Decoupled from receiver resolvability: a cross-namespace extender whose own receiver (e.g. Windows.Wdk.PInvoke) does not resolve still attaches constants to a resolvable struct such as Windows.Win32.Foundation.NTSTATUS.
When the struct is generated in the same assembly it is injected directly as before (no extension block).
Deduped against the struct's existing members so a lower layer that already exposes the constant is not duplicated.
Silent fallback to the host class when the struct is not in any referenced assembly.
Adds unit tests (attach-to-struct-not-receiver, dedup, local-injection-unchanged, compiles-under-C#14) and documents the behavior in composition.md.