Bugzilla – Bug 319324
[GMCS] incorrect CS0309 / return type constraint does not consider generic method argument constraints of the method's base definition
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by atsushi@ximian.com 2005-10-19 02:29:46 MST ---- The example code below results in CS0309 error as if generic "where T : IBar" does not exist. interface IFoo {} interface IBar {} class C1<IFoo> where IFoo : IBar { } abstract class C2 { public abstract C1<T> Hoge<T> () where T : IBar; } class C3 : C2 { public override C1<T> Hoge<T> () { return null; } } Actual Results: inherit-constraint2.cs(15,18): error CS0309: The type `T' must be convertible to `IBar' in order to use it as parameter `IFoo' in the generic type or method `C1`1<IFoo>' Expected Results: no CS0309 error. How often does this happen? consistently. ---- Additional Comments From atsushi@ximian.com 2005-10-19 02:36:10 MST ---- As C2.Hoge<T>() compiles fine, it only happens when the method is overriden (and maybe has no constraints on generic arguments internally). ---- Additional Comments From martin@ximian.com 2005-10-24 17:22:35 MST ---- Reassigning to myself; Atsushi needs this. ---- Additional Comments From martin@ximian.com 2005-10-25 09:18:42 MST ---- Fixed in SVN. Unknown operating system unknown. Setting to default OS "Other".