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
TUnit.Mocks: generated generic members drop nullable 'class?' constraint (CS8634) #7305
For a generic method constrained where T : class?, the generated setup/verify extension is constrained where T : class. Setting up the method with a nullable type argument then raises CS8634, which fails builds that treat warnings as errors.
warning CS8634: The type 'Foo?' cannot be used as type parameter 'T' in the generic type or method
'ISvc_MockMemberExtensions.Get<T>(Mock<ISvc>, Arg<string>)'. Nullability of type argument 'Foo?' doesn't match 'class' constraint.
Expected
The generator copies the constraint's nullability (class?, and likewise notnull / nullable struct forms) onto the generated members.
Activity
fix(mocks): preserve nullable generic constraints (#7305) (#7414)