To reproduce:
var code =
"""
using Rocks;
#nullable enable
public class AnyOf<T1, T2>
{
public AnyOf(T1 value) { }
public AnyOf(T2 value) { }
public virtual object GetValue() => new();
}
public static class Test
{
public static void Generate()
{
var rock = Rock.Create<AnyOf<object, object>>();
}
}
""";
This creates errors like the following:
error CS0121: The call is ambiguous between the following methods or properties: 'CreateExpectationsOfAnyOfOfobject_objectExtensions.RockAnyOfOfobject_object.RockAnyOfOfobject_object(Expectations<AnyOf<object, object>>, object)' and 'CreateExpectationsOfAnyOfOfobject_objectExtensions.RockAnyOfOfobject_object.RockAnyOfOfobject_object(Expectations<AnyOf<object, object>>, object)'
error CS0111: Type 'CreateExpectationsOfAnyOfOfobject_objectExtensions' already defines a member called 'Instance' with the same parameter types
When AnyOf<,> has the same type for the two generic parameters, it only needs one constructor made. But even then, you can't call the base constructor, because there's no way to specify which one you want to call.
I may have to deem this case unmockable, because I don't think there's any way to even create a subclass in this scenaro.
This was found in Stripe.AnyOf<,>
To reproduce:
This creates errors like the following:
When
AnyOf<,>has the same type for the two generic parameters, it only needs one constructor made. But even then, you can't call the base constructor, because there's no way to specify which one you want to call.I may have to deem this case unmockable, because I don't think there's any way to even create a subclass in this scenaro.
This was found in
Stripe.AnyOf<,>