public XQExpression staticAnalysis(StaticContext statEnv) throws XQueryException {
if(!_analyzed) {
this._analyzed = true;
this._operandExpr = _operandExpr.staticAnalysis(statEnv);
final Type oprType = _operandExpr.getType();
Type retType = null;
Type lastMatchedType = null;
CaseClause lastCC = null;
for(CaseClause cc : _caseClauses) {
cc.staticAnalysis(statEnv);
if(cc != _defaultClause) {
final Type caseType = cc.getVariable().getType();
if(oprType == caseType) {
lastCC = cc;
break;
} else if(TypeUtil.subtypeOf(oprType, caseType)) {
if(lastMatchedType == null || TypeUtil.subtypeOf(caseType, lastMatchedType)) {