Bug 324961 (MONO82292) - [GMCS] CS0310 not reported : generic types constraints not checked when generic types imbrication
Summary: [GMCS] CS0310 not reported : generic types constraints not checked when gener...
Status: RESOLVED FIXED
Alias: MONO82292
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Marek Safar
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-02 18:34 UTC by Eric Besombes
Modified: 2011-04-07 11:07 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 20:46:40 UTC


---- Reported by ericbesombes@gmail.com 2007-08-02 11:34:09 MST ----

Mcs does not report error CS0310 when generic types are imbricated whitout 
respecting type arguments contraints.

Code:

  public class Class1
    {
	public Class1 (int i) {}
    }

  public class Class2 <T>
    {}

  public class Class3 <T>
    where T : new()
    {}

Error CS0310 is reported if we compile the following code:

   public class Class4 : Class3 <Class1>
    {}

This is normal since Class1 doesn't respect the constraint 'where T :
new()' of generic class Class3.
Now, let's compile this:

  public class Class5 : Class2 <Class3 <Class1>>
    {}

Compilation with Mcs succeeds while error CS0310 should be returned.

In the same way :

  public class Class7 <T> : Class2 <Class3 <T>>
    {}

Error CS0310 should be reported by Mcs since no constraint is defined for
'T' in Class7, whereas one constraint is defined for 'T' in Class3.

Note: This bug doesn't depend on the constraint : it can be 'where T :
new()' or 'where T : class' or any other.


Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>Independant on the OS while this concerns Mcs (IL binary)</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".

Comment 2 Marek Safar 2011-04-07 11:07:20 UTC
Fixed in master