Skip to content

Test generic class type inference from untyped class data source rows that contain null values #7360

Closed

Description

@thomhurst

What I saw

#7339 (#7210) added GenericClassRowPartition.InferClassTypeArguments (src/TUnit.Core/Attributes/TestData/GenericClassRowPartition.cs), the one rule both modes use to infer a generic test class's type arguments from an untyped class-level data source row. It handles null values specially:

  • With one type parameter, it skips leading null values and uses the first non-null value's run-time type. A row of only nulls infers nothing.
  • With several type parameters, a null among the leading values makes the row infer nothing.

The tests/TUnit.TestProject/Bugs/_7210 scenarios and the generator snapshots do not cover rows with null values. Claude's review of #7339 (comment 6565864008, item 5) raised this.

Expected

Add _7210-style scenarios, run in both modes by an Issue7210Tests-style engine test, for an untyped class source on a generic class that yields:

  1. [null, 5] for Class<T>(T? a, int b): infers from the first non-null value, with the same tests in both modes.
  2. A row of only nulls, which falls back like a row that infers nothing (AllRows / NoClassRow).
  3. A two-parameter class with a null leading value.

Both modes should discover and run identical tests.

Activity

  1. added
    enhancementNew feature or request
    P3Low: cleanup, minor enhancement, or rare edge case
    on Nov 2, 2026
  2. thomhurst commented on Nov 3, 2026

    @thomhurst
    OwnerAuthor

    Audited against origin/main d87516c: GenericClassRowPartition.InferClassTypeArguments still has the documented null branches, and _7210/MixedClassSourceRowTests.cs does not cover these null rows. The requested coverage remains actionable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low: cleanup, minor enhancement, or rare edge caseenhancementNew feature or requestin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions