boolean (@NotNull XPathType left, @NotNull XPathType type) { if (left instanceof ChoiceType) { final XPathType[] types = ((ChoiceType)left).getTypes(); for (XPathType t : types) { if (isAssignable(t, type)) { return true; } } return false; } return left.isAssignableFrom(type) || type.canBePromotedTo(left); }