+ ArrayList list = new ArrayList ();
+ foreach (TypeExpr iface_constraint in iface_constraints) {
+ foreach (Type type in list) {
+ if (!type.Equals (iface_constraint.Type))
+ continue;
+
+ Report.Error (405, loc,
+ "Duplicate constraint `{0}' for type " +
+ "parameter `{1}'.", iface_constraint.GetSignatureForError (),
+ name);
+ return false;
+ }
+
+ list.Add (iface_constraint.Type);
+ }
+
+ foreach (TypeParameterExpr expr in type_param_constraints) {
+ foreach (Type type in list) {
+ if (!type.Equals (expr.Type))
+ continue;
+
+ Report.Error (405, loc,
+ "Duplicate constraint `{0}' for type " +
+ "parameter `{1}'.", expr.GetSignatureForError (), name);
+ return false;
+ }
+
+ list.Add (expr.Type);
+ }
+
+ iface_constraint_types = new Type [list.Count];
+ list.CopyTo (iface_constraint_types, 0);
+
+ if (class_constraint != null) {
+ class_constraint_type = class_constraint.Type;
+ if (class_constraint_type == null)
+ return false;
+
+ if (class_constraint_type.IsSealed) {
+ Report.Error (701, loc,
+ "`{0}' is not a valid bound. Bounds " +
+ "must be interfaces or non sealed " +
+ "classes", TypeManager.CSharpName (class_constraint_type));
+ return false;
+ }
+
+ if ((class_constraint_type == TypeManager.array_type) ||
+ (class_constraint_type == TypeManager.delegate_type) ||
+ (class_constraint_type == TypeManager.enum_type) ||
+ (class_constraint_type == TypeManager.value_type) ||
+ (class_constraint_type == TypeManager.object_type)) {
+ Report.Error (702, loc,
+ "Bound cannot be special class `{0}'",
+ TypeManager.CSharpName (class_constraint_type));
+ return false;
+ }
+ }
+
+ if (class_constraint_type != null)
+ effective_base_type = class_constraint_type;
+ else if (HasValueTypeConstraint)
+ effective_base_type = TypeManager.value_type;
+ else
+ effective_base_type = TypeManager.object_type;
+
+ resolved = true;