@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.cjs CHANGED
@@ -6740,6 +6740,9 @@ var ExpressionValidator = class {
6740
6740
  case "BinaryExpr":
6741
6741
  this.validateBinaryExpr(expr, accept);
6742
6742
  break;
6743
+ case "UnaryExpr":
6744
+ this.validateUnaryExpr(expr, accept);
6745
+ break;
6743
6746
  }
6744
6747
  }
6745
6748
  validateMemberAccessExpr(expr, accept) {
@@ -6881,6 +6884,13 @@ var ExpressionValidator = class {
6881
6884
  break;
6882
6885
  }
6883
6886
  }
6887
+ validateUnaryExpr(expr, accept) {
6888
+ if (expr.operand.$resolvedType && expr.operand.$resolvedType.decl !== "Boolean") {
6889
+ accept("error", `operand of "${expr.operator}" must be of Boolean type`, {
6890
+ node: expr.operand
6891
+ });
6892
+ }
6893
+ }
6884
6894
  validateCollectionPredicate(expr, accept) {
6885
6895
  if (!expr.$resolvedType) {
6886
6896
  accept("error", "collection predicate can only be used on an array of model type", {
@@ -6950,7 +6960,7 @@ var FunctionInvocationValidator = class {
6950
6960
  });
6951
6961
  return;
6952
6962
  }
6953
- if (!this.validateArgs(funcDecl, expr.args, accept)) {
6963
+ if (!this.validateArgs(funcDecl, expr, accept)) {
6954
6964
  return;
6955
6965
  }
6956
6966
  let curr = expr.$container;
@@ -7005,18 +7015,18 @@ var FunctionInvocationValidator = class {
7005
7015
  isValidationAttribute(attr) {
7006
7016
  return !!attr.decl.ref?.attributes.some((attr2) => attr2.decl.$refText === "@@@validation");
7007
7017
  }
7008
- validateArgs(funcDecl, args, accept) {
7018
+ validateArgs(funcDecl, expr, accept) {
7009
7019
  let success = true;
7010
7020
  for (let i = 0; i < funcDecl.params.length; i++) {
7011
7021
  const param = funcDecl.params[i];
7012
7022
  if (!param) {
7013
7023
  continue;
7014
7024
  }
7015
- const arg = args[i];
7025
+ const arg = expr.args[i];
7016
7026
  if (!arg) {
7017
7027
  if (!param.optional) {
7018
7028
  accept("error", `missing argument for parameter "${param.name}"`, {
7019
- node: funcDecl
7029
+ node: expr
7020
7030
  });
7021
7031
  success = false;
7022
7032
  }