Expression cexp = new UntypedAtomicConverter(exp, (AtomicType)reqItemType, true);
ExpressionTool.copyLocationInfo(exp, cexp);
try {
if (exp instanceof Literal) {
exp = Literal.makeLiteral(
new SequenceExtent(cexp.iterate(env.makeEarlyEvaluationContext())).simplify());
} else {
exp = cexp;
}
} catch (XPathException err) {
err.maybeSetLocation(exp);
throw err.makeStatic();
}
itemTypeOK = true;
suppliedItemType = reqItemType;
}
// 2b: some supplied values are untyped atomic. Convert these to the required type; but
// there may be other values in the sequence that won't convert and still need to be checked
if ((suppliedItemType.equals(BuiltInAtomicType.ANY_ATOMIC))
&& !(reqItemType.equals(BuiltInAtomicType.UNTYPED_ATOMIC) || reqItemType.equals(BuiltInAtomicType.ANY_ATOMIC))) {
Expression cexp = new UntypedAtomicConverter(exp, (AtomicType)reqItemType, false);
ExpressionTool.copyLocationInfo(exp, cexp);
try {
if (exp instanceof Literal) {
exp = Literal.makeLiteral(
new SequenceExtent(cexp.iterate(env.makeEarlyEvaluationContext())).simplify());
} else {
exp = cexp;
}
suppliedItemType = exp.getItemType(th);
} catch (XPathException err) {