Bug 315755 (MONO62909) - [GMCS]: rejects constraint with dependency an another constraint
Summary: [GMCS]: rejects constraint with dependency an another constraint
Status: RESOLVED FIXED
Alias: MONO62909
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Red Hat 9.0
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-12 08:14 UTC by Ben Martin
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 18:49:49 UTC


---- Reported by benmartin@fourthplanet.net 2004-08-12 01:14:17 MST ----

gmcs gives errors on the following code:

using System;

class A<T> where T: IComparable  {
}

class B<S, T> where T: IComparable where S: A<T> {
}

class Driver {
  public static void Main()
  {
    A<int> a_int;
    B<A<int>, int> b_stuff;
  }
}

with the following error:
cp_test5.cs(6) error CS0309: The type `T' must be convertible to
`System.IComparable' in order to use it as parameter `T' in the generic
type or method `A`1<T>'
Compilation failed: 1 error(s), 0 warnings



---- Additional Comments From benmartin@fourthplanet.net 2004-10-08 15:37:24 MST ----

This no longer causes the above error, but instead crashes with the error:

ALPHA SOFTWARE: Mono C# Compiler 1.1.1.0 for Generics
 
Unhandled Exception: System.NullReferenceException: Object reference
not set to
an instance of an object
in <0x00134> Mono.CSharp.GenericConstraints:get_IsReferenceType ()
in <0x000a7> Mono.CSharp.Convert:ImplicitTypeParameterConversion
(Mono.CSharp.Expression,System.Type)
in <0x00045> Mono.CSharp.Convert:ImplicitReferenceConversionExists
(Mono.CSharp.Expression,System.Type)
in <0x00304> Mono.CSharp.Convert:ImplicitStandardConversionExists
(Mono.CSharp.Expression,System.Type)
in <0x0017e> Mono.CSharp.ConstructedType:CheckConstraint
(Mono.CSharp.EmitContext,System.Type,Mono.CSharp.Expression,System.Type)
in <0x004cb> Mono.CSharp.ConstructedType:CheckConstraints
(Mono.CSharp.EmitContext,int)
in <0x0014c> Mono.CSharp.ConstructedType:ResolveType
(Mono.CSharp.EmitContext)
in <0x00b4d> Mono.CSharp.Constraints:ResolveTypes
(Mono.CSharp.EmitContext)
in <0x002a6> Mono.CSharp.TypeParameter:DefineType
(Mono.CSharp.EmitContext,System.Reflection.Emit.MethodBuilder,System.Reflection.MethodInfo,bool)
in <0x00017> Mono.CSharp.TypeParameter:DefineType
(Mono.CSharp.EmitContext)
in <0x0063c> Mono.CSharp.TypeContainer:DefineType ()
in <0x0042a> Mono.CSharp.RootContext:ResolveTree ()
in <0x00c2e> Mono.CSharp.Driver:MainDriver (string[])
in <0x0001f> Mono.CSharp.Driver:Main (string[])
 




---- Additional Comments From martin@ximian.com 2004-11-18 03:05:54 MST ----

Fixed in SVN, testcase is in gen-102.cs.