@rsconcept/domain 1.4.2 → 1.4.3

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.
Files changed (41) hide show
  1. package/dist/{analyzer-BliNe3pV.d.ts → analyzer-CvnbnrSX.d.ts} +2 -2
  2. package/dist/{ast-annotations-GOkbNN8F.d.ts → ast-annotations-B4T8S2DS.d.ts} +2 -2
  3. package/dist/{calculator-DFevxZyV.d.ts → calculator-8tErfQcI.d.ts} +2 -2
  4. package/dist/{error-deey7EiC.d.ts → error-DuqsZDL5.d.ts} +2 -1
  5. package/dist/index.d.ts +4 -4
  6. package/dist/index.js +2 -2
  7. package/dist/library/rsengine.d.ts +1 -1
  8. package/dist/library/rsengine.js +2 -2
  9. package/dist/library/rsform-api.d.ts +1 -1
  10. package/dist/library/rsform.d.ts +1 -1
  11. package/dist/library/rsmodel-api.js +1 -1
  12. package/dist/rslang/ast-annotations.d.ts +1 -1
  13. package/dist/rslang/error.d.ts +1 -1
  14. package/dist/rslang/error.js +1 -0
  15. package/dist/rslang/error.js.map +1 -1
  16. package/dist/rslang/eval/calculator.d.ts +1 -1
  17. package/dist/rslang/eval/calculator.js +1 -1
  18. package/dist/rslang/eval/evaluator.d.ts +1 -1
  19. package/dist/rslang/eval/evaluator.js +7 -2
  20. package/dist/rslang/eval/evaluator.js.map +1 -1
  21. package/dist/rslang/eval/value-api.js +1 -1
  22. package/dist/rslang/eval/value.js +1 -1
  23. package/dist/rslang/index.d.ts +4 -4
  24. package/dist/rslang/index.js +1 -1
  25. package/dist/rslang/labels.js +1 -0
  26. package/dist/rslang/labels.js.map +1 -1
  27. package/dist/rslang/parser/syntax-errors.d.ts +1 -1
  28. package/dist/rslang/semantic/analyzer.d.ts +1 -1
  29. package/dist/rslang/semantic/type-auditor.d.ts +2 -1
  30. package/dist/rslang/semantic/type-auditor.js +73 -20
  31. package/dist/rslang/semantic/type-auditor.js.map +1 -1
  32. package/dist/rslang/semantic/value-auditor.d.ts +1 -1
  33. package/dist/{value-ybFBRuz6.js → value-COprb2Je.js} +2 -2
  34. package/dist/{value-ybFBRuz6.js.map → value-COprb2Je.js.map} +1 -1
  35. package/package.json +1 -1
  36. package/src/rslang/error.ts +1 -0
  37. package/src/rslang/eval/evaluator.test.ts +2 -2
  38. package/src/rslang/eval/evaluator.ts +2 -1
  39. package/src/rslang/labels.ts +1 -0
  40. package/src/rslang/semantic/type-auditor.test.ts +18 -16
  41. package/src/rslang/semantic/type-auditor.ts +65 -20
