Repository navigation
Fix class argument literals to use constructor parameter types - #7496
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Pre-merge checks:
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
[Medium impact] The PR appears safe to merge; the previous constructor-call build failure is fixed. SummaryClass-level
No new actionable issues were found. The numbered previous finding is fixed.
Reviews (17) · Last reviewed commit: "Fix by-reference class constructor calls..." · Reviewed by Greptile |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5066d652e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Review: Fix class argument literals to use constructor parameter typesI found no blocking issues. The change is correct and well scoped. What I checked
Minor suggestions, non-blocking
Overall this is a good fix with solid fixtures and snapshots. Approving from my side. |
This comment has been minimized.
This comment has been minimized.
|
Fixed the generic decimal constructor finding from #7496 (comment) in 4fc3575. Reproduced all five rows failing with MissingMethodException before the fix. Generic factories consuming runtime rows now use typed constructor calls with CastHelper conversions, selecting the constructor used by class-row inference. This also preserves first-public/[TestConstructor] selection when constructors are overloaded. Added generic multiple-row regressions for long, double/float constants, and an escaped string constant. Reviewed and updated eight generator snapshots. Validation on SDK 10.0.403/net10.0: generator suite 250 passed, 1 skipped; #7440 execution 15 passed in each discovery mode. Selected passing fixtures for #7106, #7118, #7161, #7209, #7210, and #7335 also passed in both modes (existing explicit/skipped cases remain skipped). #7222 has intentionally failing fixtures and no EngineTest=Pass matches; its generator snapshot passed, and engine coverage remains for CI per repository instructions. No reflection path or shipped public API was added. Claude's three minor suggestions are non-blocking cleanup/coverage suggestions; leaving the existing helper layout, parameter naming, and exponent coverage unchanged keeps this fix scoped to constructor conversion. |
|
@codex review |
Review of #7496The change looks correct. I read the diff but did not build it or run any tests. What it does well
Suggestions (non-blocking)
Nothing blocking. Good fix, and the tests cover it well. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fc35754d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Both blocking constructor-factory findings are fixed in 6b1389b and their threads resolved. Claude's latest non-blocking suggestions: retaining the existing parameter-symbol API keeps this fix scoped; the multi-row factory already uses typed calls (now covered by required-members and params snapshots); the PR body has been shortened and validation refreshed. Reflection constructor params packing was corrected alongside source generation to preserve discovery parity. Native AOT publish and all 21 targeted native tests passed; pre-existing generic-property dynamic metadata warnings are tracked in #7499. |
|
@codex review |
Review of #7496. The approach looks sound: class-level Arguments literals are typed from the selected constructor, the generated factory replaces Activator.CreateInstance, and trailing params packing matches in both discovery modes. Limiting the decimal m-suffix path to real numeric literals is a good fix. I only read the diff; I have not built it or run tests. Concern: constructor choice is now fixed per class. EmitConcreteInstanceCreation now calls GenerateInstanceFactoryBody(constructedType, GetClassRowConstructor(constructedType)). Activator picked a constructor from runtime arg count and types; the new code always uses the TestConstructor constructor or the first public one. A class with several public constructors, e.g. C(int) and C(int, string), with rows for the second would previously work and would now index args for the wrong constructor. This also affects the non-generic HasParameterizedConstructor branch. Suggest a test with two public constructors of different arity, or keeping an Activator fallback when more than one eligible constructor exists. Smaller points: (1) GetClassRowConstructor only considers public constructors and GenerateInstanceFactoryBody silently falls back to GetPrimaryConstructor otherwise; worth a comment. (2) Trailing array/params logic is now duplicated between GenerateTypedConstructorCallBody and ReflectionTestDataCollector; a shared runtime helper would stop the two modes drifting. (3) The SetsRequiredMembers check compares a display string; a well-known-name constant would match the rest of the generator. Only the multi-constructor behaviour change warrants a test before merge. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b1389baa6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Fixed the omitted optional-array findings in fab6440. The fix preserves declared defaults for omitted optional plain arrays in reflection factories and generated runtime-row factories; empty params arrays still stay empty. Added a generic two-row regression and a zero-argument row regression. For the constructor-selection concern in the latest Claude comment: class rows already select the public [TestConstructor], otherwise the first public constructor, in TestMetadataGenerator.GetClassRowConstructor and ReflectionGenericTypeResolver.FindRowConstructor; ReflectionTestDataCollector.SelectInstanceConstructor uses the same rule. TUnit0052 asks ambiguous multi-constructor tests to select [TestConstructor]. Falling back to Activator overload selection would disagree with class metadata/type inference and reflection discovery, and reintroduce the numeric conversion problem addressed here. Retaining that selection is intentional. Added a regression with constructors of different arities where [TestConstructor] selects the second and the other throws; it passes in both discovery modes. The remaining minor cleanup suggestions are non-blocking and remain outside this constructor conversion fix. Validation on SDK 10.0.403/net10.0: 26 targeted tests passed in each discovery mode and in the Native AOT executable; Native AOT publishing succeeded. Core generator suite: 250 passed, 1 skipped, with one reviewed snapshot update in this commit. Existing warnings remain tracked in #7410, #7412, #7419, #7428, #7430, #7452, #7493 and #7499. No shipped API changes; Engine.Tests remains for CI as required. |
|
@codex review |
Review of #7496 (class-level
|
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
fab6440 to
944df27
Compare
|
Rebased onto current main (9d6a435), preserving its one-element tuple data-source binding option alongside the nullable class-constructor target. The integration also makes method-data-source tuple inspection accept a missing public constructor instead of introducing a nullable warning or dereference. Latest Claude suggestions are non-blocking. Constructor selection across the other factory entry points is already tracked by #7365; this PR keeps its selected-constructor conversion fix and the different-arity Rebase validation: core generator snapshots 251 passed, 1 skipped, with no snapshot differences; all 26 #7440 tests passed in each discovery mode. Engine.Tests remains for CI per repository instructions. Existing warnings remain tracked in the issues listed in the PR body. |
Class-level
[Arguments]now emit literals using the selected constructor parameter types. This fixes decimal method parameters changing boxed class arguments and breaking constructor binding (#7440).Generic class factories use the selected constructor with runtime argument conversions. They preserve required-member values and constructor identity after generic substitution, and emit locals with the required modifiers for by-reference arguments. Generated and reflection discovery retain explicit arrays/null, pack trailing rows, preserve optional array defaults, and try whole-array user conversions before scalar packing. Referenced generic attributes preserve array and enum values; floating-point constants retain runtime conversion semantics.
Validation (SDK 10.0.403/net10.0): full core generator suite 327 passed, 1 skipped; all 42 targeted #7440 tests passed in generated and reflection discovery. Reviewed the affected verified snapshot. The new generic ref-constructor regression fails with CS1620 before the fix. Native AOT validation is recorded in the latest disposition comment. Engine.Tests remains CI-only per repository instructions. No public API changes.
Broader pre-existing required-member initialization behavior is tracked in #7516. Existing AOT/build warning categories remain tracked in #7499, #7410, #7412, #7419, #7428, #7430, #7452 and #7493.
Closes #7440
Summary by CodeRabbit
paramsparameters, and required members.