+2004-03-16 Martin Baulig <martin@ximian.com>
+
+ * class.cs (TypeContainer.GetClassBases): Moved
+ Error_TypeParameterAsBase() here and also check whether the base
+ class is not an attribute.
+
2004-03-16 Martin Baulig <martin@ximian.com>
* class.cs (TypeContainer.GetClassBases): Fix the CS0528 check.
}
}
- void Error_TypeParameterAsBase (TypeParameterExpr e)
- {
- Report.Error (
- 689, e.Location,
- "Type parameter `{0}' can not be used as a " +
- "base class or interface", e.Name);
- }
-
/// <remarks>
/// The pending methods that need to be implemented (interfaces or abstract methods)
/// </remarks>
}
if (name is TypeParameterExpr){
- Error_TypeParameterAsBase ((TypeParameterExpr) name);
+ Report.Error (
+ 689, name.Location,
+ "Type parameter `{0}' can not be used as a " +
+ "base class or interface", name.Name);
+ error = true;
+ return null;
+ }
+
+ if (IsGeneric && name.IsAttribute){
+ Report.Error (
+ 698, name.Location,
+ "A generic type cannot derive from `{0}' " +
+ "because it is an attribute class", name.Name);
error = true;
return null;
}
base_class_name = parent.Name;
TypeExpr [] ifaces = new TypeExpr [count-start];
-
+
for (i = start, j = 0; i < count; i++, j++){
Expression name = (Expression) bases [i];
TypeExpr resolved = ResolveTypeExpr (name, false, Location);
+
if (resolved == null)
return null;
get { return gt.IsSealed; }
}
+ public override bool IsAttribute {
+ get { return false; }
+ }
+
public override TypeExpr[] GetInterfaces ()
{
TypeExpr[] ifaces = TypeManager.GetInterfaces (gt);
return ifaces;
}
+ public override bool Equals (object obj)
+ {
+ ConstructedType cobj = obj as ConstructedType;
+ if (cobj == null)
+ return false;
+
+ if ((type == null) || (cobj.type == null))
+ return false;
+
+ return type == cobj.type;
+ }
+
public override string Name {
get {
return full_name;