tla-ts 0.0.3-dev.2032e26 → 0.0.3-dev.30014f9
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/transfer.cjs +14 -18
- package/dist/transfer.js +14 -18
- package/package.json +1 -1
- package/src/check.ts +3 -8
- package/src/errors.ts +0 -5
- package/src/evaluate.ts +1 -3
- package/src/successors.ts +2 -5
package/package.json
CHANGED
package/src/check.ts
CHANGED
|
@@ -2,13 +2,7 @@ import type { Assumption, Definition, Expression, SourceLocation } from "./ast";
|
|
|
2
2
|
import { parseConfig, type ConfigValue, type ModelConfig } from "./config";
|
|
3
3
|
import { getReadVariables } from "./dependencies";
|
|
4
4
|
import { createEnvironment } from "./environment";
|
|
5
|
-
import {
|
|
6
|
-
getErrorExitCode,
|
|
7
|
-
TlaConfigError,
|
|
8
|
-
TlaEvaluationError,
|
|
9
|
-
TlaModuleError,
|
|
10
|
-
UNEXPECTED_EXCEPTION,
|
|
11
|
-
} from "./errors";
|
|
5
|
+
import { getErrorExitCode, TlaConfigError, TlaEvaluationError, TlaModuleError } from "./errors";
|
|
12
6
|
import { EXIT_STATUS, setExitCode, setNextStatePhase, withLivenessExitCode } from "./exit-codes";
|
|
13
7
|
import {
|
|
14
8
|
describeRange,
|
|
@@ -834,7 +828,8 @@ export const createSearch = (
|
|
|
834
828
|
holdsLikeTlc(
|
|
835
829
|
constraint.expression,
|
|
836
830
|
getContext(environment, state, next),
|
|
837
|
-
(expression) =>
|
|
831
|
+
(expression) =>
|
|
832
|
+
`TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a java.lang.RuntimeException\n: ${getExpectedBoolean(expression, environment)}`,
|
|
838
833
|
),
|
|
839
834
|
),
|
|
840
835
|
trackStatePossible:
|
package/src/errors.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { EXIT_STATUS, getExitCode, setModuleExitCode } from "./exit-codes";
|
|
2
2
|
|
|
3
|
-
// How TLC reports a RuntimeException it did not expect, such as one raised while computing next
|
|
4
|
-
// states.
|
|
5
|
-
export const UNEXPECTED_EXCEPTION =
|
|
6
|
-
"TLC threw an unexpected exception.\nThis was probably caused by an error in the spec or model.\nSee the User Output or TLC Console for clues to what happened.\nThe exception was a java.lang.RuntimeException\n: ";
|
|
7
|
-
|
|
8
3
|
export class TlaError extends Error {
|
|
9
4
|
constructor(message: string, cause?: unknown) {
|
|
10
5
|
super(message, { cause });
|
package/src/evaluate.ts
CHANGED
|
@@ -1757,9 +1757,7 @@ const compile = (expression: Expression, environment: Environment): Evaluator =>
|
|
|
1757
1757
|
if (expectBoolean(arm.condition(context), "a CASE guard")) return arm.body(context);
|
|
1758
1758
|
}
|
|
1759
1759
|
if (other) return other(context);
|
|
1760
|
-
throw new TlaEvaluationError(
|
|
1761
|
-
`Attempted to evaluate a CASE with no conditions true.\n${describeRange(expression)}`,
|
|
1762
|
-
);
|
|
1760
|
+
throw new TlaEvaluationError(`No CASE guard is true at ${describeLocation(expression)}`);
|
|
1763
1761
|
};
|
|
1764
1762
|
}
|
|
1765
1763
|
case "Let": {
|
package/src/successors.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Bound, Definition, Expression } from "./ast";
|
|
2
2
|
import { getReadVariables } from "./dependencies";
|
|
3
|
-
import { TlaEvaluationError
|
|
3
|
+
import { TlaEvaluationError } from "./errors";
|
|
4
4
|
import { EXIT_STATUS, setExitCode } from "./exit-codes";
|
|
5
5
|
import {
|
|
6
6
|
describeLocation,
|
|
7
|
-
describeRange,
|
|
8
7
|
bindArgument,
|
|
9
8
|
bindDefinitions,
|
|
10
9
|
bindOperatorArguments,
|
|
@@ -805,9 +804,7 @@ const compileAction = (
|
|
|
805
804
|
);
|
|
806
805
|
const body = arm?.body ?? other;
|
|
807
806
|
if (!body)
|
|
808
|
-
throw new TlaEvaluationError(
|
|
809
|
-
`${UNEXPECTED_EXCEPTION}In computing next states, TLC encountered a CASE with no conditions true.\n${describeRange(expression)}`,
|
|
810
|
-
);
|
|
807
|
+
throw new TlaEvaluationError(`No CASE guard is true at ${describeLocation(expression)}`);
|
|
811
808
|
body(run, scope, partial, action, isFixed, onComplete);
|
|
812
809
|
};
|
|
813
810
|
}
|