Fix v22 NativeTypeName global-scope churn and inline-array field address-of#830
Merged
tannergooding merged 2 commits intoJul 19, 2026
Conversation
clang 22 spells a name with a leading `::` when the unqualified name is shadowed by a type in an enclosing namespace. Strip the leading global-scope qualifier so `::boolean *` matches the ~874 other unqualified `boolean` sites instead of emitting spurious churn. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
An array-to-pointer decay of an inline-array field was passed unaddressed, producing e.g. `NativeMemory.Fill(a->u.Byte, ...)` which does not compile because an `[InlineArray]` field has no implicit `void*` conversion. Emit the `&` when a `MemberExpr` of `ConstantArrayType` decays to a pointer, except in compatible mode where the `fixed` buffer decays naturally. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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.
Two independent v22.1.8 regen regressions found regenerating
terrafx.interop.windows, both fallout from the round-1 namespace-qualifier / address-of work.Strip the redundant global-scope qualifier from NativeTypeName
clang 22 spells a name with a leading
::when the unqualified name is shadowed by a type in an enclosing namespace, and we passed it through verbatim -- e.g.[NativeTypeName("::boolean *")]. The C# type is correctlybyte*, but the qualifier is spurious churn that is inconsistent with the ~874 other unqualifiedbooleansites. Strip a leading global-scope::at the type-name position (after cv/tag qualifiers) so::boolean *normalizes toboolean *. The refactor also extracts the leading-qualifier skip into a sharedSkipLeadingTypeQualifiershelper.Take the address of an inline-array field decayed to a pointer
An array-to-pointer decay of an inline-array field was emitted unaddressed, e.g.
NativeMemory.Fill(a->u.Byte, ...). That does not compile in Default/Latest/Preview because an[InlineArray]field has no implicitvoid*conversion (CS1503). Emit the&when aMemberExprofConstantArrayTypedecays to a pointer, except in compatible mode where thefixedbuffer decays naturally (adding&there would beT**). Restricting toMemberExprleaves managed-array locals and explicit source&untouched -- locals needfixed/pinning, not&.Added regression tests
GlobalScopeQualifierIsStrippedTestandArrayFieldToPointerArgumentTestwith unified baselines. Full suite green (4205 passed, 0 failed), zero existing-baseline churn.