[Mono-bugs] [Bug 76557][Nor] New - [GMCS] consider base interfaces
for CS0309
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Oct 25 14:09:50 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by atsushi at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=76557
--- shadow/76557 2005-10-25 14:09:50.000000000 -0400
+++ shadow/76557.tmp.6466 2005-10-25 14:09:50.000000000 -0400
@@ -0,0 +1,60 @@
+Bug#: 76557
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: martin at ximian.com
+ReportedBy: atsushi at ximian.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: [GMCS] consider base interfaces for CS0309
+
+gmcs does not seem to consider base interfaces of the constrained type
+parameters on CS0309 computation. In the code below, K is IBar, thus it
+should be regarded as to implement IFoo. So no CS0309 error should happen.
+
+(I'm not 100% sure if this understanding is right; it might be regarded as
+a covariant.)
+
+interface IFoo {}
+interface IBar : IFoo {}
+
+class Mona<T> where T : IFoo {}
+
+class Test
+{
+ public Mona<K> GetMona<K> () where K : IBar
+ {
+ return new Mona<K> ();
+ }
+
+ public static void Main () {}
+}
+
+
+Actual Results:
+
+constraint-baseifaces.cs(8,9): error CS0309: The type `K' must be
+convertible to `IFoo' in order to use it as parameter `T' in the generic
+type or method `Mona`1<T>'
+Compilation failed: 1 error(s), 0 warnings
+
+Expected Results:
+
+no error.
+
+How often does this happen?
+
+consistently.
+
+Additional Information:
+
+To my understanding, both of this generic type and this generic method are
+(should be) marked as NonVariant.
More information about the mono-bugs
mailing list