import { AstUtils } from "langium";
import { isNullish } from "remeda";
import { ast } from "../../ast.js";
import { tryOrLog } from "../_shared.js";
export const outgoingExpressionChecks = (_services) => {
  return tryOrLog((el, accept) => {
    if (ast.isWildcardExpression(el.from) && !ast.isDirectedRelationExpression(el.$container)) {
      const view = AstUtils.getContainerOfType(el, ast.isElementView);
      if (isNullish(view?.viewOf)) {
        accept("warning", "Predicate is ignored as it concerns all relationships", {
          node: el
        });
      }
    }
  });
};
