errors = true;
}
}
}
}
Unit unit = d.getUnit();
if (etn!=null) {
Tree.StaticType et = etn.getType();
if (et!=null) {
ProducedType t = et.getTypeModel();
if (t!=null) {
List<TypeDeclaration> l = t.isRecursiveRawTypeDefinition(singleton((TypeDeclaration)d));
if (!l.isEmpty()) {
if (displayErrors)
etn.addError("inheritance is circular: definition of '" +
d.getName() + "' is recursive, involving " + typeList(l));
d.setExtendedType(unit.getType(unit.getBasicDeclaration()));
d.addBrokenSupertype(t);
d.clearProducedTypeCache();
errors = true;
}
}
}
}
if (!errors) {
List<ProducedType> list = new ArrayList<ProducedType>();
try {
for (ProducedType st: d.getType().getSupertypes()) {
addToIntersection(list, st, unit);
}
IntersectionType it = new IntersectionType(unit);
it.setSatisfiedTypes(list);
it.canonicalize().getType();
}
catch (RuntimeException re) {
if (displayErrors)
that.addError("inheritance hierarchy is undecidable: " +
"could not canonicalize the intersection of all supertypes of '" +
d.getName() + "'");
d.getSatisfiedTypes().clear();
d.setExtendedType(unit.getType(unit.getBasicDeclaration()));
d.clearProducedTypeCache();
return;
}
if (stn!=null) {
for (Tree.StaticType st: stn.getTypes()) {