else if (_exp.hasPositionCall())
else if (_exp.hasPositionCall() && _exp.hasLastCall())
    public Type typeCheck(SymbolTable stable) throws TypeCheckError {	Type texp = _exp.typeCheck(stable);	// We need explicit type information for reference types - no good!	if (texp instanceof ReferenceType) {	    _exp = new CastExpr(_exp, texp = Type.Real);	}	// A result tree fragment should not be cast directly to a number type,	// but rather to a boolean value, and then to a numer (0 or 1).	// Ref. section 11.2 of the XSLT 1.0 spec	if (texp instanceof ResultTreeType) {	    _exp = new CastExpr(_exp, Type.Boolean);	    _exp = new CastExpr(_exp, Type.Real);	    texp = _exp.typeCheck(stable);	}	// Numerical types will be converted to a position filter	if (texp instanceof NumberType) {	    // Cast any numerical types to an integer	    if (texp instanceof IntType == false) {		_exp = new CastExpr(_exp, Type.Int);	    }	    SyntaxTreeNode parent = getParent();	    // Expand [last()] into [position() = last()]	    if ((_exp instanceof LastCall) ||		(parent instanceof Pattern) ||		(parent instanceof FilterExpr)) {		final QName position = getParser().getQName("position");		final PositionCall positionCall = new PositionCall(position);		positionCall.setParser(getParser());		positionCall.setParent(this);		_exp = new EqualityExpr(EqualityExpr.EQ, positionCall, _exp);		if (_exp.typeCheck(stable) != Type.Boolean) {		    _exp = new CastExpr(_exp, Type.Boolean);		}		if (parent instanceof Pattern) { 		    _nthPositionFilter = true;		}		else if (parent instanceof FilterExpr) {		    FilterExpr filter = (FilterExpr)parent;		    if (filter.getExpr() instanceof KeyCall)			_canOptimize = false;		    else if (_exp.hasPositionCall())			_canOptimize = false;		    if (_canOptimize)			_nthPositionFilter = true;		}		return _type = Type.Boolean;	    }	    // Use NthPositionIterator to handle [position()] or [a]	    else {		if ((parent != null) && (parent instanceof Step)) {		    parent = parent.getParent();		    if ((parent != null) &&			(parent instanceof AbsoluteLocationPath)) {			// TODO: Special case for "//*[n]" pattern....			_nthDescendant = true;			return _type = Type.NodeSet;		    }		}		_nthPositionFilter = true;		return _type = Type.NodeSet;	    }	}	else if (texp instanceof BooleanType) {	    if (_exp.hasPositionCall())		_nthPositionFilter = true;	}	// All other types will be handled as boolean values	else {	    _exp = new CastExpr(_exp, Type.Boolean);	}	_nthPositionFilter = false;	return _type = Type.Boolean;    }