tla-ts 0.0.3-dev.a85c0bd → 0.0.3-dev.ab9c809

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/src/levels.ts CHANGED
@@ -5,11 +5,19 @@ import {
5
5
  type Expression,
6
6
  type Module,
7
7
  type OperatorParam,
8
+ type Proof,
9
+ type ProofStep,
8
10
  type SourceLocation,
9
11
  } from "./ast";
10
- import { TlaSyntaxError } from "./errors";
12
+ import {
13
+ createSanyError,
14
+ createSemanticError,
15
+ formatRange,
16
+ TlaSyntaxError,
17
+ type SanyError,
18
+ } from "./errors";
11
19
  import { mapChildren } from "./instances";
12
- import { getBoundNames, getPatternNames } from "./resolve";
20
+ import { collectSemanticErrors, getBoundNames, getPatternNames } from "./resolve";
13
21
  import { STANDARD_LEVELS } from "./standard-levels";
14
22
 
15
23
  interface LevelData {
@@ -34,6 +42,7 @@ interface LevelContext {
34
42
  constants: Set<string>;
35
43
  variables: Set<string>;
36
44
  getDefinition: (name: string) => Definition | undefined;
45
+ getQualifiedName?: (name: string) => string | undefined;
37
46
  }
38
47
 
39
48
  type ScopeEntry =
@@ -176,8 +185,13 @@ export const ACTION_LEVEL = 2;
176
185
 
177
186
  export const TEMPORAL_LEVEL = 3;
178
187
 
179
- const createLevelError = (message: string, location: SourceLocation) =>
180
- new TlaSyntaxError(`${message} at line ${location.line}, column ${location.column}`);
188
+ // SANY reports a level error at the range of the expression it rejects.
189
+ const createLevelError = (message: string, expression: Expression) =>
190
+ expression.location.range
191
+ ? createSemanticError(`${message}.`, expression.location.range)
192
+ : new TlaSyntaxError(
193
+ `${message} at line ${expression.location.line}, column ${expression.location.column}`,
194
+ );
181
195
 
182
196
  const LOGICAL_OPERATORS = new Set(["/\\", "\\/", "=>", "<=>"]);
183
197
 
@@ -201,7 +215,13 @@ export const createLevelAnalyzer = (context: LevelContext) => {
201
215
  if (context.variables.has(name)) return { kind: "Declared", name, level: 1, arity: 0 };
202
216
  const definition = context.getDefinition(name);
203
217
  if (definition) {
204
- return { kind: "Defined", levels: analyzeDefinition(definition, new Map()) };
218
+ const levels = analyzeDefinition(definition, new Map());
219
+ // SANY names a definition of an instance by its qualified name, as in I!Foo.
220
+ const qualifiedName = context.getQualifiedName?.(name);
221
+ return {
222
+ kind: "Defined",
223
+ levels: qualifiedName ? { ...levels, name: qualifiedName } : levels,
224
+ };
205
225
  }
206
226
  const signature = CORE_SIGNATURES.get(name) ?? STANDARD_LEVELS.get(name);
207
227
  if (signature) return { kind: "Defined", levels: signature };
@@ -237,13 +257,13 @@ export const createLevelAnalyzer = (context: LevelContext) => {
237
257
  if (operand.operator || operand.declared) return;
238
258
  if (operand.data.level > getMaxLevel(operator, index)) {
239
259
  throw new TlaSyntaxError(
240
- `Level error in applying operator ${operator.name}: The level of argument ${index + 1} exceeds the maximum level allowed by the operator.`,
260
+ `Level error in applying operator ${operator.name}:\nThe level of argument ${index + 1} exceeds the maximum level allowed by the operator`,
241
261
  );
242
262
  }
243
263
  });
244
264
  if (ranges.some((range) => range.level > ACTION_LEVEL)) {
245
265
  throw new TlaSyntaxError(
246
- `Level error in applying operator ${operator.name}: The level of the range for a bounded variable exceeds the maximum level allowed by the operator.`,
266
+ `Level error in applying operator ${operator.name}:\nThe level of the range for a bounded variable exceeds the maximum level allowed by the operator`,
247
267
  );
248
268
  }
249
269
  const getOperand = (formal: string) => {
@@ -444,10 +464,13 @@ export const createLevelAnalyzer = (context: LevelContext) => {
444
464
  ? applyDeclared(resolved.name, resolved.level, operands)
445
465
  : applyDefined(resolved.levels, operands);
446
466
 
447
- const checkJunction = (operands: Operand[], location: SourceLocation) => {
467
+ const checkJunction = (operands: Operand[], expression: Expression) => {
448
468
  const levels = operands.map((operand) => operand.data.level);
449
469
  if (levels.includes(ACTION_LEVEL) && levels.includes(TEMPORAL_LEVEL)) {
450
- throw createLevelError("Formula has both temporal formula and action as arguments", location);
470
+ throw createLevelError(
471
+ "Formula has both temporal formula and action as arguments",
472
+ expression,
473
+ );
451
474
  }
452
475
  };
453
476
 
@@ -456,10 +479,10 @@ export const createLevelAnalyzer = (context: LevelContext) => {
456
479
  if (isLeadsTo && operands.some((operand) => operand.data.level === ACTION_LEVEL)) {
457
480
  throw createLevelError(
458
481
  "Action used where only temporal formula or state predicate allowed",
459
- expression.location,
482
+ expression,
460
483
  );
461
484
  }
462
- if (LOGICAL_OPERATORS.has(expression.operator)) checkJunction(operands, expression.location);
485
+ if (LOGICAL_OPERATORS.has(expression.operator)) checkJunction(operands, expression);
463
486
  };
464
487
 
465
488
  const checkTemporal = (
@@ -473,7 +496,7 @@ export const createLevelAnalyzer = (context: LevelContext) => {
473
496
  expression.kind === "Always"
474
497
  ? "[] followed by action not of form [A]_v"
475
498
  : "<> followed by action not of form <<A>>_v",
476
- expression.location,
499
+ expression,
477
500
  );
478
501
  };
479
502
 
@@ -501,7 +524,17 @@ export const createLevelAnalyzer = (context: LevelContext) => {
501
524
  return data;
502
525
  };
503
526
 
527
+ // SANY reports a level error of an operator's arguments at the application.
504
528
  const analyze = (expression: Expression, scope: Scope): LevelData => {
529
+ try {
530
+ return analyzeNode(expression, scope);
531
+ } catch (error) {
532
+ if (!(error instanceof TlaSyntaxError) || error.sany) throw error;
533
+ throw createLevelError(error.message, expression);
534
+ }
535
+ };
536
+
537
+ const analyzeNode = (expression: Expression, scope: Scope): LevelData => {
505
538
  switch (expression.kind) {
506
539
  case "Number":
507
540
  case "Decimal":
@@ -521,7 +554,7 @@ export const createLevelAnalyzer = (context: LevelContext) => {
521
554
  case "And":
522
555
  case "Or": {
523
556
  const operands = toOperands(expression.operands, scope);
524
- checkJunction(operands, expression.location);
557
+ checkJunction(operands, expression);
525
558
  return applyDefined(JUNCTION_LEVELS, operands);
526
559
  }
527
560
  case "Prime":
@@ -561,13 +594,14 @@ export const createLevelAnalyzer = (context: LevelContext) => {
561
594
  expression.bounds.map((bound) => bound.set),
562
595
  getBoundNames(expression.bounds),
563
596
  );
564
- if (
565
- data.level === TEMPORAL_LEVEL &&
566
- expression.bounds.some((bound) => analyze(bound.set, scope).level === ACTION_LEVEL)
567
- ) {
597
+ const actionBound =
598
+ data.level === TEMPORAL_LEVEL
599
+ ? expression.bounds.find((bound) => analyze(bound.set, scope).level === ACTION_LEVEL)
600
+ : undefined;
601
+ if (actionBound) {
568
602
  throw createLevelError(
569
603
  "Action-level bound of quantified temporal formula",
570
- expression.location,
604
+ actionBound.set,
571
605
  );
572
606
  }
573
607
  return data;
@@ -817,34 +851,136 @@ export const createLevelAnalyzer = (context: LevelContext) => {
817
851
  return { analyze, analyzeDefinition, toOperand };
818
852
  };
819
853
 
820
- const analyzeAssumeProve = (
854
+ export const analyzeAssumeProve = (
821
855
  assumeProve: AssumeProve,
822
856
  scope: Scope,
823
857
  analyzer: ReturnType<typeof createLevelAnalyzer>,
824
- ) => {
858
+ ): LevelData => {
825
859
  const inner = new Map(scope);
826
- assumeProve.assumptions.forEach((assumption) => {
860
+ const parts = assumeProve.assumptions.flatMap((assumption) => {
827
861
  if (assumption.kind === "NewSymbol") {
828
- if (assumption.set) analyzer.analyze(assumption.set, inner);
862
+ const set = assumption.set && analyzer.analyze(assumption.set, inner);
829
863
  inner.set(assumption.name, { kind: "Formal", arity: assumption.arity });
830
- return;
864
+ return set ? [set] : [];
831
865
  }
832
- if (assumption.kind === "AssumeProve") analyzeAssumeProve(assumption, inner, analyzer);
833
- else analyzer.analyze(assumption, inner);
866
+ return [
867
+ assumption.kind === "AssumeProve"
868
+ ? analyzeAssumeProve(assumption, inner, analyzer)
869
+ : analyzer.analyze(assumption, inner),
870
+ ];
834
871
  });
835
- analyzer.analyze(assumeProve.conclusion, inner);
872
+ parts.push(analyzer.analyze(assumeProve.conclusion, inner));
873
+ const data = createData(Math.max(...parts.map((part) => part.level)));
874
+ parts.forEach((part) => {
875
+ part.params.forEach((param) => data.params.add(param));
876
+ part.constraints.forEach((value, key) => putConstraint(data.constraints, key, value));
877
+ part.argConstraints.forEach((value, key) => putArgConstraint(data.argConstraints, key, value));
878
+ part.argParams.forEach((key) => data.argParams.add(key));
879
+ });
880
+ return data;
836
881
  };
837
882
 
838
- // SANY checks the level of every definition, assumption, and theorem of a module.
839
- export const checkModuleLevels = (module: Module, context: LevelContext) => {
883
+ // SANY checks the level of every definition, assumption, theorem, and instance of a module.
884
+ export const checkModuleLevels = (
885
+ module: Module,
886
+ context: LevelContext,
887
+ instances: { location: SourceLocation; check: () => void }[],
888
+ ) => {
840
889
  const analyzer = createLevelAnalyzer(context);
841
- module.definitions
842
- .filter((definition) => !definition.name.includes("!"))
843
- .forEach((definition) => analyzer.analyzeDefinition(definition, new Map()));
844
- module.assumptions.forEach((assumption) => analyzer.analyze(assumption.expression, new Map()));
845
- module.theorems.forEach((theorem) =>
846
- theorem.statement.kind === "AssumeProve"
847
- ? analyzeAssumeProve(theorem.statement, new Map(), analyzer)
848
- : analyzer.analyze(theorem.statement, new Map()),
849
- );
890
+ const getLevel = (expressions: Expression[]) =>
891
+ Math.max(0, ...expressions.map((expression) => analyzer.analyze(expression, new Map()).level));
892
+ const getStepLevel = (step: ProofStep) => {
893
+ const body = step.body;
894
+ if (body.kind === "Have" || body.kind === "Case") return getLevel([body.expression]);
895
+ if (body.kind === "Witness") return getLevel(body.expressions);
896
+ if (body.kind === "Take") return getLevel(body.bounds.map((bound) => bound.set));
897
+ if (body.kind === "Pick") {
898
+ return getLevel([body.body, ...body.bounds.map((bound) => bound.set)]);
899
+ }
900
+ if (body.kind !== "Assert") return 0;
901
+ return body.statement.kind === "AssumeProve"
902
+ ? analyzeAssumeProve(body.statement, new Map(), analyzer).level
903
+ : getLevel([body.statement]);
904
+ };
905
+ // SANY's TheoremNode.LevelCheckTemporal: the proof of a temporal goal may only assume constants.
906
+ const checkTemporalGoal = (proof: Proof | undefined): SanyError[] =>
907
+ proof?.kind !== "Steps"
908
+ ? []
909
+ : proof.steps.flatMap((step) => {
910
+ const location = formatRange(step.statement);
911
+ const isConstant = () => getStepLevel(step) === 0;
912
+ if (
913
+ step.body.kind === "Have" ||
914
+ step.body.kind === "Take" ||
915
+ step.body.kind === "Witness"
916
+ ) {
917
+ return isConstant()
918
+ ? []
919
+ : [{ location, message: "Non-constant TAKE, WITNESS, or HAVE for temporal goal." }];
920
+ }
921
+ if (step.body.kind === "Case") {
922
+ return [
923
+ ...(isConstant()
924
+ ? []
925
+ : [{ location, message: "Non-constant CASE for temporal goal." }]),
926
+ ...checkTemporalGoal(step.proof),
927
+ ];
928
+ }
929
+ return step.body.kind === "Qed" ? checkTemporalGoal(step.proof) : [];
930
+ });
931
+ // SANY checks each step as a theorem of its own after the steps of its proof.
932
+ const checkProof = (proof: Proof | undefined): SanyError[] =>
933
+ proof?.kind !== "Steps"
934
+ ? []
935
+ : proof.steps.flatMap((step) => {
936
+ const body = step.body;
937
+ const isTemporal = () => getStepLevel(step) === TEMPORAL_LEVEL;
938
+ const pickErrors =
939
+ body.kind === "Pick" && body.bounds.length > 0 && isTemporal()
940
+ ? body.bounds
941
+ .filter((bound) => getLevel([bound.set]) !== 0)
942
+ .flatMap((bound) =>
943
+ bound.set.location.range
944
+ ? [
945
+ {
946
+ location: formatRange(bound.set.location.range),
947
+ message: "Non-constant bound of temporal PICK.",
948
+ },
949
+ ]
950
+ : [],
951
+ )
952
+ : [];
953
+ return [
954
+ ...checkProof(step.proof),
955
+ ...pickErrors,
956
+ ...(step.proof?.kind === "Steps" && isTemporal() ? checkTemporalGoal(step.proof) : []),
957
+ ];
958
+ });
959
+ collectSemanticErrors([
960
+ ...module.definitions
961
+ .filter((definition) => !definition.name.includes("!"))
962
+ .map((definition) => ({
963
+ location: definition.location,
964
+ check: () => analyzer.analyzeDefinition(definition, new Map()),
965
+ })),
966
+ ...module.assumptions.map((assumption) => ({
967
+ location: assumption.location,
968
+ check: () => analyzer.analyze(assumption.expression, new Map()),
969
+ })),
970
+ ...module.theorems.map((theorem) => ({
971
+ location: theorem.location,
972
+ check: () => {
973
+ const data =
974
+ theorem.statement.kind === "AssumeProve"
975
+ ? analyzeAssumeProve(theorem.statement, new Map(), analyzer)
976
+ : analyzer.analyze(theorem.statement, new Map());
977
+ const errors = [
978
+ ...checkProof(theorem.proof),
979
+ ...(data.level === TEMPORAL_LEVEL ? checkTemporalGoal(theorem.proof) : []),
980
+ ];
981
+ if (errors.length > 0) throw createSanyError(errors);
982
+ },
983
+ })),
984
+ ...instances,
985
+ ]);
850
986
  };
package/src/liveness.ts CHANGED
@@ -210,12 +210,16 @@ export const expandTemporal = (
210
210
  if (expanding.has(definition)) {
211
211
  throw setExitCode(new TlaEvaluationError(STACK_OVERFLOW), EXIT_STATUS.error);
212
212
  }
213
- return expand(
213
+ const expanded = expand(
214
214
  definition.body,
215
215
  undefined,
216
216
  expression.name,
217
217
  new Set([...expanding, definition]),
218
218
  );
219
+ // TLC takes the body of a state-level definition in a specification as one initial predicate.
220
+ return !isProperty && getDefinitionLevel(definition, environment) < ACTION_LEVEL
221
+ ? [{ expression: definition.body, scope: undefined, name: expression.name }]
222
+ : expanded;
219
223
  }
220
224
  }
221
225
  const context = getConstantContext(environment, scope);
package/src/parser.ts CHANGED
@@ -22,7 +22,7 @@ import type {
22
22
  StepBody,
23
23
  UseOrHide,
24
24
  } from "./ast";
25
- import { TlaSyntaxError } from "./errors";
25
+ import { createSanyError, formatRange, TlaSyntaxError } from "./errors";
26
26
  import { getNumeralValue, tokenize, type Token } from "./lexer";
27
27
 
28
28
  interface InfixOperator {
@@ -628,14 +628,24 @@ const parse = (source: string, isTlapm: boolean): Module => {
628
628
  const body = parseExpression();
629
629
  return withRange({ kind: "Lambda", params, body, location: getLocation(token) }, start);
630
630
  }
631
- return parseExpression();
631
+ const argument = parseExpression();
632
+ // SANY reads an argument that only names an operator of a parameterized instance, such as
633
+ // I!Op, as that operator, which takes the arguments of the instance too.
634
+ if (argument.kind === "Identifier") missingArguments.delete(argument);
635
+ return argument;
632
636
  };
633
637
 
638
+ const missingArguments = new Map<Expression, { location: string; message: string }>();
639
+
640
+ const lastArguments: { range: SourceRange | undefined } = { range: undefined };
641
+
634
642
  const parseArguments = () =>
635
643
  withoutOffside(() => {
644
+ const start = cursor.index;
636
645
  expect("(");
637
646
  const args = parseSeparated(parseArgument);
638
647
  expect(")");
648
+ lastArguments.range = getRange(start);
639
649
  return args;
640
650
  });
641
651
 
@@ -662,9 +672,12 @@ const parse = (source: string, isTlapm: boolean): Module => {
662
672
  if (peek().kind === "Identifier" && (isAt("|->", 1) || isAt(":", 1))) {
663
673
  const kind = isAt("|->", 1) ? "Record" : "RecordSet";
664
674
  const fields = parseSeparated(() => {
675
+ const fieldStart = cursor.index;
676
+ const fieldLocation = getLocation(peek());
665
677
  const name = expectIdentifier();
678
+ fieldLocation.range = getRange(fieldStart);
666
679
  expect(kind === "Record" ? "|->" : ":");
667
- return { name, value: parseExpression() };
680
+ return { name, value: parseExpression(), location: fieldLocation };
668
681
  });
669
682
  expect("]");
670
683
  return { kind, fields, location };
@@ -823,7 +836,8 @@ const parse = (source: string, isTlapm: boolean): Module => {
823
836
  };
824
837
 
825
838
  const parsePrimary = (): Expression => {
826
- const isFactStart = cursor.index === factStart.index;
839
+ const start = cursor.index;
840
+ const isFactStart = start === factStart.index;
827
841
  const token = advance();
828
842
  const location = getLocation(token);
829
843
  if (isTlapm && token.kind === "Keyword" && token.text === "LAMBDA") {
@@ -856,13 +870,18 @@ const parse = (source: string, isTlapm: boolean): Module => {
856
870
  const args = hasArguments ? parseArguments() : [];
857
871
  if (!isSelectorAhead()) {
858
872
  return hasArguments
859
- ? { kind: "Apply", operator: name, args, location }
873
+ ? { kind: "Apply", operator: name, args, argumentsRange: lastArguments.range, location }
860
874
  : { kind: "Identifier", name, location };
861
875
  }
862
876
  const instance = openModules
863
877
  .flatMap((module) => module.instances)
864
878
  .find((candidate) => candidate.name === name);
865
- if (instance && !isFactStart && !isTlapm && instance.params.length !== args.length) {
879
+ const isMissingArguments =
880
+ instance !== undefined &&
881
+ !isFactStart &&
882
+ !isTlapm &&
883
+ instance.params.length !== args.length;
884
+ if (isMissingArguments && args.length > 0) {
866
885
  throw createError(
867
886
  `The operator ${name} requires ${instance.params.length} arguments`,
868
887
  token,
@@ -876,18 +895,36 @@ const parse = (source: string, isTlapm: boolean): Module => {
876
895
  const names = selectors.flatMap((selector) =>
877
896
  selector.kind === "Name" ? [selector.name] : [],
878
897
  );
879
- if (names.length < selectors.length) return { kind: "Subexpression", selectors, location };
880
898
  const operator = names.join("!");
881
899
  const qualifiedArgs = selectors.flatMap((selector) =>
882
900
  "args" in selector ? selector.args : [],
883
901
  );
884
- if (qualifiedArgs.length === 0) return { kind: "Identifier", name: operator, location };
885
902
  const argumentCounts = selectors.map((selector) =>
886
903
  "args" in selector ? selector.args.length : 0,
887
904
  );
888
- return argumentCounts.slice(0, -1).some((count) => count > 0)
889
- ? { kind: "Apply", operator, args: qualifiedArgs, argumentCounts, location }
890
- : { kind: "Apply", operator, args: qualifiedArgs, location };
905
+ const argumentsRange = lastArguments.range;
906
+ const reference: Expression =
907
+ names.length < selectors.length
908
+ ? { kind: "Subexpression", selectors, location }
909
+ : qualifiedArgs.length === 0
910
+ ? { kind: "Identifier", name: operator, location }
911
+ : argumentCounts.slice(0, -1).some((count) => count > 0)
912
+ ? {
913
+ kind: "Apply",
914
+ operator,
915
+ args: qualifiedArgs,
916
+ argumentCounts,
917
+ argumentsRange,
918
+ location,
919
+ }
920
+ : { kind: "Apply", operator, args: qualifiedArgs, argumentsRange, location };
921
+ if (isMissingArguments) {
922
+ missingArguments.set(reference, {
923
+ location: formatRange(getRange(start)),
924
+ message: `The operator ${name} requires ${instance.params.length} arguments.`,
925
+ });
926
+ }
927
+ return reference;
891
928
  }
892
929
  if (token.kind === "Operator" && isOperatorName(token.text) && isAt("("))
893
930
  return { kind: "Apply", operator: token.text, args: parseArguments(), location };
@@ -1423,11 +1460,14 @@ const parse = (source: string, isTlapm: boolean): Module => {
1423
1460
  location: getLocation(keyword),
1424
1461
  };
1425
1462
  const invalid =
1426
- use.kind === "Hide" && !isTlapm ? use.facts.find((fact) => !isHideFact(fact)) : undefined;
1427
- if (invalid) {
1428
- throw createError(
1429
- "The only expression allowed as a fact in a HIDE is the name of a theorem, assumption, or step",
1430
- invalid.location,
1463
+ use.kind === "Hide" && !isTlapm ? use.facts.filter((fact) => !isHideFact(fact)) : [];
1464
+ if (invalid.length > 0) {
1465
+ throw createSanyError(
1466
+ invalid.map((fact) => ({
1467
+ location: formatRange(fact.location.range ?? getRange(start)),
1468
+ message:
1469
+ "The only expression allowed as a fact in a HIDE is \nthe name of a theorem, assumption, or step.",
1470
+ })),
1431
1471
  );
1432
1472
  }
1433
1473
  return withRange(use, start);
@@ -1563,10 +1603,12 @@ const parse = (source: string, isTlapm: boolean): Module => {
1563
1603
  const parseStep = (): ProofStep => {
1564
1604
  const start = cursor.index;
1565
1605
  const step = parseStepStart(isAt("QED", 1));
1606
+ const statementStart = cursor.index;
1566
1607
  const scope = new Set<string>();
1567
1608
  proofScopes.push(scope);
1568
1609
  const body: StepBody = accept("QED") ? { kind: "Qed" } : parseStepBody();
1569
1610
  const head = getRange(start);
1611
+ const statement = getRange(statementStart);
1570
1612
  const hasProof = isProofStart(peek());
1571
1613
  if (hasProof && !PROVABLE_STEPS.has(body.kind)) {
1572
1614
  throw createError("Proof of a step that does not take a proof");
@@ -1574,7 +1616,7 @@ const parse = (source: string, isTlapm: boolean): Module => {
1574
1616
  const proof = hasProof ? parseProof() : undefined;
1575
1617
  proofScopes.pop();
1576
1618
  if (body.kind !== "Assert" || body.isSuffices) scope.forEach(declareProofSymbol);
1577
- return withRange({ ...step, body, head, proof }, start);
1619
+ return withRange({ ...step, body, head, statement, proof }, start);
1578
1620
  };
1579
1621
 
1580
1622
  const parseProofBody = (): Proof => {
@@ -1705,6 +1747,7 @@ const parse = (source: string, isTlapm: boolean): Module => {
1705
1747
  end: { line: token.line, column: token.endColumn },
1706
1748
  };
1707
1749
  }
1750
+ if (missingArguments.size > 0) throw createSanyError([...missingArguments.values()]);
1708
1751
  openModules.pop();
1709
1752
  recursiveScopes.pop();
1710
1753
  return module;