Skip to content

Source generator: GenerateGenericTestWithConcreteTypes and its GenerateConcreteTestMetadata chain are unreferenced dead code #7194

Closed

Description

@thomhurst

Found while working on #7161 (PR #7192).

In src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs, GenerateGenericTestWithConcreteTypes (line 5757 on main at d43977c) has no callers. Only its own declaration matches grep -c GenerateGenericTestWithConcreteTypes. It is the only caller of GenerateConcreteTestMetadata (line 7953), and that in turn is the only caller of GenerateConcreteMetadataWithFilteredDataSources (line 8185). Together they are several hundred lines.

That chain duplicates the logic of the live concrete-instantiation path (CollectConcreteInstantiations / EmitConcreteInstanceCreation / EmitConcreteDataSources), including the data-source filtering for [Arguments] rows. Generic-row fixes such as #7106, #7118 and #7161 change only the live path. So the dead copy now encodes outdated semantics and misleads readers who search for where class data sources are chosen.

Reproduce: grep -n "GenerateGenericTestWithConcreteTypes\|GenerateConcreteTestMetadata(\|GenerateConcreteMetadataWithFilteredDataSources(" src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs. Each method is referenced only by its declaration or by the dead method above it.

Expected: remove the unreferenced chain. Generator snapshot output should not change.

Activity

  1. Saad-elnagar commented on Oct 20, 2026

    @Saad-elnagar
    Contributor

    Hi, I'd be interested in contributing a fix for this.

    My understanding is that the goal is to remove the unreferenced GenerateGenericTestWithConcreteTypes chain and verify that the source generator's output remains unchanged.

    Before proceeding, I'll check the current main branch and the changes introduced by #7192 to make sure this cleanup is still needed and doesn't overlap with recent changes.

    Thanks for documenting this!

  2. added
    P3Low: cleanup, minor enhancement, or rare edge case
    on Oct 31, 2026
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