tla-ts 0.0.3-dev.30014f9 → 0.0.3-dev.3c70a97
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.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/run-cli.cjs +3 -2
- package/dist/run-cli.js +3 -2
- package/dist/transfer.cjs +18 -14
- package/dist/transfer.js +18 -14
- package/package.json +1 -1
- package/src/ast.ts +90 -0
- package/src/check.ts +89 -36
- package/src/codegen.ts +9 -19
- package/src/dependencies.ts +2 -2
- package/src/environment.ts +10 -10
- package/src/errors.ts +9 -2
- package/src/evaluate.ts +75 -135
- package/src/exit-codes.ts +21 -43
- package/src/instances.ts +12 -11
- package/src/levels.ts +8 -8
- package/src/live-check.ts +710 -0
- package/src/liveness.ts +5 -523
- package/src/resolve.ts +16 -15
- package/src/run-cli.ts +9 -2
- package/src/runtime.ts +1 -1
- package/src/spec-description.ts +7 -2
- package/src/subexpressions.ts +10 -10
- package/src/successors.ts +17 -9
- package/src/tlc-ext.ts +2 -10
package/src/subexpressions.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import {
|
|
2
|
+
getChildren,
|
|
3
|
+
type Bound,
|
|
4
|
+
type Definition,
|
|
5
|
+
type Expression,
|
|
6
|
+
type Instance,
|
|
7
|
+
type Module,
|
|
8
|
+
type OperatorParam,
|
|
9
|
+
type Selector,
|
|
10
|
+
type SourceLocation,
|
|
10
11
|
} from "./ast";
|
|
11
12
|
import { TlaSyntaxError } from "./errors";
|
|
12
|
-
import { getChildren } from "./evaluate";
|
|
13
13
|
import { getSourceName, mapChildren, mapDefinition } from "./instances";
|
|
14
14
|
import { getArity, getBoundNames, getPatternNames, LOCAL_RESOLUTION } from "./resolve";
|
|
15
15
|
|
package/src/successors.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
getChildren,
|
|
3
|
+
isLocallyResolved,
|
|
4
|
+
type Bound,
|
|
5
|
+
type Definition,
|
|
6
|
+
type Expression,
|
|
7
|
+
} from "./ast";
|
|
2
8
|
import { getReadVariables } from "./dependencies";
|
|
3
|
-
import { TlaEvaluationError } from "./errors";
|
|
9
|
+
import { TlaEvaluationError, UNEXPECTED_EXCEPTION } from "./errors";
|
|
4
10
|
import { EXIT_STATUS, setExitCode } from "./exit-codes";
|
|
5
11
|
import {
|
|
6
12
|
describeLocation,
|
|
13
|
+
describeRange,
|
|
7
14
|
bindArgument,
|
|
8
15
|
bindDefinitions,
|
|
9
16
|
bindOperatorArguments,
|
|
@@ -13,14 +20,12 @@ import {
|
|
|
13
20
|
expectBoolean,
|
|
14
21
|
forEachBinding,
|
|
15
22
|
getBoundsDomain,
|
|
16
|
-
getChildren,
|
|
17
23
|
getDefinition,
|
|
18
24
|
getEnumeratedElements,
|
|
19
25
|
getReevaluatedDefinitions,
|
|
20
26
|
lookupScope,
|
|
21
27
|
resolveApplyOperator,
|
|
22
28
|
resolveGlobalOperator,
|
|
23
|
-
isLocallyResolved,
|
|
24
29
|
type Context,
|
|
25
30
|
type Environment,
|
|
26
31
|
type Scope,
|
|
@@ -804,7 +809,9 @@ const compileAction = (
|
|
|
804
809
|
);
|
|
805
810
|
const body = arm?.body ?? other;
|
|
806
811
|
if (!body)
|
|
807
|
-
throw new TlaEvaluationError(
|
|
812
|
+
throw new TlaEvaluationError(
|
|
813
|
+
`${UNEXPECTED_EXCEPTION}In computing next states, TLC encountered a CASE with no conditions true.\n${describeRange(expression)}`,
|
|
814
|
+
);
|
|
808
815
|
body(run, scope, partial, action, isFixed, onComplete);
|
|
809
816
|
};
|
|
810
817
|
}
|
|
@@ -913,18 +920,19 @@ export const isEnabled = (expression: Expression, context: Context): boolean =>
|
|
|
913
920
|
);
|
|
914
921
|
}
|
|
915
922
|
const environment = context.environment;
|
|
916
|
-
const
|
|
923
|
+
const run: Run = { environment, isInit: false, current: state, isStopped: false };
|
|
924
|
+
// TLC stops computing ENABLED at the first successor, so it skips the rest of the action.
|
|
917
925
|
getRunner(expression, environment, false)(
|
|
918
|
-
|
|
926
|
+
run,
|
|
919
927
|
context.scope,
|
|
920
928
|
getEmptyState(environment),
|
|
921
929
|
undefined,
|
|
922
930
|
false,
|
|
923
931
|
() => {
|
|
924
|
-
|
|
932
|
+
run.isStopped = true;
|
|
925
933
|
},
|
|
926
934
|
);
|
|
927
|
-
return
|
|
935
|
+
return run.isStopped;
|
|
928
936
|
};
|
|
929
937
|
|
|
930
938
|
export const forEachInitialState = (
|
package/src/tlc-ext.ts
CHANGED
|
@@ -10,16 +10,8 @@ import {
|
|
|
10
10
|
} from "./builtins";
|
|
11
11
|
import { TlaEvaluationError, TlaModuleError, TlaUnsupportedError } from "./errors";
|
|
12
12
|
import { getTlcFingerprint } from "./tlc-random";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
expectBoolean,
|
|
16
|
-
getChildren,
|
|
17
|
-
getDefinition,
|
|
18
|
-
isLocallyResolved,
|
|
19
|
-
type Builtin,
|
|
20
|
-
type Environment,
|
|
21
|
-
} from "./evaluate";
|
|
22
|
-
import type { Definition, Expression } from "./ast";
|
|
13
|
+
import { evaluate, expectBoolean, getDefinition, type Builtin, type Environment } from "./evaluate";
|
|
14
|
+
import { getChildren, isLocallyResolved, type Definition, type Expression } from "./ast";
|
|
23
15
|
import type { TraceStep } from "./check";
|
|
24
16
|
import {
|
|
25
17
|
getNamedRegisters,
|