@zenstackhq/language 3.0.0-beta.32 → 3.0.0-beta.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6704,6 +6704,9 @@ var ExpressionValidator = class {
6704
6704
  case "BinaryExpr":
6705
6705
  this.validateBinaryExpr(expr, accept);
6706
6706
  break;
6707
+ case "UnaryExpr":
6708
+ this.validateUnaryExpr(expr, accept);
6709
+ break;
6707
6710
  }
6708
6711
  }
6709
6712
  validateMemberAccessExpr(expr, accept) {
@@ -6845,6 +6848,13 @@ var ExpressionValidator = class {
6845
6848
  break;
6846
6849
  }
6847
6850
  }
6851
+ validateUnaryExpr(expr, accept) {
6852
+ if (expr.operand.$resolvedType && expr.operand.$resolvedType.decl !== "Boolean") {
6853
+ accept("error", `operand of "${expr.operator}" must be of Boolean type`, {
6854
+ node: expr.operand
6855
+ });
6856
+ }
6857
+ }
6848
6858
  validateCollectionPredicate(expr, accept) {
6849
6859
  if (!expr.$resolvedType) {
6850
6860
  accept("error", "collection predicate can only be used on an array of model type", {
@@ -6914,7 +6924,7 @@ var FunctionInvocationValidator = class {
6914
6924
  });
6915
6925
  return;
6916
6926
  }
6917
- if (!this.validateArgs(funcDecl, expr.args, accept)) {
6927
+ if (!this.validateArgs(funcDecl, expr, accept)) {
6918
6928
  return;
6919
6929
  }
6920
6930
  let curr = expr.$container;
@@ -6969,18 +6979,18 @@ var FunctionInvocationValidator = class {
6969
6979
  isValidationAttribute(attr) {
6970
6980
  return !!attr.decl.ref?.attributes.some((attr2) => attr2.decl.$refText === "@@@validation");
6971
6981
  }
6972
- validateArgs(funcDecl, args, accept) {
6982
+ validateArgs(funcDecl, expr, accept) {
6973
6983
  let success = true;
6974
6984
  for (let i = 0; i < funcDecl.params.length; i++) {
6975
6985
  const param = funcDecl.params[i];
6976
6986
  if (!param) {
6977
6987
  continue;
6978
6988
  }
6979
- const arg = args[i];
6989
+ const arg = expr.args[i];
6980
6990
  if (!arg) {
6981
6991
  if (!param.optional) {
6982
6992
  accept("error", `missing argument for parameter "${param.name}"`, {
6983
- node: funcDecl
6993
+ node: expr
6984
6994
  });
6985
6995
  success = false;
6986
6996
  }