Bug 319324 (MONO76472) - [GMCS] incorrect CS0309 / return type constraint does not consider generic method argument constraints of the method's base definition
Summary: [GMCS] incorrect CS0309 / return type constraint does not consider generic me...
Status: RESOLVED FIXED
Alias: MONO76472
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.1
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-19 09:29 UTC by Atsushi Enomoto
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:35:12 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".