Initial import of the Generic MCS tree.
[mono.git] / mcs / gmcs / attribute.cs
index 8400748fe900adf677e8c28d1c677b584bbf3087..0b9bb7b08990ffff9edca322f9904d85e53f9bdb 100644 (file)
@@ -75,6 +75,12 @@ namespace Mono.CSharp {
                        Report.Error (-6, loc,\r
                                       "Could not find a constructor for this argument list.");\r
                }\r
+\r
+               static void Error_TypeParameterInAttribute (Location loc)\r
+               {\r
+                       Report.Error (\r
+                               -202, loc, "Can not use a type parameter in an attribute");\r
+               }\r
                \r
                private Type CheckAttributeType (EmitContext ec) {\r
                        Type t;\r
@@ -264,6 +270,11 @@ namespace Mono.CSharp {
                                }\r
 \r
                                e = a.Expr;\r
+                               if (e is TypeParameterExpr){\r
+                                       Error_TypeParameterInAttribute (Location);\r
+                                       return null;\r
+                               }\r
+                                       \r
                                if (member is PropertyExpr) {\r
                                        PropertyExpr pe = (PropertyExpr) member;\r
                                        PropertyInfo pi = pe.PropertyInfo;\r
@@ -625,7 +636,7 @@ namespace Mono.CSharp {
                                foreach (Attribute a in asec.Attributes){\r
                                        if (a.ResolveType (ec) == null)\r
                                                return null;\r
-                                       \r
+\r
                                        if (a.Type != TypeManager.indexer_name_type)\r
                                                continue;\r
 \r