+
+ if (HasClassConstraint && constraints.HasClassConstraint) {
+ Type t1 = ClassConstraint;
+ TypeExpr e1 = class_constraint;
+ Type t2 = constraints.ClassConstraint;
+ TypeExpr e2 = constraints.class_constraint;
+
+ if (!Convert.ImplicitReferenceConversionExists (e1, t2) &&
+ !Convert.ImplicitReferenceConversionExists (e2, t1)) {
+ Report.Error (455, loc,
+ "Type parameter `{0}' inherits " +
+ "conflicting constraints `{1}' and `{2}'",
+ name, t1, t2);
+ return false;
+ }
+ }
+
+ if (constraints.type_param_constraints == null)
+ return true;
+
+ foreach (TypeParameterExpr expr in constraints.type_param_constraints) {
+ if (!CheckDependencies (expr.TypeParameter, ec))
+ return false;
+ }
+
+ return true;
+ }
+
+ public void Define (GenericTypeParameterBuilder type)
+ {
+ if (has_ctor_constraint)
+ type.Mono_SetConstructorConstraint ();
+ if (has_reference_type)
+ type.Mono_SetReferenceTypeConstraint ();
+ else if (has_value_type)
+ type.Mono_SetValueTypeConstraint ();
+ }
+
+ bool GenericConstraints.HasConstructor {
+ get { return has_ctor_constraint; }
+ }
+
+ bool GenericConstraints.IsReferenceType {
+ get { return has_reference_type; }
+ }
+
+ public bool IsValueType {
+ get { return has_value_type; }
+ }
+
+ public bool HasClassConstraint {
+ get { return class_constraint_type != null; }
+ }
+
+ public Type ClassConstraint {
+ get { return class_constraint_type; }
+ }
+
+ Type[] GenericConstraints.InterfaceConstraints {
+ get { return iface_constraint_types; }