tla-ts 0.0.3-dev.3ff2308 → 0.0.3-dev.40085a4
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 +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +2 -2
- package/dist/parallel.cjs +1 -1
- package/dist/parallel.js +2 -2
- package/dist/run-cli.cjs +13 -13
- package/dist/run-cli.js +22 -22
- package/dist/transfer.cjs +27 -18
- package/dist/transfer.js +27 -18
- package/package.json +1 -1
- package/src/ast.ts +28 -4
- package/src/check.ts +5 -2
- package/src/environment.ts +290 -102
- package/src/errors.ts +25 -3
- package/src/fingerprints.ts +2 -1
- package/src/instances.ts +1 -1
- package/src/levels.ts +143 -30
- package/src/parser.ts +154 -46
- package/src/resolve.ts +1331 -451
- package/src/run-cli.ts +5 -2
- package/src/sany-lexer.ts +615 -0
- package/src/sany-parse-error.ts +3143 -0
- package/src/standard-modules.ts +2 -2
- package/src/standard-ranges.ts +116 -0
- package/src/subexpressions.ts +221 -161
- package/src/substitution-levels.ts +38 -17
- package/src/values.ts +35 -8
package/package.json
CHANGED
package/src/ast.ts
CHANGED
|
@@ -33,9 +33,12 @@ export interface StringExpression {
|
|
|
33
33
|
location: SourceLocation;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// selectorRanges holds the range of each part of a name such as foo!lab, where SANY reports an
|
|
37
|
+
// error in selecting that part.
|
|
36
38
|
export interface IdentifierExpression {
|
|
37
39
|
kind: "Identifier";
|
|
38
40
|
name: string;
|
|
41
|
+
selectorRanges?: SourceRange[];
|
|
39
42
|
location: SourceLocation;
|
|
40
43
|
resolution?: LocalResolution;
|
|
41
44
|
}
|
|
@@ -49,6 +52,9 @@ export interface ApplyExpression {
|
|
|
49
52
|
argumentCounts?: number[];
|
|
50
53
|
// The range of the parenthesized arguments of a named operator, where SANY reports their count.
|
|
51
54
|
argumentsRange?: SourceRange;
|
|
55
|
+
selectorRanges?: SourceRange[];
|
|
56
|
+
// The range of the arguments of each part of a name like F(x)!l(y), for a part that takes some.
|
|
57
|
+
argumentRanges?: (SourceRange | undefined)[];
|
|
52
58
|
location: SourceLocation;
|
|
53
59
|
resolution?: LocalResolution;
|
|
54
60
|
}
|
|
@@ -62,6 +68,7 @@ export interface OperatorReferenceExpression {
|
|
|
62
68
|
export interface LambdaExpression {
|
|
63
69
|
kind: "Lambda";
|
|
64
70
|
params: string[];
|
|
71
|
+
paramRanges?: SourceRange[];
|
|
65
72
|
body: Expression;
|
|
66
73
|
location: SourceLocation;
|
|
67
74
|
}
|
|
@@ -119,7 +126,10 @@ export interface LetExpression {
|
|
|
119
126
|
location: SourceLocation;
|
|
120
127
|
}
|
|
121
128
|
|
|
122
|
-
|
|
129
|
+
// ranges holds the range of each name the pattern binds.
|
|
130
|
+
export type BoundPattern =
|
|
131
|
+
| { kind: "Name"; name: string; ranges?: SourceRange[] }
|
|
132
|
+
| { kind: "Tuple"; names: string[]; ranges?: SourceRange[] };
|
|
123
133
|
|
|
124
134
|
export interface Bound {
|
|
125
135
|
pattern: BoundPattern;
|
|
@@ -137,6 +147,7 @@ export interface UnboundedQuantifierExpression {
|
|
|
137
147
|
kind: "UnboundedQuantifier";
|
|
138
148
|
quantifier: "Forall" | "Exists";
|
|
139
149
|
names: string[];
|
|
150
|
+
nameRanges?: SourceRange[];
|
|
140
151
|
isTemporal?: boolean;
|
|
141
152
|
body: Expression;
|
|
142
153
|
location: SourceLocation;
|
|
@@ -269,6 +280,7 @@ export interface LabelExpression {
|
|
|
269
280
|
kind: "Label";
|
|
270
281
|
name: string;
|
|
271
282
|
params: string[];
|
|
283
|
+
paramRanges?: SourceRange[];
|
|
272
284
|
body: Expression;
|
|
273
285
|
location: SourceLocation;
|
|
274
286
|
}
|
|
@@ -283,6 +295,8 @@ export type Selector =
|
|
|
283
295
|
export interface SubexpressionExpression {
|
|
284
296
|
kind: "Subexpression";
|
|
285
297
|
selectors: Selector[];
|
|
298
|
+
selectorRanges?: SourceRange[];
|
|
299
|
+
argumentRanges?: (SourceRange | undefined)[];
|
|
286
300
|
location: SourceLocation;
|
|
287
301
|
}
|
|
288
302
|
|
|
@@ -366,6 +380,7 @@ export interface Assumption {
|
|
|
366
380
|
|
|
367
381
|
export interface InstanceSubstitution {
|
|
368
382
|
name: string;
|
|
383
|
+
nameRange: SourceRange;
|
|
369
384
|
expression: Expression;
|
|
370
385
|
}
|
|
371
386
|
|
|
@@ -387,6 +402,7 @@ export interface NewSymbol {
|
|
|
387
402
|
arity: number;
|
|
388
403
|
level: "Constant" | "Variable" | "State" | "Action" | "Temporal";
|
|
389
404
|
set: Expression | undefined;
|
|
405
|
+
nameRange?: SourceRange;
|
|
390
406
|
location: SourceLocation;
|
|
391
407
|
}
|
|
392
408
|
|
|
@@ -438,19 +454,27 @@ export type StepBody =
|
|
|
438
454
|
| Instance
|
|
439
455
|
| DefineStep
|
|
440
456
|
| { kind: "Have"; expression: Expression }
|
|
441
|
-
| { kind: "Take"; names: string[]; bounds: Bound[] }
|
|
457
|
+
| { kind: "Take"; names: string[]; nameRanges?: SourceRange[]; bounds: Bound[] }
|
|
442
458
|
| { kind: "Witness"; expressions: Expression[] }
|
|
443
|
-
| {
|
|
459
|
+
| {
|
|
460
|
+
kind: "Pick";
|
|
461
|
+
names: string[];
|
|
462
|
+
nameRanges?: SourceRange[];
|
|
463
|
+
bounds: Bound[];
|
|
464
|
+
body: Expression;
|
|
465
|
+
}
|
|
444
466
|
| { kind: "Case"; expression: Expression }
|
|
445
467
|
| { kind: "Assert"; isSuffices: boolean; statement: Expression | AssumeProve }
|
|
446
468
|
| { kind: "Qed" };
|
|
447
469
|
|
|
448
|
-
// head is the range of the step number and its statement, without the proof
|
|
470
|
+
// head is the range of the step number and its statement, without the proof, and statement is the
|
|
471
|
+
// range of the statement alone.
|
|
449
472
|
export interface ProofStep {
|
|
450
473
|
name: string | undefined;
|
|
451
474
|
token: string;
|
|
452
475
|
body: StepBody;
|
|
453
476
|
head: SourceRange;
|
|
477
|
+
statement: SourceRange;
|
|
454
478
|
proof: Proof | undefined;
|
|
455
479
|
location: SourceLocation;
|
|
456
480
|
}
|
package/src/check.ts
CHANGED
|
@@ -72,6 +72,7 @@ import { createCounterExample } from "./tlc-ext";
|
|
|
72
72
|
import { getFingerprintTrace, valueSources } from "./value-sources";
|
|
73
73
|
import { getFingerprintDistance, OUT_DEGREE_BUCKETS } from "./tlc-summary";
|
|
74
74
|
import {
|
|
75
|
+
assertFingerprintable,
|
|
75
76
|
combineHash,
|
|
76
77
|
createModelValue,
|
|
77
78
|
formatState,
|
|
@@ -1130,12 +1131,13 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1130
1131
|
failure: { ...result.failure, replay: { output: replayed, ...replayedStack, isBeforeError } },
|
|
1131
1132
|
};
|
|
1132
1133
|
};
|
|
1133
|
-
// TLC fingerprints a state outside CallStackTool, so a failure
|
|
1134
|
+
// TLC fingerprints a state outside CallStackTool, so a failure of a value with a source leaves
|
|
1135
|
+
// the stack empty. Any other failure keeps the stack of the initial predicate.
|
|
1134
1136
|
const fingerprintReplayed = (state: Value[], traced: Environment) => {
|
|
1135
1137
|
try {
|
|
1136
1138
|
getStateHash(getFingerprintState(state));
|
|
1137
1139
|
} catch (error) {
|
|
1138
|
-
if (traced.trace) traced.trace.length = 0;
|
|
1140
|
+
if (traced.trace && getFingerprintTrace(error)) traced.trace.length = 0;
|
|
1139
1141
|
throw error;
|
|
1140
1142
|
}
|
|
1141
1143
|
};
|
|
@@ -1388,6 +1390,7 @@ const searchStates = (options: CheckOptions, stateWriter: StateWriter | undefine
|
|
|
1388
1390
|
let hash = 0x811c9dc5;
|
|
1389
1391
|
for (let index = 0; index < state.length; index++)
|
|
1390
1392
|
hash = combineHash(hash, getValueHash(state[index]));
|
|
1393
|
+
assertFingerprintable(state);
|
|
1391
1394
|
return hash & 0x3fffffff;
|
|
1392
1395
|
};
|
|
1393
1396
|
const isSameState = (stored: Value[], state: Value[]) => {
|