@@ -38,6 +38,7 @@ const labelTokenRecord: Partial<Record<TokenID, string>> = {
38
38
  [TokenID.NT_DECLARATIVE_EXPR]: 'D{}',
39
39
  [TokenID.NT_IMPERATIVE_EXPR]: 'I{}',
40
40
  [TokenID.NT_RECURSIVE_FULL]: 'R{}',
41
+ [TokenID.NT_RECURSIVE_SHORT]: 'R{}',
41
42
  [TokenID.BIGPR]: 'Pr1()',
42
43
  [TokenID.SMALLPR]: 'pr1()',
43
44
  [TokenID.FILTER]: 'Fi1[]()',
@@ -170,14 +170,14 @@ const errorData = [
170
170
  ['card(S3)', { code: RSErrorCode.invalidCard, from: 5, to: 7, params: ['C1'] }],
171
171
  ['card(1)', { code: RSErrorCode.invalidCard, from: 5, to: 6, params: ['Z'] }],
172
172
  ['card((1,2))', { code: RSErrorCode.invalidCard, from: 5, to: 10, params: ['Z×Z'] }],
173
- ['debool(X1)+1', { code: RSErrorCode.arithmeticNotSupported, from: 0, to: 10, params: ['X1'] }],
174
- ['1+debool(X1)', { code: RSErrorCode.arithmeticNotSupported, from: 2, to: 12, params: ['X1'] }],
173
+ ['debool(X1)+1', { code: RSErrorCode.arithmeticNotSupported, from: 0, to: 10, params: ['X1', '+'] }],
174
+ ['1+debool(X1)', { code: RSErrorCode.arithmeticNotSupported, from: 2, to: 12, params: ['X1', '+'] }],
175
175
  // Logical
176
176
  ['debool(X1)<1', { code: RSErrorCode.orderingNotSupported, from: 0, to: 10, params: ['X1', '<'] }],
177
177
  ['1<debool(X1)', { code: RSErrorCode.orderingNotSupported, from: 2, to: 12, params: ['X1', '<'] }],
178
- ['debool(X1)=1', { code: RSErrorCode.typesNotCompatible, from: 0, to: 12, params: ['X1', 'Z'] }],
179
- ['1=debool(X1)', { code: RSErrorCode.typesNotCompatible, from: 0, to: 12, params: ['Z', 'X1'] }],
180
- ['S1=S2', { code: RSErrorCode.typesNotCompatible, from: 0, to: 5, params: ['ℬ(X1×X1)', 'ℬℬ(X1)'] }],
178
+ ['debool(X1)=1', { code: RSErrorCode.typesNotCompatible, from: 0, to: 12, params: ['X1', 'Z', '='] }],
179
+ ['1=debool(X1)', { code: RSErrorCode.typesNotCompatible, from: 0, to: 12, params: ['Z', 'X1', '='] }],
180
+ ['S1=S2', { code: RSErrorCode.typesNotCompatible, from: 0, to: 5, params: ['ℬ(X1×X1)', 'ℬℬ(X1)', '='] }],
181
181
  ['∀a,a∈X1 a=a', { code: RSErrorCode.localShadowing, from: 3, to: 4, params: ['a'] }],
182
182
  ['∀(a,a)∈S1 a=a', { code: RSErrorCode.localShadowing, from: 4, to: 5, params: ['a'] }],
183
183
  ['∀(a,b)∈X1 a=b', { code: RSErrorCode.invalidCortegeDeclare, from: 2, to: 3 }],
@@ -190,9 +190,9 @@ const errorData = [
190
190
  ['(1,2)∈Z', { code: RSErrorCode.invalidElementPredicate, from: 0, to: 7, params: ['Z×Z', '∈', 'ℬ(Z)'] }],
191
191
  ['{1}∈Z', { code: RSErrorCode.invalidElementPredicate, from: 0, to: 5, params: ['ℬ(Z)', '∈', 'ℬ(Z)'] }],
192
192
  ['{1}∉Z', { code: RSErrorCode.invalidElementPredicate, from: 0, to: 5, params: ['ℬ(Z)', '∉', 'ℬ(Z)'] }],
193
- ['X1⊆S2', { code: RSErrorCode.typesNotEqual, from: 0, to: 5, params: ['ℬ(X1)', 'ℬℬ(X1)'] }],
194
- ['X1⊄S2', { code: RSErrorCode.typesNotEqual, from: 0, to: 5, params: ['ℬ(X1)', 'ℬℬ(X1)'] }],
195
- ['X1⊂S2', { code: RSErrorCode.typesNotEqual, from: 0, to: 5, params: ['ℬ(X1)', 'ℬℬ(X1)'] }],
193
+ ['X1⊆S2', { code: RSErrorCode.typesNotEqual, from: 0, to: 5, params: ['ℬ(X1)', 'ℬℬ(X1)', '⊆'] }],
194
+ ['X1⊄S2', { code: RSErrorCode.typesNotEqual, from: 0, to: 5, params: ['ℬ(X1)', 'ℬℬ(X1)', '⊄'] }],
195
+ ['X1⊂S2', { code: RSErrorCode.typesNotEqual, from: 0, to: 5, params: ['ℬ(X1)', 'ℬℬ(X1)', '⊂'] }],
196
196
  // Constructors
197
197
  ['ℬ(S3)', { code: RSErrorCode.invalidBoolean, from: 2, to: 4, params: ['C1'] }],
198
198
  ['ℬ((1,2))', { code: RSErrorCode.invalidBoolean, from: 2, to: 7, params: ['Z×Z'] }],
@@ -202,15 +202,15 @@ const errorData = [
202
202
  ['{1, X1}', { code: RSErrorCode.invalidEnumeration, from: 4, to: 6, params: ['Z', 'ℬ(X1)'] }],
203
203
  ['{X1, 1}', { code: RSErrorCode.invalidEnumeration, from: 5, to: 6, params: ['ℬ(X1)', 'Z'] }],
204
204
  ['{(1,2), (X1,X1)}', { code: RSErrorCode.invalidEnumeration, from: 8, to: 15, params: ['Z×Z', 'ℬ(X1)×ℬ(X1)'] }],
205
- ['R{a := S1 | {a}}', { code: RSErrorCode.typesNotEqual, from: 12, to: 15, params: ['ℬℬ(X1×X1)', 'ℬ(X1×X1)'] }],
205
+ ['R{a := S1 | {a}}', { code: RSErrorCode.typesNotEqual, from: 12, to: 15, params: ['ℬℬ(X1×X1)', 'ℬ(X1×X1)', 'R{}'] }],
206
206
  [
207
207
  'I{(a, b) | a:∈X1; b:={a}; a≠b}',
208
- { code: RSErrorCode.typesNotCompatible, from: 26, to: 29, params: ['X1', 'ℬ(X1)'] }
208
+ { code: RSErrorCode.typesNotCompatible, from: 26, to: 29, params: ['X1', 'ℬ(X1)', '≠'] }
209
209
  ],
210
210
  // Set operations
211
211
  ['X1 ∪ ∅', { code: RSErrorCode.invalidEmptySetUsage, from: 5, to: 6 }],
212
- ['X1 ∪ S1', { code: RSErrorCode.typesNotEqual, from: 0, to: 7, params: ['ℬ(X1)', 'ℬ(X1×X1)'] }],
213
- ['S1 ∪ X1', { code: RSErrorCode.typesNotEqual, from: 0, to: 7, params: ['ℬ(X1×X1)', 'ℬ(X1)'] }],
212
+ ['X1 ∪ S1', { code: RSErrorCode.typesNotEqual, from: 0, to: 7, params: ['ℬ(X1)', 'ℬ(X1×X1)', '∪'] }],
213
+ ['S1 ∪ X1', { code: RSErrorCode.typesNotEqual, from: 0, to: 7, params: ['ℬ(X1×X1)', 'ℬ(X1)', '∪'] }],
214
214
  ['Pr1(X1)', { code: RSErrorCode.invalidProjectionSet, from: 4, to: 6, params: ['Pr1', 'ℬ(X1)'] }],
215
215
  ['Pr3(S1)', { code: RSErrorCode.invalidProjectionSet, from: 4, to: 6, params: ['Pr3', 'ℬ(X1×X1)'] }],
216
216
  ['Pr1,3(S1)', { code: RSErrorCode.invalidProjectionSet, from: 6, to: 8, params: ['Pr1,3', 'ℬ(X1×X1)'] }],
@@ -219,11 +219,11 @@ const errorData = [
219
219
  ['pr1(debool(X1))', { code: RSErrorCode.invalidProjectionTuple, from: 4, to: 14, params: ['pr1', 'X1'] }],
220
220
  ['pr3(debool(S1))', { code: RSErrorCode.invalidProjectionTuple, from: 4, to: 14, params: ['pr3', 'X1×X1'] }],
221
221
  ['Fi1[X1](ℬ(X1))', { code: RSErrorCode.invalidFilterArgumentType, from: 8, to: 13, params: ['Fi1', 'ℬℬ(X1)'] }],
222
- ['Fi1[1](S1)', { code: RSErrorCode.typesNotEqual, from: 4, to: 5, params: ['Z', 'ℬ(X1)'] }],
223
- ['Fi1[X1](ℬ(X1)×X1)', { code: RSErrorCode.typesNotEqual, from: 4, to: 6, params: ['ℬ(X1)', 'ℬℬ(X1)'] }],
222
+ ['Fi1[1](S1)', { code: RSErrorCode.typesNotEqual, from: 4, to: 5, params: ['Z', 'ℬ(X1)', 'Fi1'] }],
223
+ ['Fi1[X1](ℬ(X1)×X1)', { code: RSErrorCode.typesNotEqual, from: 4, to: 6, params: ['ℬ(X1)', 'ℬℬ(X1)', 'Fi1'] }],
224
224
  ['Fi3[X1](S1)', { code: RSErrorCode.invalidFilterArgumentType, from: 8, to: 10, params: ['Fi3', 'ℬ(X1×X1)'] }],
225
225
  ['Fi1[X1,X1](S1)', { code: RSErrorCode.invalidFilterArity, from: 0, to: 14 }],
226
- ['Fi1,2[X1](S1)', { code: RSErrorCode.typesNotEqual, from: 6, to: 8, params: ['ℬ(X1)', 'ℬ(X1×X1)'] }],
226
+ ['Fi1,2[X1](S1)', { code: RSErrorCode.typesNotEqual, from: 6, to: 8, params: ['ℬ(X1)', 'ℬ(X1×X1)', 'Fi1,2'] }],
227
227
  ['red(X1)', { code: RSErrorCode.invalidReduce, from: 4, to: 6, params: ['ℬ(X1)'] }],
228
228
  ['debool(S3)', { code: RSErrorCode.invalidDebool, from: 7, to: 9, params: ['C1'] }],
229
229
  // Locals
@@ -236,7 +236,9 @@ const errorData = [
236
236
  // Logic vs setexpr discrimination
237
237
  ['D{α∈X1|F1[X1,X1]}', { code: RSErrorCode.expectedLogic, from: 7, to: 16, params: ['ℬ(X1)'] }],
238
238
  ['F1[1=1,X1]', { code: RSErrorCode.expectedSetexpr, from: 3, to: 6, params: ['Logic'] }],
239
- ['∀a∈(1=1) a=a', { code: RSErrorCode.expectedSetexpr, from: 3, to: 8, params: ['Logic'] }],
239
+ ['∀a∈(1=1) a=a', { code: RSErrorCode.invalidQuantifierDomain, from: 3, to: 8, params: ['∀', 'Logic'] }],
240
+ ['∀a∈Z a=a', { code: RSErrorCode.invalidQuantifierDomain, from: 3, to: 4, params: ['∀', 'Z'] }],
241
+ ['∃a∈Z a=a', { code: RSErrorCode.invalidQuantifierDomain, from: 3, to: 4, params: ['∃', 'Z'] }],
240
242
  ['∀a∈X1 F1[{a},X1]', { code: RSErrorCode.expectedLogic, from: 6, to: 16, params: ['ℬ(X1)'] }],
241
243
  ['(1=1)∪X1', { code: RSErrorCode.expectedSetexpr, from: 0, to: 5, params: ['Logic'] }],
242
244
  ['X1 & 1=1', { code: RSErrorCode.expectedLogic, from: 0, to: 2, params: ['ℬ(X1)'] }],
@@ -298,7 +298,12 @@ export class TypeAuditor {
298
298
  return true;
299
299
  }
300
300
 
301
- private childTypeDebool(node: AstNode, index: number, errorCode: RSErrorCode): Typification | null {
301
+ private childTypeDebool(
302
+ node: AstNode,
303
+ index: number,
304
+ errorCode: RSErrorCode,
305
+ operation?: string
306
+ ): Typification | null {
302
307
  const result = this.childTypification(node, index);
303
308
  if (result === null) {
304
309
  return null;
@@ -307,7 +312,30 @@ export class TypeAuditor {
307
312
  return result;
308
313
  }
309
314
  if (result.typeID !== TypeID.collection) {
310
- this.onError(errorCode, node.children[index], [labelType(result)]);
315
+ const params =
316
+ errorCode === RSErrorCode.invalidTypeOperation && operation !== undefined
317
+ ? [operation, labelType(result)]
318
+ : [labelType(result)];
319
+ this.onError(errorCode, node.children[index], params);
320
+ return null;
321
+ }
322
+ return debool(result);
323
+ }
324
+
325
+ private childQuantifierDomain(node: AstNode, index: number, operator: string): Typification | null {
326
+ const result = this.visitChild(node, index);
327
+ if (result === null) {
328
+ return null;
329
+ }
330
+ if (!isTypification(result)) {
331
+ this.onError(RSErrorCode.invalidQuantifierDomain, node.children[index], [operator, labelType(result)]);
332
+ return null;
333
+ }
334
+ if (result.typeID === TypeID.anyTypification) {
335
+ return result;
336
+ }
337
+ if (result.typeID !== TypeID.collection) {
338
+ this.onError(RSErrorCode.invalidQuantifierDomain, node.children[index], [operator, labelType(result)]);
311
339
  return null;
312
340
  }
313
341
  return debool(result);
@@ -415,7 +443,7 @@ export class TypeAuditor {
415
443
  if (variable.typeID === TokenID.NT_TUPLE_DECL) {
416
444
  return this.onError(RSErrorCode.invalidArgumentCortegeDeclare, variable);
417
445
  }
418
- const domain = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation);
446
+ const domain = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation, labelToken(TokenID.ITERATE));
419
447
  if (domain === null) {
420
448
  return null;
421
449
  }
@@ -433,12 +461,13 @@ export class TypeAuditor {
433
461
  }
434
462
 
435
463
  private visitArithmetic(node: AstNode): ExpressionType | null {
464
+ const operator = labelRSLangNode(node);
436
465
  const type1 = this.childTypification(node, 0);
437
466
  if (type1 === null) {
438
467
  return null;
439
468
  }
440
469
  if (!('isArithmetic' in type1 && type1.isArithmetic)) {
441
- return this.onError(RSErrorCode.arithmeticNotSupported, node.children[0], [labelType(type1)]);
470
+ return this.onError(RSErrorCode.arithmeticNotSupported, node.children[0], [labelType(type1), operator]);
442
471
  }
443
472
 
444
473
  const type2 = this.childTypification(node, 1);
@@ -446,12 +475,12 @@ export class TypeAuditor {
446
475
  return null;
447
476
  }
448
477
  if (!('isArithmetic' in type2 && type2.isArithmetic)) {
449
- return this.onError(RSErrorCode.arithmeticNotSupported, node.children[1], [labelType(type2)]);
478
+ return this.onError(RSErrorCode.arithmeticNotSupported, node.children[1], [labelType(type2), operator]);
450
479
  }
451
480
 
452
481
  const result = mergeTypifications(type1, type2);
453
482
  if (result === null) {
454
- return this.onError(RSErrorCode.typesNotCompatible, node, [labelType(type1), labelType(type2)]);
483
+ return this.onError(RSErrorCode.typesNotCompatible, node, [labelType(type1), labelType(type2), operator]);
455
484
  }
456
485
  return result;
457
486
  }
@@ -475,7 +504,7 @@ export class TypeAuditor {
475
504
  }
476
505
 
477
506
  if (!checkCompatibility(type1, type2)) {
478
- return this.onError(RSErrorCode.typesNotCompatible, node, [labelType(type1), labelType(type2)]);
507
+ return this.onError(RSErrorCode.typesNotCompatible, node, [labelType(type1), labelType(type2), operator]);
479
508
  }
480
509
  return LogicT;
481
510
  }
@@ -483,7 +512,8 @@ export class TypeAuditor {
483
512
  private visitQuantifier(node: AstNode): ExpressionType | null {
484
513
  this.locals.startScope();
485
514
 
486
- const domain = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation);
515
+ const operator = labelRSLangNode(node);
516
+ const domain = this.childQuantifierDomain(node, 1, operator);
487
517
  if (domain === null) {
488
518
  return null;
489
519
  } else if (!this.visitChildDeclaration(node, 0, domain)) {
@@ -511,6 +541,7 @@ export class TypeAuditor {
511
541
  }
512
542
 
513
543
  private visitEquals(node: AstNode): ExpressionType | null {
544
+ const operator = labelRSLangNode(node);
514
545
  const type1 = this.childTypification(node, 0);
515
546
  if (type1 === null) {
516
547
  return null;
@@ -521,13 +552,14 @@ export class TypeAuditor {
521
552
  return null;
522
553
  }
523
554
  if (!checkCompatibility(type1, type2)) {
524
- return this.onError(RSErrorCode.typesNotCompatible, node, [labelType(type1), labelType(type2)]);
555
+ return this.onError(RSErrorCode.typesNotCompatible, node, [labelType(type1), labelType(type2), operator]);
525
556
  }
526
557
  return LogicT;
527
558
  }
528
559
 
529
560
  private visitSetexprPredicate(node: AstNode): ExpressionType | null {
530
- let type2 = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation);
561
+ const operator = labelRSLangNode(node);
562
+ let type2 = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation, operator);
531
563
  if (type2 === null) {
532
564
  return null;
533
565
  }
@@ -542,11 +574,11 @@ export class TypeAuditor {
542
574
 
543
575
  if (!checkCompatibility(type1, type2)) {
544
576
  if (isSubset) {
545
- return this.onError(RSErrorCode.typesNotEqual, node, [labelType(type1), labelType(type2)]);
577
+ return this.onError(RSErrorCode.typesNotEqual, node, [labelType(type1), labelType(type2), operator]);
546
578
  } else {
547
579
  return this.onError(RSErrorCode.invalidElementPredicate, node, [
548
580
  labelType(type1),
549
- labelToken(node.typeID as TokenID),
581
+ operator,
550
582
  labelType(bool(type2))
551
583
  ]);
552
584
  }
@@ -619,19 +651,20 @@ export class TypeAuditor {
619
651
  }
620
652
 
621
653
  private visitSetexprBinary(node: AstNode): ExpressionType | null {
622
- const type1 = this.childTypeDebool(node, 0, RSErrorCode.invalidTypeOperation);
654
+ const operator = labelRSLangNode(node);
655
+ const type1 = this.childTypeDebool(node, 0, RSErrorCode.invalidTypeOperation, operator);
623
656
  if (type1 === null) {
624
657
  return null;
625
658
  }
626
659
 
627
- const type2 = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation);
660
+ const type2 = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation, operator);
628
661
  if (type2 === null) {
629
662
  return null;
630
663
  }
631
664
 
632
665
  const result = mergeTypifications(type1, type2);
633
666
  if (result === null) {
634
- return this.onError(RSErrorCode.typesNotEqual, node, [labelType(bool(type1)), labelType(bool(type2))]);
667
+ return this.onError(RSErrorCode.typesNotEqual, node, [labelType(bool(type1)), labelType(bool(type2)), operator]);
635
668
  }
636
669
  return bool(result);
637
670
  }
@@ -707,6 +740,7 @@ export class TypeAuditor {
707
740
  }
708
741
 
709
742
  private visitFilter(node: AstNode): ExpressionType | null {
743
+ const operator = labelRSLangNode(node);
710
744
  const indices = getNodeIndices(node);
711
745
  const tupleParam = indices.length === node.children.length - 1;
712
746
  if (!tupleParam && node.children.length > 2) {
@@ -752,7 +786,8 @@ export class TypeAuditor {
752
786
  if (param.typeID !== TypeID.collection || !checkCompatibility(bases[child], debool(param))) {
753
787
  return this.onError(RSErrorCode.typesNotEqual, node.children[child], [
754
788
  labelType(param),
755
- labelType(bool(bases[child]))
789
+ labelType(bool(bases[child])),
790
+ operator
756
791
  ]);
757
792
  }
758
793
  }
@@ -764,7 +799,11 @@ export class TypeAuditor {
764
799
  const paramType = param;
765
800
  const expected = bool(tuple(bases));
766
801
  if (paramType.typeID !== TypeID.collection || !checkCompatibility(expected, paramType)) {
767
- return this.onError(RSErrorCode.typesNotEqual, node.children[0], [labelType(paramType), labelType(expected)]);
802
+ return this.onError(RSErrorCode.typesNotEqual, node.children[0], [
803
+ labelType(paramType),
804
+ labelType(expected),
805
+ operator
806
+ ]);
768
807
  }
769
808
  }
770
809
  return argument;
@@ -794,7 +833,12 @@ export class TypeAuditor {
794
833
  private visitDeclarative(node: AstNode): ExpressionType | null {
795
834
  this.locals.startScope();
796
835
 
797
- const domain = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation);
836
+ const domain = this.childTypeDebool(
837
+ node,
838
+ 1,
839
+ RSErrorCode.invalidTypeOperation,
840
+ labelToken(TokenID.NT_DECLARATIVE_EXPR)
841
+ );
798
842
  if (domain === null) {
799
843
  return null;
800
844
  } else if (!this.visitChildDeclaration(node, 0, domain)) {
@@ -826,7 +870,7 @@ export class TypeAuditor {
826
870
  }
827
871
 
828
872
  private visitIterate(node: AstNode): ExpressionType | null {
829
- const domain = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation);
873
+ const domain = this.childTypeDebool(node, 1, RSErrorCode.invalidTypeOperation, labelToken(TokenID.ITERATE));
830
874
  if (domain === null) {
831
875
  return null;
832
876
  }
@@ -868,7 +912,8 @@ export class TypeAuditor {
868
912
  if (!checkCompatibility(iterationValue, initType)) {
869
913
  return this.onError(RSErrorCode.typesNotEqual, node.children[iterationIndex], [
870
914
  labelType(iterationValue),
871
- labelType(initType)
915
+ labelType(initType),
916
+ labelToken(node.typeID as TokenID)
872
917
  ]);
873
918
  }
874
919