The C# compiler rejects the following code:
class A { }
class B { }
interface IInterface<T> { }
abstract class BaseType<T> : IInterface<T>, IInterface<B> where T : A { }
With an error on BaseType<T>
saying:
'
BaseType<T>
' cannot implement both 'IInterface<T>
' and 'IInterface<B>
' because they may unify for some type parameter substitutions
When omitting the type constraint on T
so that it does not have to inherit from A
, I can see why this would be a problem, but with this constraint in place everything should be fine right?
Is there a scenario I am missing, or is this just a case of the compiler not figuring out that these types are disjoint?