code: private boolean validBooleanExpression(Node expr) {
      if (isBooleanOperation(expr)) {
        return validBooleanOperation(expr);
      }
  
      if (!isOperation(expr)) {
        warnInvalidExpression("boolean", expr);
        return false;
      }
      if (!isValidPredicate(getCallName(expr))) {
        warnInvalid("boolean predicate", expr);
        return false;
      }
      Keywords keyword = nameToKeyword(getCallName(expr));
      if (!checkParameterCount(expr, keyword)) {
        return false;
      }
      switch (keyword.kind) {
        case TYPE_PREDICATE:
          return validTypePredicate(expr, getCallParamCount(expr));
        case STRING_PREDICATE:
          return validStringPredicate(expr, getCallParamCount(expr));
        case TYPEVAR_PREDICATE:
          return validTypevarPredicate(expr, getCallParamCount(expr));
        default:
          throw new IllegalStateException("Invalid boolean expression");
      }
    }
docs: A boolean expression must be a boolean predicate or a boolean
  type predicate