[Mono-bugs] [Bug 653710] Nested generics constraints produce spurious CS0413 error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Dec 6 16:19:40 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=653710

https://bugzilla.novell.com/show_bug.cgi?id=653710#c1


--- Comment #1 from Thomas Philpot <tom.philpot at logos.com> 2010-12-06 21:19:39 UTC ---
Here's a patch which seems to fix the problem by looking at the type specifiers
if the initial condition is not satisfied.

diff --git a/mcs/mcs/generic.cs b/mcs/mcs/generic.cs
index e05c459..45770fd 100644
--- a/mcs/mcs/generic.cs
+++ b/mcs/mcs/generic.cs
@@ -691,7 +691,21 @@ namespace Mono.CSharp {
                //
                public bool IsReferenceType {
                        get {
-                               return (spec & SpecialConstraint.Class) != 0 ||
HasTypeConstraint;
+                               if ((spec & SpecialConstraint.Class) != 0 ||
HasTypeConstraint)
+                                       return true;
+
+                               if (targs != null) {
+                                       foreach (TypeSpec typeSpec in targs) {
+                                               if (typeSpec != null) {
+                                                       TypeParameterSpec
typeParamSpec = typeSpec as TypeParameterSpec;
+                                                       if (typeParamSpec !=
null && typeParamSpec.IsReferenceType)     {
+                                                               return true;
+                                                       }
+                                               }
+                                       }
+                               }
+                               
+                               return false;
                        }
                }

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list