tla-ts 0.0.8-dev.d9bffda → 0.0.9-dev.0dd11f695
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/README.md +30 -0
- package/dist/compile.cjs +23 -0
- package/dist/compile.js +23 -0
- package/dist/deciders.cjs +15 -15
- package/dist/deciders.js +40 -40
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +80 -10
- package/dist/index.d.ts +80 -10
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove-worker.cjs +1 -1
- package/dist/prove-worker.js +1 -1
- package/dist/prove.cjs +116 -36
- package/dist/prove.js +116 -36
- package/dist/run.cjs +143 -31
- package/dist/run.js +143 -31
- package/dist/tlapm.cjs +2 -2
- package/dist/tlapm.js +1 -1
- package/dist/transfer.cjs +128 -103
- package/dist/transfer.js +128 -103
- package/dist/worker.cjs +7 -7
- package/dist/worker.js +7 -7
- package/package.json +3 -1
- package/src/ast.ts +7 -21
- package/src/bags.ts +99 -99
- package/src/builtins.ts +44 -75
- package/src/bundled-modules.ts +1 -8
- package/src/check.ts +605 -311
- package/src/cli/options.ts +12 -3
- package/src/cli/run.ts +2 -2
- package/src/cli/runtime-invariants.ts +135 -0
- package/src/cli/shared.ts +20 -9
- package/src/cli/tlc-arguments.ts +646 -0
- package/src/cli/tlc-usage.ts +362 -0
- package/src/cli/tlc.ts +571 -185
- package/src/cli/typescript.ts +26 -0
- package/src/cli/xml-exporter.ts +4 -10
- package/src/codegen.ts +190 -46
- package/src/config.ts +101 -68
- package/src/coverage.ts +855 -0
- package/src/dependencies.ts +20 -28
- package/src/dfid.ts +636 -0
- package/src/environment.ts +266 -98
- package/src/errors.ts +142 -45
- package/src/evaluate.ts +632 -298
- package/src/exit-codes.ts +37 -1
- package/src/index.ts +3 -0
- package/src/instances.ts +85 -9
- package/src/java-overrides.ts +2 -12
- package/src/json-reader.ts +456 -0
- package/src/json.ts +262 -139
- package/src/levels.ts +2 -3
- package/src/lexer.ts +17 -26
- package/src/liveness-checker.ts +10 -18
- package/src/liveness.ts +121 -49
- package/src/parallel-worker.ts +14 -10
- package/src/parallel.ts +41 -17
- package/src/parser.ts +436 -90
- package/src/pcal/ast.ts +7 -28
- package/src/pcal/parse.ts +11 -39
- package/src/pcal/tokenize.ts +4 -20
- package/src/pcal/translate.ts +10 -42
- package/src/pcal/validate.ts +3 -21
- package/src/pretty-print.ts +1 -2
- package/src/prover/smt/solver/solver.ts +31 -27
- package/src/randomization.ts +84 -35
- package/src/resolve.ts +18 -60
- package/src/runtime.ts +11 -4
- package/src/sany/builtins.ts +3 -4
- package/src/sany/generator.ts +128 -176
- package/src/sany/levels.ts +6 -30
- package/src/sany/lexer.ts +7 -23
- package/src/sany/linter.ts +31 -29
- package/src/sany/modules.ts +1 -5
- package/src/sany/nodes.ts +4 -28
- package/src/sany/parse-error.ts +44 -100
- package/src/sany/report.ts +25 -40
- package/src/sany/selectors.ts +8 -22
- package/src/sany/source.ts +8 -15
- package/src/sany/xml.ts +11 -42
- package/src/search.ts +547 -144
- package/src/simulate.ts +694 -0
- package/src/spec-description.ts +166 -48
- package/src/standard-definitions.ts +2 -3
- package/src/standard-modules.ts +264 -68
- package/src/state-graph.ts +51 -18
- package/src/subexpressions.ts +31 -5
- package/src/successors.ts +267 -77
- package/src/symmetry.ts +31 -8
- package/src/tableau.ts +1 -2
- package/src/tlc/fingerprint.ts +183 -61
- package/src/tlc/jar-data.ts +113 -6
- package/src/tlc/messages.ts +122 -37
- package/src/tlc/order.ts +33 -38
- package/src/tlc/random.ts +16 -16
- package/src/tlc/replay.ts +563 -211
- package/src/tlc/summary.ts +2 -4
- package/src/tlc/tlc-operators.ts +81 -36
- package/src/tlc/tlcext-operators.ts +138 -117
- package/src/tlc/trace-spec.ts +273 -0
- package/src/tlc/value-stream.ts +143 -0
- package/src/tlc/version.ts +2 -4
- package/src/typescript/actions.ts +494 -0
- package/src/typescript/collections.ts +615 -0
- package/src/typescript/compile.ts +70 -0
- package/src/typescript/context.ts +106 -0
- package/src/typescript/emit.ts +122 -0
- package/src/typescript/expressions.ts +508 -0
- package/src/typescript/formula.ts +160 -0
- package/src/typescript/functions.ts +295 -0
- package/src/typescript/model.ts +164 -0
- package/src/typescript/names.ts +116 -0
- package/src/typescript/program.ts +51 -0
- package/src/typescript/properties.ts +148 -0
- package/src/typescript/scope.ts +117 -0
- package/src/typescript/steps.ts +175 -0
- package/src/typescript/types.ts +178 -0
- package/src/values.ts +832 -255
package/src/errors.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
+
import type ts from "@typescript/typescript6";
|
|
1
2
|
import type { SourceRange } from "./ast";
|
|
3
|
+
import type { Locus } from "./obligations/expression";
|
|
2
4
|
import { EXIT_STATUS, getExitCode, setExitCode } from "./exit-codes";
|
|
3
5
|
import type { PcalNode } from "./pcal/ast";
|
|
4
6
|
import type { Value } from "./values";
|
|
5
7
|
|
|
6
|
-
// The start of TLC's message for an exception of a Java class it didn't expect.
|
|
7
8
|
export const getUnexpectedException = (exceptionClass: string) =>
|
|
8
9
|
`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 ${exceptionClass}\n: `;
|
|
9
10
|
|
|
10
|
-
// How TLC reports a RuntimeException it did not expect, such as one raised while computing next
|
|
11
|
-
// states.
|
|
12
11
|
export const UNEXPECTED_EXCEPTION = getUnexpectedException("java.lang.RuntimeException");
|
|
13
12
|
|
|
14
13
|
export const UNEXPECTED_EVAL_EXCEPTION = getUnexpectedException("tlc2.tool.EvalException");
|
|
15
14
|
|
|
16
15
|
// V8's RangeError for a stack overflow, which TLC raises as a Java StackOverflowError.
|
|
16
|
+
// V8 reports a regular expression that runs out of stack as a syntax error.
|
|
17
17
|
export const isStackOverflow = (error: unknown) =>
|
|
18
|
-
error instanceof RangeError && error.message === "Maximum call stack size exceeded"
|
|
18
|
+
(error instanceof RangeError && error.message === "Maximum call stack size exceeded") ||
|
|
19
|
+
(error instanceof SyntaxError && error.message.endsWith(": Stack overflow"));
|
|
19
20
|
|
|
20
21
|
export class TlaError extends Error {
|
|
21
22
|
constructor(message: string, cause?: unknown) {
|
|
@@ -29,17 +30,14 @@ export interface SyntaxFailure {
|
|
|
29
30
|
line: number;
|
|
30
31
|
column: number;
|
|
31
32
|
isEnd: boolean;
|
|
33
|
+
proof?: { stop: { line: number; column: number }; exception: string };
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
// An error SANY reports at a location, such as "In module M" or a range in a module.
|
|
35
36
|
export interface SanyError {
|
|
36
37
|
location: string;
|
|
37
38
|
message: string;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
// The errors SANY reports for a spec, and the warnings it prints before them. A fatal error stops it
|
|
41
|
-
// before semantic analysis. SANY's parser prints its message for a module it rejects before the
|
|
42
|
-
// report.
|
|
43
41
|
interface SanyReport {
|
|
44
42
|
errors: SanyError[];
|
|
45
43
|
warnings: SanyError[];
|
|
@@ -59,10 +57,7 @@ export class TlaSyntaxError extends TlaError {
|
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
//
|
|
63
|
-
// doesn't match its module's, or a circular dependency. SANY reports it in the module that imports
|
|
64
|
-
// or holds the failed one, or without a location, after its JavaCC parser's report of a module it
|
|
65
|
-
// failed to parse. It keeps the name TlaSyntaxError, and index.ts doesn't export it.
|
|
60
|
+
// It keeps the name TlaSyntaxError, and index.ts doesn't export it.
|
|
66
61
|
export class TlaSanyFatalError extends TlaSyntaxError {
|
|
67
62
|
location: string | undefined;
|
|
68
63
|
parseError: string | undefined;
|
|
@@ -74,8 +69,7 @@ export class TlaSanyFatalError extends TlaSyntaxError {
|
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
//
|
|
78
|
-
// TLC 1.7.4's SANY, which gives it no location.
|
|
72
|
+
// TLC 1.7.4's SANY gives a missing module no location.
|
|
79
73
|
export class TlaMissingModuleError extends TlaSanyFatalError {
|
|
80
74
|
constructor(name: string, importer: string | undefined, isLocated = true) {
|
|
81
75
|
super(
|
|
@@ -109,7 +103,6 @@ export const createMissingModuleError = (name: string, importer: string | undefi
|
|
|
109
103
|
true,
|
|
110
104
|
);
|
|
111
105
|
|
|
112
|
-
// How SANY prints the warnings it reports, which do not stop TLC.
|
|
113
106
|
export const formatSanyWarnings = (warnings: SanyError[]) =>
|
|
114
107
|
`*** Warnings: ${warnings.length}\n\n${warnings.map((warning) => `${warning.location}\n\n${warning.message}\n\n\n`).join("\n")}`;
|
|
115
108
|
|
|
@@ -136,7 +129,7 @@ export class TlaEvaluationError extends TlaError {
|
|
|
136
129
|
export const STACK_OVERFLOW_MESSAGE =
|
|
137
130
|
"This was a Java StackOverflowError. It was probably the result\nof an incorrect recursive function definition that caused TLC to enter\nan infinite loop when trying to compute the function or its application\nto an element in its putative domain.";
|
|
138
131
|
|
|
139
|
-
//
|
|
132
|
+
// TLC catches a StackOverflowError only at the top, unlike the exceptions of evaluation.
|
|
140
133
|
export class TlaStackOverflowError extends TlaEvaluationError {
|
|
141
134
|
constructor() {
|
|
142
135
|
super(STACK_OVERFLOW_MESSAGE);
|
|
@@ -147,8 +140,15 @@ export class TlaStackOverflowError extends TlaEvaluationError {
|
|
|
147
140
|
export const createStackOverflowError = () =>
|
|
148
141
|
setExitCode(new TlaStackOverflowError(), EXIT_STATUS.error);
|
|
149
142
|
|
|
150
|
-
//
|
|
151
|
-
|
|
143
|
+
// TLC's plain message that reads like a coded one, as the initial states' for a built-in operator.
|
|
144
|
+
export class TlaUncodedError extends TlaEvaluationError {
|
|
145
|
+
constructor(message: string) {
|
|
146
|
+
super(message);
|
|
147
|
+
this.name = "TlaEvaluationError";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// TLC reports the partial state, with null for each unassigned variable.
|
|
152
152
|
export class TlaIncompleteSuccessorError extends TlaEvaluationError {
|
|
153
153
|
state: (Value | undefined)[];
|
|
154
154
|
action: string | undefined;
|
|
@@ -167,8 +167,7 @@ export class TlaIncompleteSuccessorError extends TlaEvaluationError {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
//
|
|
171
|
-
// TlaEvaluationError, and index.ts doesn't export it.
|
|
170
|
+
// It keeps the name TlaEvaluationError, and index.ts doesn't export it.
|
|
172
171
|
export class TlaUnassignedError extends TlaEvaluationError {
|
|
173
172
|
variable: string;
|
|
174
173
|
|
|
@@ -178,8 +177,8 @@ export class TlaUnassignedError extends TlaEvaluationError {
|
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
179
|
|
|
181
|
-
// An
|
|
182
|
-
//
|
|
180
|
+
// An EvalException from a standard module's Java code. It keeps the name TlaEvaluationError, and
|
|
181
|
+
// index.ts doesn't export it.
|
|
183
182
|
export class TlaModuleError extends TlaEvaluationError {
|
|
184
183
|
exitCode: number;
|
|
185
184
|
|
|
@@ -190,7 +189,77 @@ export class TlaModuleError extends TlaEvaluationError {
|
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
191
|
|
|
193
|
-
// TLC reports an
|
|
192
|
+
// TLC reports an Assert.fail of TLC_FEATURE_UNSUPPORTED as it is, even as it starts.
|
|
193
|
+
export class TlaFeatureUnsupportedError extends TlaEvaluationError {
|
|
194
|
+
constructor(message: string) {
|
|
195
|
+
super(message);
|
|
196
|
+
this.name = "TlaEvaluationError";
|
|
197
|
+
setExitCode(this, EXIT_STATUS.error);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// TLC's PickSuccessor fails to read an answer past the end of standard input with a Java exception.
|
|
202
|
+
export class TlaEndOfInputError extends TlaUncodedError {
|
|
203
|
+
constructor() {
|
|
204
|
+
super(
|
|
205
|
+
"PickSuccessor reached the end of standard input without an answer whether to extend the behavior.",
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// TLC reads a checkpoint that isn't there with a Java exception.
|
|
211
|
+
export class TlaMissingCheckpointError extends TlaEvaluationError {
|
|
212
|
+
constructor(directory: string) {
|
|
213
|
+
super(`The directory ${directory} holds no checkpoint to recover from.`);
|
|
214
|
+
this.name = "TlaEvaluationError";
|
|
215
|
+
setExitCode(this, EXIT_STATUS.error);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// An ALIAS's _format that can't print the trace, where TLC leaks a Java exception.
|
|
220
|
+
export class TlaAliasFormatError extends TlaEvaluationError {
|
|
221
|
+
constructor(message: string) {
|
|
222
|
+
super(message);
|
|
223
|
+
this.name = "TlaEvaluationError";
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// TLC's WrongInvocationException, which its CallStackTool records no call stack for.
|
|
228
|
+
export class TlaSetBoundError extends TlaEvaluationError {
|
|
229
|
+
constructor(message: string) {
|
|
230
|
+
super(message);
|
|
231
|
+
this.name = "TlaEvaluationError";
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export const TOO_MANY_STATES_MESSAGE =
|
|
236
|
+
"Too many possible next states for the last state in the trace.";
|
|
237
|
+
|
|
238
|
+
// TLC's StateVec fails to grow past -maxSetSize.
|
|
239
|
+
export class TlaTooManyStatesError extends TlaEvaluationError {
|
|
240
|
+
constructor() {
|
|
241
|
+
super(TOO_MANY_STATES_MESSAGE);
|
|
242
|
+
this.name = "TlaEvaluationError";
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export class TlaWarningAsError extends TlaEvaluationError {
|
|
247
|
+
code: number;
|
|
248
|
+
|
|
249
|
+
constructor(code: number, message: string) {
|
|
250
|
+
super(message);
|
|
251
|
+
this.name = "TlaEvaluationError";
|
|
252
|
+
this.code = code;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export class TlaNullPointerError extends TlaEvaluationError {
|
|
257
|
+
constructor(message: string) {
|
|
258
|
+
super(message);
|
|
259
|
+
this.name = "TlaEvaluationError";
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
194
263
|
export class TlaIllegalStateError extends TlaEvaluationError {
|
|
195
264
|
state: (Value | undefined)[];
|
|
196
265
|
|
|
@@ -204,21 +273,24 @@ export class TlaIllegalStateError extends TlaEvaluationError {
|
|
|
204
273
|
interface TlapmReport {
|
|
205
274
|
failure?: string;
|
|
206
275
|
exception?: string;
|
|
276
|
+
locus?: Locus;
|
|
207
277
|
}
|
|
208
278
|
|
|
209
279
|
export class TlaProofError extends TlaError {
|
|
210
280
|
failure: string | undefined;
|
|
211
281
|
exception: string;
|
|
282
|
+
locus: Locus | undefined;
|
|
212
283
|
|
|
213
284
|
constructor(message: string, report: TlapmReport = {}) {
|
|
214
285
|
super(message);
|
|
286
|
+
this.locus = report.locus;
|
|
215
287
|
this.name = "TlaProofError";
|
|
216
288
|
this.failure = report.exception === undefined ? (report.failure ?? message) : undefined;
|
|
217
289
|
this.exception = report.exception ?? `Failure(${JSON.stringify(this.failure)})`;
|
|
218
290
|
}
|
|
219
291
|
}
|
|
220
292
|
|
|
221
|
-
// tlapm
|
|
293
|
+
// tlapm reports a failed assertion of its own as a bug in itself. It keeps the name
|
|
222
294
|
// TlaProofError, and index.ts doesn't export it.
|
|
223
295
|
export class TlapmBugError extends TlaProofError {
|
|
224
296
|
constructor(exception = "Assert_failure") {
|
|
@@ -235,6 +307,18 @@ export class TlaProverError extends TlaError {
|
|
|
235
307
|
}
|
|
236
308
|
}
|
|
237
309
|
|
|
310
|
+
// tlapm reports a rejected method pragma where the pragma or the proof citing it is, and leaves
|
|
311
|
+
// the obligation unproved.
|
|
312
|
+
export class TlaMethodError extends TlaProverError {
|
|
313
|
+
readonly locus: Locus | undefined;
|
|
314
|
+
|
|
315
|
+
constructor(message: string, locus: Locus | undefined) {
|
|
316
|
+
super(message);
|
|
317
|
+
this.name = "TlaMethodError";
|
|
318
|
+
this.locus = locus;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
238
322
|
// Zenon gives up on a .znn file the way the OCaml Zenon raises an exception and prints no proof.
|
|
239
323
|
export class TlaZenonError extends TlaError {
|
|
240
324
|
constructor(message: string, cause?: unknown) {
|
|
@@ -247,8 +331,9 @@ export class TlaZenonError extends TlaError {
|
|
|
247
331
|
// for an ill-formed term, type or theorem, and Interrupt when the time limit runs out.
|
|
248
332
|
type IsabelleException = "ERROR" | "TERM" | "TYPE" | "THM" | "Interrupt";
|
|
249
333
|
|
|
250
|
-
// Isabelle's tactics raise and handle these as control flow, often millions of times per proof,
|
|
251
|
-
// decideIsabelle answers "unknown" for any that escape. So unlike an Error, it skips the
|
|
334
|
+
// Isabelle's tactics raise and handle these as control flow, often millions of times per proof,
|
|
335
|
+
// and decideIsabelle answers "unknown" for any that escape. So unlike an Error, it skips the
|
|
336
|
+
// stack trace.
|
|
252
337
|
export class TlaIsabelleError {
|
|
253
338
|
readonly name = "TlaIsabelleError";
|
|
254
339
|
readonly exception: IsabelleException;
|
|
@@ -267,8 +352,8 @@ export class TlaUnsupportedError extends TlaError {
|
|
|
267
352
|
}
|
|
268
353
|
}
|
|
269
354
|
|
|
270
|
-
//
|
|
271
|
-
//
|
|
355
|
+
// Input outside the SMT-LIB subset tlapm emits, or a numeral too large for exact arithmetic. The
|
|
356
|
+
// solver answers unknown.
|
|
272
357
|
export class SmtUnsupportedError extends TlaError {
|
|
273
358
|
constructor(message: string, cause?: unknown) {
|
|
274
359
|
super(message, cause);
|
|
@@ -276,8 +361,7 @@ export class SmtUnsupportedError extends TlaError {
|
|
|
276
361
|
}
|
|
277
362
|
}
|
|
278
363
|
|
|
279
|
-
// The
|
|
280
|
-
// solver answers unknown.
|
|
364
|
+
// The time limit or the abort signal hit in the middle of a rewrite. The solver answers unknown.
|
|
281
365
|
export class SmtCanceledError extends TlaError {
|
|
282
366
|
constructor() {
|
|
283
367
|
super("the SMT solver was canceled");
|
|
@@ -285,8 +369,16 @@ export class SmtCanceledError extends TlaError {
|
|
|
285
369
|
}
|
|
286
370
|
}
|
|
287
371
|
|
|
288
|
-
//
|
|
289
|
-
//
|
|
372
|
+
// A tactic failed. or-else tries the next tactic, and apply prints the message. index.ts doesn't
|
|
373
|
+
// export it.
|
|
374
|
+
export class SmtTacticError extends TlaError {
|
|
375
|
+
constructor(message: string) {
|
|
376
|
+
super(message);
|
|
377
|
+
this.name = "SmtTacticError";
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// A bug in the port rather than in the input. It keeps its name, and index.ts doesn't export it.
|
|
290
382
|
export class SmtInvariantError extends TlaError {
|
|
291
383
|
constructor(message: string) {
|
|
292
384
|
super(message);
|
|
@@ -294,8 +386,8 @@ export class SmtInvariantError extends TlaError {
|
|
|
294
386
|
}
|
|
295
387
|
}
|
|
296
388
|
|
|
297
|
-
//
|
|
298
|
-
//
|
|
389
|
+
// A case Z3 leaves unimplemented, where Z3 exits the process. nra answers unknown instead.
|
|
390
|
+
// index.ts doesn't export it.
|
|
299
391
|
export class NlsatUnsupportedError extends TlaError {
|
|
300
392
|
constructor(reason: string) {
|
|
301
393
|
super(`nlsat does not implement ${reason}`);
|
|
@@ -303,8 +395,7 @@ export class NlsatUnsupportedError extends TlaError {
|
|
|
303
395
|
}
|
|
304
396
|
}
|
|
305
397
|
|
|
306
|
-
//
|
|
307
|
-
// and gives up on the round. index.ts doesn't export it.
|
|
398
|
+
// Grobner catches it and gives up on the round. index.ts doesn't export it.
|
|
308
399
|
export class PddMemoryOutError extends TlaError {
|
|
309
400
|
constructor() {
|
|
310
401
|
super("the pdd manager ran out of nodes");
|
|
@@ -312,7 +403,6 @@ export class PddMemoryOutError extends TlaError {
|
|
|
312
403
|
}
|
|
313
404
|
}
|
|
314
405
|
|
|
315
|
-
// The SMT-LIB input is malformed: a syntax error, an undeclared symbol, or an ill-sorted application.
|
|
316
406
|
export class SmtParseError extends TlaError {
|
|
317
407
|
constructor(message: string, cause?: unknown) {
|
|
318
408
|
super(message, cause);
|
|
@@ -320,8 +410,6 @@ export class SmtParseError extends TlaError {
|
|
|
320
410
|
}
|
|
321
411
|
}
|
|
322
412
|
|
|
323
|
-
// An exception that TLC's Java code throws and nothing catches, with the stack trace it prints, after
|
|
324
|
-
// what the frames that the exception unwinds print about it.
|
|
325
413
|
export class TlaJavaException extends TlaUnsupportedError {
|
|
326
414
|
unwound: string;
|
|
327
415
|
|
|
@@ -342,8 +430,6 @@ export const getErrorExitCode = (error: TlaError) =>
|
|
|
342
430
|
? EXIT_STATUS.specEvaluationFailure
|
|
343
431
|
: EXIT_STATUS.error);
|
|
344
432
|
|
|
345
|
-
// pcal.UnrecoverableException and its subclasses: an error the PlusCal translator reports as
|
|
346
|
-
// "Unrecoverable error". UnrecoverablePositionedException adds the statement the error is at.
|
|
347
433
|
export class PcalError extends TlaError {
|
|
348
434
|
node: PcalNode | undefined;
|
|
349
435
|
|
|
@@ -354,8 +440,6 @@ export class PcalError extends TlaError {
|
|
|
354
440
|
}
|
|
355
441
|
}
|
|
356
442
|
|
|
357
|
-
// A RuntimeException the translator's Java code throws, such as an index out of bounds, which
|
|
358
|
-
// ParseAlgorithm.getAlgorithm turns into a parsing error.
|
|
359
443
|
export class PcalRuntimeError extends TlaError {
|
|
360
444
|
constructor(message: string) {
|
|
361
445
|
super(message);
|
|
@@ -363,8 +447,7 @@ export class PcalRuntimeError extends TlaError {
|
|
|
363
447
|
}
|
|
364
448
|
}
|
|
365
449
|
|
|
366
|
-
//
|
|
367
|
-
// java.lang.Error that nothing in SANY catches.
|
|
450
|
+
// The translator throws a java.lang.Error that nothing in SANY catches.
|
|
368
451
|
export class PcalBugError extends TlaError {
|
|
369
452
|
constructor(message: string) {
|
|
370
453
|
super(
|
|
@@ -373,3 +456,17 @@ export class PcalBugError extends TlaError {
|
|
|
373
456
|
this.name = "PcalBugError";
|
|
374
457
|
}
|
|
375
458
|
}
|
|
459
|
+
|
|
460
|
+
// TypeScript that tla-ts can't compile to TLA+, at the file, line and column of the construct.
|
|
461
|
+
export class TlaTypeScriptError extends TlaError {
|
|
462
|
+
constructor(message: string, node?: ts.Node) {
|
|
463
|
+
const sourceFile = node?.getSourceFile();
|
|
464
|
+
const position = sourceFile?.getLineAndCharacterOfPosition(node?.getStart() ?? 0);
|
|
465
|
+
super(
|
|
466
|
+
sourceFile === undefined || position === undefined
|
|
467
|
+
? message
|
|
468
|
+
: `${sourceFile.fileName}:${position.line + 1}:${position.character + 1} ${message}`,
|
|
469
|
+
);
|
|
470
|
+
this.name = "TlaTypeScriptError";
|
|
471
|
+
}
|
|
472
|
+
}
|