*/
public Type typeCheck(Type expected) throws TypeException {
// we need to check the returnValue expression against the type of the trigger method
type = rule.getReturnType();
if (returnValue == null && !type.isVoid()) {
throw new TypeException("ReturnExpression.typeCheck : return expression must supply argument when triggered from method with return type " + type.getName() + getPos());
} else if (returnValue != null) {
if (type.isVoid()) {
throw new TypeException("ReturnExpression.typeCheck : return expression must not supply argument when triggered from void method" + getPos());
}
returnValue.typeCheck(type);
}
return type;
}