You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preserve nullable class discovery parity and constructed-struct constructor precedence #7611
Nullable generic class method-source inference must discover the same tests in generated and reflection modes while preserving constructor-supplied class types. Extract the discovery correction from #7591 and fix the remaining constructor-precedence discrepancy before opening its replacement PR.
Proposal
Reuse branch issue-7573-nullable-analyzer at 36c8723ae14871d458537bdc8f3daf4dee479808. Own src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs, src/TUnit.Engine/Discovery/ReflectionTestDataCollector.cs, tests/TUnit.Core.SourceGenerator.Tests/NullableClassMethodRowsTests.cs and its verified snapshot, and tests/TUnit.TestProject/Bugs/_7573/NullableClassMethodRows.cs. Reuse only relevant changes against current main; coordinate overlapping discovery work with #7597. Keep analyzer files in the sibling analyzer issue. Refresh STA snapshots only if still needed on the new base and review each difference.
Blocking finding to resolve
#7591 (comment) : ContainsNullableClassParameter recognizes Nullable but misses Nullable<KeyValuePair<T,int>>. For [Arguments(1d)] class Tests(T seed), Run(KeyValuePair<T,int>?[] values), and an own-class IEnumerable<Func<KeyValuePair<int,int>[]>> source returning a null array, generated discovery adds Tests beside constructor-supplied Tests; reflection retains only Tests. Recognize class parameters inside nullable constructed types and pin constructor precedence in both modes.
Acceptance criteria
Fix that finding with a shared regression that discovers only the constructor-supplied class in both modes.
Preserve the original 35-case nullable discovery coverage: scalar/factory/tuple/array rows, nullable constructed structs, explicit types, scoped multiple sources, nested constructor precedence, partial constructor rows and constraint-valid row-value fallback.
Keep existing last-occurrence inference behavior and exclude unresolved rows, generic sources, argument-taking sources and external generic providers.
Run targeted execution in both modes, affected full generator snapshot suite, and Native AOT publish/execution when changing reflection. Engine tests remain CI-only. Review and commit intentional verified snapshots only.
Avoid suppressing TUnit0001 globally; use the analyzer sibling when available or narrowly suppress the known pending diagnostic in these regression fixtures until it lands. Each part must remain independently mergeable.
Parent: #7573. Split because #7591 exceeded the automated review budget. Policy consolidation remains #7377.
Claimed under issue-7611. Extracting only the discovery files and shared nullable fixtures from 36c8723, with the constructed-nullable constructor-precedence regression. #7610 / #7613 retains analyzer ownership. This change overlaps the discovery files named by #7597; its lock is currently free, and this replacement will identify the overlap for rebasing the later discovery adapter work.
Activity
thomhurst commentedon Nov 4, 2026
Claimed under issue-7611. Extracting only the discovery files and shared nullable fixtures from 36c8723, with the constructed-nullable constructor-precedence regression. #7610 / #7613 retains analyzer ownership. This change overlaps the discovery files named by #7597; its lock is currently free, and this replacement will identify the overlap for rebasing the later discovery adapter work.
Fix optional scalar inference and partial constructor diagnostics (#7611
Retain constructor-inferred optional method sources (#7611)
Match scalar method-source class inference across discovery modes (#7611
Preserve nullable class discovery parity and constructor precedence (#…