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
Mock setup extensions fail to compile for parameters named matchers or mock #7657
Mocking an interface whose method has a parameter named matchers or mock produces conflicting identifiers in generated setup extensions. Valid interface parameter names should compile with Mock.Of<T>().
Generate a mock with Mock.Of<IService>() and build.
Expected and actual
Expected: generated setup extensions use distinct identifiers and compile.
Actual: setup extensions copy parameter names but also declare a local matchers and a receiver parameter mock, causing duplicate declarations. The predicate-local allocator in #7655 addresses a separate collision and does not fix these fixed names.
Environment
Observed in generated setup extensions at commit 07f7cd9, src/TUnit.Mocks.SourceGenerator/Builders/MockMembersBuilder.cs, in review of #7655. The checked-in snapshot in that PR shows the fixed receiver and local declarations.
Please allocate generated receiver and local names without colliding with source parameter names, with compilation regression coverage.
Activity
Fix mock setup identifier collisions (#7657) (#7658)