}
}
if (type != base) {
// If the base is a union, check if "derived" is allowed through any of the member types.
if (base.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) base;
if (st.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
XSObjectList memberTypes = st.getMemberTypes();
final int length = memberTypes.getLength();
for (int i = 0; i < length; ++i) {
if (typeDerivationOK(derived, (XSTypeDefinition) memberTypes.item(i), blockingConstraint)) {
return true;
}