Fix a second batch of v22 regen regressions (CS1750/CS0182/CS0102/CS0535/CS0246 + ref readonly) - #827
Merged
tannergooding merged 6 commits intoJul 19, 2026
Conversation
A bare negative literal default on an unsigned parameter emitted `unchecked(-1)`, which is `int` and fails to bind to the `uint` parameter (CS1750). Keep the explicit `(uint)` cast. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A transparent-struct-typed default was wrapped in `((HRESULT)(0))`, which isn't a constant expression and fails inside `DefaultParameterValue` (CS0182). Emit the bare constant. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A `static const IID&` alias initialized from `__uuidof` names the same `IID_` symbol the interface's uuid already emits, so a second definition was generated (CS0102). Skip the redundant declaration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A `#define IID_X IID_Y` alias over a `ref readonly Guid` IID dropped the `ref readonly` return, leaving a by-value `Guid` return paired with a `=> ref` body. Preserve the reference so it stays a zero-copy alias. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
When an intermediate base is reached via a forward `typedef struct X X;` (as MIDL interfaces are declared), clang bound it to a non-definition redeclaration whose members were dropped, so multi-level COM interfaces lost the base's vtbl slots (CS0535). Resolve the record to its definition. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A namespaced type used only as a generic-pointer-wrapper template argument dropped its `using`, leaving the `Matrix4x4` reference unresolved (CS0246). Keep the using. 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.
Fixes a second batch of v22.1.8 (clang 22.1.8) regressions found regenerating
terrafx.interop.windows. Each is an independent codegen bug with a focused commit carrying its fix, a regression test, and unified baselines. All six were verified against faithful synthetic repros with the release generator, and the full generator suite is green (4164 passed, 0 warnings).(uint)cast__uuidofconstant alias emits a duplicate IIDref readonlydropped from GUID#definealiasesusing System.Numerics;while still usingMatrix4x4B1 — unsigned default parameter drops the
(uint)cast (CS1750)A bare negative literal default on an unsigned parameter emitted
unchecked(-1), which isintand won't bind to theuintparameter. An explicitUINT(-1)default was unaffected; only a bare-1lost the cast.Now emits
uint value = unchecked((uint)(-1)).B2 — transparent-struct default wrapped in a non-const cast (CS0182)
A transparent-struct-typed default was wrapped in
((HRESULT)(0)), which isn't a constant expression and fails insideDefaultParameterValue. Emit the bare constant (DefaultParameterValue(0)), matching v21.A —
__uuidofconstant alias emits a duplicate IID (CS0102)A
static const IID&alias initialized from__uuidofnames the sameIID_symbol the interface's uuid already emits via_uuidsToGenerate, so a second definition was generated (same member name twice, plus aGuid*-typed field assigned aGuid). Skip the redundant declaration.E —
ref readonlydropped from GUID#definealiasesFor
#define IID_X IID_Yaliases the generator kept a=> ref IID_Ybody but lost theref readonlyon the return type, leaving a by-valueGuidreturn paired with arefbody — semantically a copy, andCS8149in isolation. Preserve the reference so the alias stays zero-copy.C — multi-level COM inheritance drops the immediate base's members (CS0535)
IStreamAsync : IStream : ISequentialStream : IUnknown. When the intermediate base is reached through a forwardtypedef struct IStream IStream;(as MIDL interfaces are declared), clang binds it to a non-definition redeclaration whose members were dropped — soIStreamAsyncflattened IUnknown/ISequentialStream then jumped straight to its own member, skipping IStream'sSeek…Clone. Resolve the record to its definition so every inherited vtbl slot flattens in order.D — dropped
using System.Numerics;while still usingMatrix4x4(CS0246)A namespaced type (
System.Numerics.Matrix4x4) used only as a generic-pointer-wrapper template argument dropped itsusing, leaving theMatrix4x4reference unresolved. Keep the using.Baselines are unified to the repo convention: B1/B2 collapse to a single
{Mode}file (identical across all 16 variants); A/E/C/D collapse to{Mode}+{Mode}.Compatible(theCompatibleconfig differs only by down-level codegen — collection expressions vsnew byte[],InlineArrayvsfixed).