Repository navigation
Description
Summary
Generic class constructor sources and method providers can lose valid rows or create extra rows when inherited sources participate in inference. Isolate the source composition changes from the inherited literal discovery fix so their behavior and public API can be reviewed separately.
Scope and acceptance
Own constructor-source inference/provider retention and partition emission in src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs, src/TUnit.Core.SourceGenerator/Helpers/GenericClassInferencePolicy.cs, src/TUnit.Core/Attributes/TestData/GenericClassRowPartition.cs, relevant tests/TUnit.PublicAPI snapshots, and source/provider regression fixtures split out of tests/TUnit.TestProject/Bugs/_7490/Tests.cs into a dedicated fixture and snapshot.
Preserve explicit fallback entries, empty groups, inherited deferred own-member sources alongside inferred sources, compatible method providers, declared source types and constructor/method row pairing. Avoid inferred open type parameters, spurious constraint failures, duplicate side effects and unwanted constructor cross-products. Validate the same cases in generated and reflection modes and pin any remaining #7446 difference explicitly. Explain why generator support APIs must be public to be callable from consumer assemblies, and preserve AOT/trimming compatibility. Consolidate partition decisions where practical rather than extending the boolean flag matrix without direct coverage.
Reuse source-related commits from retained branch issue-7490-inherited-inference through aee2f77 selectively. Build on the sibling inherited-literal fix after it merges; do not cherry-pick the entire abandoned PR.
Blocking CI evidence
AOT workflow 41756832504 fails Issue7208Tests.Uninferable_Own_Class_Member_Fails_Only_Its_Class on Linux, macOS and Windows: 42 passing/1 failing tests versus expected 39 passing/4 failing (43 total). Determine whether the three newly successful cases are intended and verify their rows/types before updating expectations. The Test and GeneratesCachedAotCompatibleGetters snapshot failures from workflow 41756832532 are being corrected by prerequisite PR #7544 (closing #7542), following the property-getter change merged in #7524. Build on those corrections and keep the affected generator snapshots passing; do not duplicate that snapshot-only work here. Run affected generator snapshots and PublicAPI checks locally and leave full engine/AOT execution to CI per AGENTS.md.
Deliver this source composition behavior in its own PR under parent #7490, after the literal discovery fix.
Typed-source inference policy regression
PR #7544 review 4463313555 identifies an existing mismatch that this source-composition part must cover. For a typed DataSourceGeneratorAttribute<string, int> row ("source", 42) on C<T>(object first, T second), generator reconciliation maps declared source types through constructor parameters and infers T=int, while reflection and generated runtime partitioning infer T=string from the first non-null value. This policy mismatch already exists on main commit 10a0af727267d12e925079d9667ea5fbee684e80; #7544 only makes typed inference honor the selected row constructor.
Add declared and inherited typed-source fixtures, including [TestConstructor] competing constructors, and assert the exact instantiated types and accepted/rejected rows in both discovery modes. Choose and document one coherent typed-source inference/partition rule across generator reconciliation, generated runtime partitioning, and reflection; preserve the separate constructor-based literal [Arguments] behavior from #7223 and explicitly assess compatibility with #7210's runtime grouping contract. Keep this work here, after #7542, as its acceptance criteria intentionally exclude runtime/source-partition semantics.
Activity
thomhurst commentedon Nov 4, 2026
Triage: removed the redundant blocked label; the native dependency on #7542 remains correct, and open PR #7544 delivers that prerequisite. Updated the snapshot criteria to identify corrections already included in #7544; constructor source composition remains outstanding on current main.