tla-ts 0.0.9 → 0.0.10-dev.28c823e4b
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 +29 -1
- package/dist/compile.cjs +23 -0
- package/dist/compile.js +23 -0
- package/dist/deciders.cjs +28 -28
- package/dist/deciders.js +43 -43
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +106 -10
- package/dist/index.d.ts +106 -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 +2 -2
- package/dist/transfer.cjs +129 -104
- package/dist/transfer.js +129 -104
- package/dist/worker.cjs +7 -7
- package/dist/worker.js +7 -7
- package/package.json +3 -1
- package/src/ast.ts +4 -23
- package/src/bags.ts +99 -102
- package/src/builtins.ts +40 -78
- package/src/bundled-modules.ts +1 -8
- package/src/check.ts +599 -388
- package/src/cli/options.ts +11 -6
- package/src/cli/run.ts +0 -2
- package/src/cli/runtime-invariants.ts +136 -0
- package/src/cli/shared.ts +18 -11
- package/src/cli/tlapm.ts +0 -12
- package/src/cli/tlc-arguments.ts +640 -0
- package/src/cli/tlc-usage.ts +361 -0
- package/src/cli/tlc.ts +538 -220
- package/src/cli/typescript.ts +23 -0
- package/src/cli/xml-exporter.ts +4 -16
- package/src/cli.ts +0 -1
- package/src/codegen.ts +191 -64
- package/src/config.ts +140 -109
- package/src/coverage.ts +837 -0
- package/src/dependencies.ts +6 -40
- package/src/dfid.ts +618 -0
- package/src/environment.ts +240 -118
- package/src/errors.ts +70 -55
- package/src/evaluate.ts +596 -339
- package/src/exit-codes.ts +37 -3
- package/src/fingerprints.ts +10 -10
- package/src/index.ts +3 -0
- package/src/instances.ts +79 -11
- package/src/java-overrides.ts +4 -19
- package/src/json-reader.ts +455 -0
- package/src/json.ts +255 -139
- package/src/levels.ts +8 -17
- package/src/lexer.ts +80 -100
- package/src/liveness-checker.ts +82 -119
- package/src/liveness.ts +112 -64
- package/src/obligations/action.ts +4 -28
- package/src/obligations/anonymize.ts +84 -80
- package/src/obligations/equality.ts +1 -1
- package/src/obligations/expression.ts +2 -19
- package/src/obligations/format.ts +1 -9
- package/src/obligations/generate.ts +1 -11
- package/src/obligations/index.ts +0 -11
- package/src/obligations/levels.ts +4 -8
- package/src/obligations/module.ts +1 -15
- package/src/obligations/normalize.ts +5 -24
- package/src/obligations/operators.ts +1 -2
- package/src/obligations/pragma.ts +1 -10
- package/src/obligations/printer.ts +47 -46
- package/src/obligations/proof.ts +1 -5
- package/src/obligations/regroup.ts +1 -4
- package/src/obligations/simplify.ts +3 -14
- package/src/obligations/source.ts +1 -21
- package/src/obligations/subexpression.ts +5 -11
- package/src/obligations/substitution.ts +1 -3
- package/src/obligations/temporal.ts +8 -14
- package/src/obligations/tuples.ts +3 -9
- package/src/parallel-worker.ts +29 -39
- package/src/parallel.ts +53 -44
- package/src/parser.ts +565 -282
- package/src/pcal/ast.ts +53 -86
- package/src/pcal/parse.ts +144 -219
- package/src/pcal/tokenize.ts +91 -131
- package/src/pcal/translate.ts +83 -130
- package/src/pcal/validate.ts +48 -68
- package/src/pretty-print.ts +7 -8
- package/src/prover/decide-pool.ts +5 -10
- package/src/prover/deciders.ts +0 -4
- package/src/prover/first-order.ts +0 -11
- package/src/prover/isabelle/decide.ts +0 -6
- package/src/prover/isabelle/encode.ts +11 -23
- package/src/prover/isabelle/isar/inner-syntax.ts +108 -114
- package/src/prover/isabelle/isar/method.ts +25 -38
- package/src/prover/isabelle/isar/proof.ts +1 -10
- package/src/prover/isabelle/isar/statement.ts +1 -6
- package/src/prover/isabelle/isar/theory.ts +15 -26
- package/src/prover/isabelle/isar/type-check.ts +11 -25
- package/src/prover/isabelle/provers/blast/blast.ts +10 -41
- package/src/prover/isabelle/provers/blast/branch.ts +1 -32
- package/src/prover/isabelle/provers/blast/prove.ts +1 -35
- package/src/prover/isabelle/provers/blast/rules.ts +6 -44
- package/src/prover/isabelle/provers/blast/state.ts +2 -28
- package/src/prover/isabelle/provers/blast/term.ts +9 -36
- package/src/prover/isabelle/provers/clasimp.ts +1 -13
- package/src/prover/isabelle/provers/classical.ts +14 -42
- package/src/prover/isabelle/provers/hypsubst.ts +11 -25
- package/src/prover/isabelle/pure/bicompose.ts +16 -13
- package/src/prover/isabelle/pure/consts.ts +1 -7
- package/src/prover/isabelle/pure/conv.ts +1 -9
- package/src/prover/isabelle/pure/drule.ts +24 -40
- package/src/prover/isabelle/pure/envir.ts +3 -52
- package/src/prover/isabelle/pure/goal.ts +1 -7
- package/src/prover/isabelle/pure/interrupt.ts +0 -5
- package/src/prover/isabelle/pure/list.ts +0 -3
- package/src/prover/isabelle/pure/logic.ts +1 -14
- package/src/prover/isabelle/pure/name.ts +2 -9
- package/src/prover/isabelle/pure/net.ts +3 -59
- package/src/prover/isabelle/pure/object-logic.ts +3 -10
- package/src/prover/isabelle/pure/pattern.ts +2 -19
- package/src/prover/isabelle/pure/raw-simplifier.ts +13 -49
- package/src/prover/isabelle/pure/rewriter.ts +26 -58
- package/src/prover/isabelle/pure/search.ts +3 -10
- package/src/prover/isabelle/pure/seq.ts +1 -10
- package/src/prover/isabelle/pure/simplifier.ts +4 -12
- package/src/prover/isabelle/pure/table.ts +1 -31
- package/src/prover/isabelle/pure/tactic.ts +12 -22
- package/src/prover/isabelle/pure/tactical.ts +6 -12
- package/src/prover/isabelle/pure/term-ord.ts +2 -6
- package/src/prover/isabelle/pure/term.ts +2 -43
- package/src/prover/isabelle/pure/thm.ts +13 -36
- package/src/prover/isabelle/pure/type.ts +2 -15
- package/src/prover/isabelle/pure/unify.ts +20 -30
- package/src/prover/isabelle/pure/variable.ts +3 -7
- package/src/prover/isabelle/tla/classical-setup.ts +9 -19
- package/src/prover/isabelle/tla/context.ts +8 -16
- package/src/prover/isabelle/tla/logic.ts +4 -11
- package/src/prover/isabelle/tla/simpdata.ts +46 -34
- package/src/prover/isabelle/tools/intuitionistic.ts +1 -10
- package/src/prover/ocaml.ts +0 -6
- package/src/prover/prep/action.ts +4 -36
- package/src/prover/prep/enabled-axioms.ts +12 -19
- package/src/prover/prep/fingerprint.ts +0 -16
- package/src/prover/prep/level-comparison.ts +8 -12
- package/src/prover/prep/md5.ts +0 -2
- package/src/prover/prep/methods.ts +9 -36
- package/src/prover/prep/normalize.ts +4 -28
- package/src/prover/prove-worker.ts +0 -2
- package/src/prover/prove.ts +0 -36
- package/src/prover/ptl/decide.ts +7 -12
- package/src/prover/ptl/encode.ts +14 -36
- package/src/prover/ptl/sat.ts +24 -32
- package/src/prover/ptl/tableau.ts +12 -26
- package/src/prover/smt/axioms.ts +0 -7
- package/src/prover/smt/context.ts +19 -26
- package/src/prover/smt/data.ts +51 -54
- package/src/prover/smt/encode.ts +14 -35
- package/src/prover/smt/extensionality.ts +0 -10
- package/src/prover/smt/flatten.ts +3 -22
- package/src/prover/smt/format.ts +5 -10
- package/src/prover/smt/instances.ts +0 -10
- package/src/prover/smt/rewrite.ts +66 -101
- package/src/prover/smt/solver/act-cache.ts +0 -15
- package/src/prover/smt/solver/arith-rewriter.ts +3 -48
- package/src/prover/smt/solver/array.ts +1 -3
- package/src/prover/smt/solver/asserted-formulas.ts +1 -43
- package/src/prover/smt/solver/ast-lt.ts +1 -11
- package/src/prover/smt/solver/ast-util.ts +1 -6
- package/src/prover/smt/solver/ast.ts +1 -143
- package/src/prover/smt/solver/auf-solver.ts +6 -39
- package/src/prover/smt/solver/case-split-queue.ts +1 -9
- package/src/prover/smt/solver/cg-table.ts +1 -18
- package/src/prover/smt/solver/clause.ts +1 -27
- package/src/prover/smt/solver/conflict-resolution.ts +0 -9
- package/src/prover/smt/solver/context.ts +4 -61
- package/src/prover/smt/solver/ctx-simplify.ts +14 -41
- package/src/prover/smt/solver/der.ts +2 -21
- package/src/prover/smt/solver/dyn-ack.ts +1 -11
- package/src/prover/smt/solver/e-matching.ts +3 -34
- package/src/prover/smt/solver/enode.ts +1 -21
- package/src/prover/smt/solver/expr-ref.ts +1 -5
- package/src/prover/smt/solver/expr-safe-replace.ts +0 -5
- package/src/prover/smt/solver/fingerprints.ts +1 -12
- package/src/prover/smt/solver/flat-literals.ts +1 -9
- package/src/prover/smt/solver/goal.ts +2 -14
- package/src/prover/smt/solver/hash.ts +0 -8
- package/src/prover/smt/solver/hashtable.ts +1 -12
- package/src/prover/smt/solver/internalizer.ts +6 -98
- package/src/prover/smt/solver/lbool.ts +1 -2
- package/src/prover/smt/solver/literal.ts +0 -3
- package/src/prover/smt/solver/lp/bound-propagator.ts +8 -26
- package/src/prover/smt/solver/lp/constraints.ts +2 -8
- package/src/prover/smt/solver/lp/containers.ts +12 -30
- package/src/prover/smt/solver/lp/core-solver.ts +10 -31
- package/src/prover/smt/solver/lp/cross-nested.ts +6 -20
- package/src/prover/smt/solver/lp/dep-intervals.ts +7 -22
- package/src/prover/smt/solver/lp/dependency.ts +1 -4
- package/src/prover/smt/solver/lp/dioph-eq.ts +12 -98
- package/src/prover/smt/solver/lp/explanation.ts +1 -6
- package/src/prover/smt/solver/lp/gomory.ts +9 -22
- package/src/prover/smt/solver/lp/hnf-cutter.ts +17 -23
- package/src/prover/smt/solver/lp/hnf.ts +11 -26
- package/src/prover/smt/solver/lp/int-cube.ts +15 -36
- package/src/prover/smt/solver/lp/int-solver.ts +4 -34
- package/src/prover/smt/solver/lp/lar-solver.ts +32 -81
- package/src/prover/smt/solver/lp/lar-term.ts +1 -5
- package/src/prover/smt/solver/lp/lp-settings.ts +1 -14
- package/src/prover/smt/solver/lp/maximize-term.ts +20 -45
- package/src/prover/smt/solver/lp/nex-creator.ts +5 -28
- package/src/prover/smt/solver/lp/nex.ts +1 -6
- package/src/prover/smt/solver/lp/nla-backoff.ts +1 -4
- package/src/prover/smt/solver/lp/nla-basics.ts +5 -30
- package/src/prover/smt/solver/lp/nla-core.ts +35 -130
- package/src/prover/smt/solver/lp/nla-divisions.ts +32 -42
- package/src/prover/smt/solver/lp/nla-emonics.ts +4 -21
- package/src/prover/smt/solver/lp/nla-factorization.ts +1 -4
- package/src/prover/smt/solver/lp/nla-grobner.ts +15 -69
- package/src/prover/smt/solver/lp/nla-horner.ts +3 -11
- package/src/prover/smt/solver/lp/nla-intervals.ts +2 -12
- package/src/prover/smt/solver/lp/nla-monomial-bounds.ts +16 -41
- package/src/prover/smt/solver/lp/nla-monotone.ts +2 -6
- package/src/prover/smt/solver/lp/nla-order.ts +2 -13
- package/src/prover/smt/solver/lp/nla-patcher.ts +4 -7
- package/src/prover/smt/solver/lp/nla-tangents.ts +1 -9
- package/src/prover/smt/solver/lp/nla-throttle.ts +1 -6
- package/src/prover/smt/solver/lp/nla-types.ts +1 -11
- package/src/prover/smt/solver/lp/nla-var-eqs.ts +4 -25
- package/src/prover/smt/solver/lp/nra-solver.ts +5 -52
- package/src/prover/smt/solver/lp/numeric-pair.ts +1 -4
- package/src/prover/smt/solver/lp/pdd-interval.ts +1 -3
- package/src/prover/smt/solver/lp/pdd-simplifier.ts +2 -14
- package/src/prover/smt/solver/lp/pdd-solver.ts +4 -33
- package/src/prover/smt/solver/lp/pdd.ts +7 -70
- package/src/prover/smt/solver/lp/random-updater.ts +1 -8
- package/src/prover/smt/solver/lp/static-matrix.ts +9 -19
- package/src/prover/smt/solver/lp/union-find.ts +1 -6
- package/src/prover/smt/solver/mam-compiler.ts +14 -56
- package/src/prover/smt/solver/mam-interpreter.ts +1 -21
- package/src/prover/smt/solver/maximize-ac-sharing.ts +2 -17
- package/src/prover/smt/solver/model-checker.ts +2 -36
- package/src/prover/smt/solver/model-evaluator.ts +3 -29
- package/src/prover/smt/solver/model-finder.ts +3 -15
- package/src/prover/smt/solver/model-generator.ts +1 -12
- package/src/prover/smt/solver/model-macro-solver.ts +12 -69
- package/src/prover/smt/solver/nlsat/algebraic.ts +55 -151
- package/src/prover/smt/solver/nlsat/atoms.ts +5 -19
- package/src/prover/smt/solver/nlsat/evaluator.ts +17 -22
- package/src/prover/smt/solver/nlsat/explain.ts +3 -47
- package/src/prover/smt/solver/nlsat/interval-set.ts +9 -50
- package/src/prover/smt/solver/nlsat/levelwise.ts +48 -129
- package/src/prover/smt/solver/nlsat/mpbq.ts +3 -14
- package/src/prover/smt/solver/nlsat/polynomial.ts +17 -156
- package/src/prover/smt/solver/nlsat/solver.ts +7 -67
- package/src/prover/smt/solver/nlsat/types.ts +1 -8
- package/src/prover/smt/solver/nlsat/upolynomial-factorization.ts +1 -44
- package/src/prover/smt/solver/nlsat/upolynomial.ts +11 -92
- package/src/prover/smt/solver/nnf.ts +3 -38
- package/src/prover/smt/solver/pattern-inference.ts +2 -15
- package/src/prover/smt/solver/poly-rewriter.ts +3 -23
- package/src/prover/smt/solver/propagate-values.ts +1 -10
- package/src/prover/smt/solver/proto-model.ts +3 -48
- package/src/prover/smt/solver/pull-quant.ts +1 -12
- package/src/prover/smt/solver/qe-lite-der.ts +1 -29
- package/src/prover/smt/solver/qe-lite-fm.ts +2 -25
- package/src/prover/smt/solver/qe-lite.ts +3 -33
- package/src/prover/smt/solver/qi-queue.ts +1 -16
- package/src/prover/smt/solver/quant-tactics.ts +5 -22
- package/src/prover/smt/solver/quantifier-analyzer.ts +17 -37
- package/src/prover/smt/solver/quantifier-manager.ts +1 -8
- package/src/prover/smt/solver/random-gen.ts +1 -2
- package/src/prover/smt/solver/rational.ts +1 -8
- package/src/prover/smt/solver/ref-vector.ts +1 -6
- package/src/prover/smt/solver/relevancy.ts +2 -15
- package/src/prover/smt/solver/rewriter-tpl.ts +3 -147
- package/src/prover/smt/solver/rewriter.ts +3 -85
- package/src/prover/smt/solver/rlimit.ts +2 -20
- package/src/prover/smt/solver/smtlib-parser.ts +2 -37
- package/src/prover/smt/solver/solver.ts +23 -34
- package/src/prover/smt/solver/sort.ts +1 -5
- package/src/prover/smt/solver/sticky-generations.ts +0 -5
- package/src/prover/smt/solver/theory-lra-axioms.ts +3 -24
- package/src/prover/smt/solver/theory-lra-bounds.ts +0 -5
- package/src/prover/smt/solver/theory-lra-final-check.ts +4 -22
- package/src/prover/smt/solver/theory-lra-internalize.ts +1 -27
- package/src/prover/smt/solver/theory-lra-model.ts +4 -19
- package/src/prover/smt/solver/theory-lra-propagate.ts +1 -15
- package/src/prover/smt/solver/theory-lra-state.ts +3 -8
- package/src/prover/smt/solver/theory-lra.ts +1 -8
- package/src/prover/smt/solver/var-subst.ts +2 -26
- package/src/prover/smt/table.ts +0 -8
- package/src/prover/tlapm/cache.ts +20 -25
- package/src/prover/tlapm/ocaml-marshal.ts +19 -21
- package/src/prover/tlapm/tlapm.ts +12 -17
- package/src/prover/verdict.ts +0 -2
- package/src/prover/zenon/check/check.ts +0 -9
- package/src/prover/zenon/check/definitions.ts +5 -15
- package/src/prover/zenon/check/equality.ts +0 -8
- package/src/prover/zenon/check/functions.ts +0 -4
- package/src/prover/zenon/check/keys.ts +0 -7
- package/src/prover/zenon/check/propositional.ts +0 -3
- package/src/prover/zenon/check/records.ts +0 -5
- package/src/prover/zenon/check/relations.ts +0 -13
- package/src/prover/zenon/check/rewrites.ts +0 -6
- package/src/prover/zenon/check/sets.ts +0 -3
- package/src/prover/zenon/check/terms.ts +0 -17
- package/src/prover/zenon/check/tla.ts +0 -6
- package/src/prover/zenon/decide.ts +0 -12
- package/src/prover/zenon/encode.ts +1 -8
- package/src/prover/zenon/eqrel.ts +0 -13
- package/src/prover/zenon/equality-rules.ts +0 -4
- package/src/prover/zenon/expr.ts +1 -26
- package/src/prover/zenon/index-table.ts +17 -38
- package/src/prover/zenon/isar-case.ts +9 -19
- package/src/prover/zenon/isar.ts +1 -29
- package/src/prover/zenon/limits.ts +0 -4
- package/src/prover/zenon/llproof.ts +0 -9
- package/src/prover/zenon/mltoll.ts +54 -76
- package/src/prover/zenon/node.ts +1 -11
- package/src/prover/zenon/ocaml.ts +1 -17
- package/src/prover/zenon/parse.ts +2 -7
- package/src/prover/zenon/phrase.ts +1 -11
- package/src/prover/zenon/proof.ts +0 -9
- package/src/prover/zenon/propositional-rules.ts +0 -5
- package/src/prover/zenon/rules.ts +2 -6
- package/src/prover/zenon/search.ts +1 -17
- package/src/prover/zenon/tla/functions.ts +57 -29
- package/src/prover/zenon/tla/llproof.ts +63 -70
- package/src/prover/zenon/tla/records.ts +56 -27
- package/src/prover/zenon/tla/rewrites.ts +12 -19
- package/src/prover/zenon/tla/sets.ts +68 -39
- package/src/prover/zenon/tla/terms.ts +0 -6
- package/src/prover/zenon/tla/tla.ts +59 -58
- package/src/randomization.ts +81 -35
- package/src/resolve.ts +12 -112
- package/src/runtime.ts +22 -22
- package/src/sany/builtins.ts +2 -5
- package/src/sany/generator.ts +149 -252
- package/src/sany/levels.ts +6 -34
- package/src/sany/lexer.ts +41 -61
- package/src/sany/linter.ts +1 -9
- package/src/sany/modules.ts +1 -5
- package/src/sany/nodes.ts +0 -31
- package/src/sany/parse-error.ts +39 -117
- package/src/sany/report.ts +29 -63
- package/src/sany/selectors.ts +15 -39
- package/src/sany/source.ts +1 -17
- package/src/sany/xml.ts +13 -63
- package/src/search.ts +495 -155
- package/src/simulate.ts +685 -0
- package/src/spec-description.ts +176 -69
- package/src/standard-definitions.ts +0 -4
- package/src/standard-modules.ts +254 -69
- package/src/state-graph.ts +50 -24
- package/src/subexpressions.ts +69 -52
- package/src/substitution-levels.ts +2 -3
- package/src/successors.ts +263 -94
- package/src/symmetry.ts +33 -25
- package/src/tableau.ts +27 -24
- package/src/tlc/fingerprint.ts +183 -67
- package/src/tlc/jar-data.ts +112 -6
- package/src/tlc/messages.ts +110 -44
- package/src/tlc/order.ts +37 -60
- package/src/tlc/random.ts +33 -45
- package/src/tlc/replay.ts +549 -217
- package/src/tlc/summary.ts +36 -47
- package/src/tlc/tlc-operators.ts +76 -41
- package/src/tlc/tlcext-operators.ts +139 -122
- package/src/tlc/trace-spec.ts +269 -0
- package/src/tlc/value-stream.ts +139 -0
- package/src/tlc/version.ts +1 -4
- package/src/transfer.ts +22 -25
- package/src/typescript/actions.ts +481 -0
- package/src/typescript/collections.ts +600 -0
- package/src/typescript/compile.ts +65 -0
- package/src/typescript/context.ts +94 -0
- package/src/typescript/emit.ts +121 -0
- package/src/typescript/expressions.ts +496 -0
- package/src/typescript/formula.ts +152 -0
- package/src/typescript/functions.ts +284 -0
- package/src/typescript/model.ts +163 -0
- package/src/typescript/names.ts +114 -0
- package/src/typescript/program.ts +48 -0
- package/src/typescript/properties.ts +139 -0
- package/src/typescript/scope.ts +112 -0
- package/src/typescript/steps.ts +165 -0
- package/src/typescript/types.ts +171 -0
- package/src/values.ts +780 -337
- package/src/worker.ts +7 -8
package/src/tlc/jar-data.ts
CHANGED
|
@@ -430,6 +430,16 @@ export const TLC_RUNTIME_STRINGS = [
|
|
|
430
430
|
"levelmean",
|
|
431
431
|
"levelvariance",
|
|
432
432
|
"bfs",
|
|
433
|
+
"beginLine",
|
|
434
|
+
"beginColumn",
|
|
435
|
+
"endLine",
|
|
436
|
+
"endColumn",
|
|
437
|
+
"module",
|
|
438
|
+
"name",
|
|
439
|
+
"location",
|
|
440
|
+
"context",
|
|
441
|
+
"parameters",
|
|
442
|
+
"_action",
|
|
433
443
|
];
|
|
434
444
|
|
|
435
445
|
export const SANY_NODE_NAMES = [
|
|
@@ -550,10 +560,6 @@ export const SANY_NODE_NAMES = [
|
|
|
550
560
|
"N_AssertStep",
|
|
551
561
|
];
|
|
552
562
|
|
|
553
|
-
// The standard modules that a spec may ship its own file of, such as CommunityModules' Json.tla,
|
|
554
|
-
// which SANY reads in place of its own.
|
|
555
|
-
export const USER_STANDARD_MODULES = new Set(["Bags", "Json", "Randomization", "TLCExt"]);
|
|
556
|
-
|
|
557
563
|
export const TLC_MODULE_SOURCES = new Map([
|
|
558
564
|
[
|
|
559
565
|
"Naturals",
|
|
@@ -925,9 +931,56 @@ _PrintCounts == PrintT(_Counts)
|
|
|
925
931
|
],
|
|
926
932
|
]);
|
|
927
933
|
|
|
928
|
-
// The Java methods that override standard module operators, as java.lang.reflect.Method prints
|
|
929
|
-
// them in TLC's errors.
|
|
930
934
|
export const TLC_JAVA_METHODS = new Map([
|
|
935
|
+
[
|
|
936
|
+
"Bags",
|
|
937
|
+
new Map([
|
|
938
|
+
[
|
|
939
|
+
"IsABag",
|
|
940
|
+
"public static tlc2.value.IBoolValue tlc2.module.Bags.IsABag(tlc2.value.impl.Value)",
|
|
941
|
+
],
|
|
942
|
+
[
|
|
943
|
+
"BagCardinality",
|
|
944
|
+
"public static tlc2.value.impl.IntValue tlc2.module.Bags.BagCardinality(tlc2.value.impl.Value)",
|
|
945
|
+
],
|
|
946
|
+
[
|
|
947
|
+
"BagIn",
|
|
948
|
+
"public static tlc2.value.IBoolValue tlc2.module.Bags.BagIn(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
949
|
+
],
|
|
950
|
+
[
|
|
951
|
+
"CopiesIn",
|
|
952
|
+
"public static tlc2.value.impl.IntValue tlc2.module.Bags.CopiesIn(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
953
|
+
],
|
|
954
|
+
[
|
|
955
|
+
"\\oplus",
|
|
956
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagCup(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
957
|
+
],
|
|
958
|
+
[
|
|
959
|
+
"\\ominus",
|
|
960
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagDiff(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
961
|
+
],
|
|
962
|
+
[
|
|
963
|
+
"BagUnion",
|
|
964
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagUnion(tlc2.value.impl.Value)",
|
|
965
|
+
],
|
|
966
|
+
[
|
|
967
|
+
"\\sqsubseteq",
|
|
968
|
+
"public static tlc2.value.IBoolValue tlc2.module.Bags.SqSubseteq(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
969
|
+
],
|
|
970
|
+
[
|
|
971
|
+
"BagOfAll",
|
|
972
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagOfAll(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
973
|
+
],
|
|
974
|
+
[
|
|
975
|
+
"BagToSet",
|
|
976
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.BagToSet(tlc2.value.impl.Value)",
|
|
977
|
+
],
|
|
978
|
+
[
|
|
979
|
+
"SetToBag",
|
|
980
|
+
"public static tlc2.value.impl.Value tlc2.module.Bags.SetToBag(tlc2.value.impl.Value)",
|
|
981
|
+
],
|
|
982
|
+
]),
|
|
983
|
+
],
|
|
931
984
|
[
|
|
932
985
|
"FiniteSets",
|
|
933
986
|
new Map([
|
|
@@ -1023,4 +1076,57 @@ export const TLC_JAVA_METHODS = new Map([
|
|
|
1023
1076
|
],
|
|
1024
1077
|
]),
|
|
1025
1078
|
],
|
|
1079
|
+
[
|
|
1080
|
+
"TLCExt",
|
|
1081
|
+
new Map([
|
|
1082
|
+
[
|
|
1083
|
+
"AssertError",
|
|
1084
|
+
"public static synchronized tlc2.value.impl.Value tlc2.module.TLCExt.assertError(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1085
|
+
],
|
|
1086
|
+
[
|
|
1087
|
+
"PickSuccessor",
|
|
1088
|
+
"public static synchronized tlc2.value.impl.Value tlc2.module.TLCExt.pickSuccessor(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1089
|
+
],
|
|
1090
|
+
[
|
|
1091
|
+
"ToTrace",
|
|
1092
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.lassoOrdinal(tlc2.value.impl.Value)",
|
|
1093
|
+
],
|
|
1094
|
+
[
|
|
1095
|
+
"CounterExample",
|
|
1096
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.error(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel) throws java.io.IOException",
|
|
1097
|
+
],
|
|
1098
|
+
[
|
|
1099
|
+
"Trace",
|
|
1100
|
+
"public static tlc2.value.impl.TupleValue tlc2.module.TLCExt.getTrace(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel) throws java.io.IOException",
|
|
1101
|
+
],
|
|
1102
|
+
[
|
|
1103
|
+
"TLCDefer",
|
|
1104
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcDefer(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1105
|
+
],
|
|
1106
|
+
[
|
|
1107
|
+
"TLCNoOp",
|
|
1108
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcNoOp(tlc2.value.impl.Value)",
|
|
1109
|
+
],
|
|
1110
|
+
[
|
|
1111
|
+
"TLCModelValue",
|
|
1112
|
+
"public static synchronized tlc2.value.impl.Value tlc2.module.TLCExt.tlcModelValue(tlc2.value.impl.Value)",
|
|
1113
|
+
],
|
|
1114
|
+
[
|
|
1115
|
+
"TLCCache",
|
|
1116
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcEval2(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1117
|
+
],
|
|
1118
|
+
[
|
|
1119
|
+
"TLCFP",
|
|
1120
|
+
"public static synchronized tlc2.value.impl.IntValue tlc2.module.TLCExt.tlcFingerprint(tlc2.value.impl.Value)",
|
|
1121
|
+
],
|
|
1122
|
+
[
|
|
1123
|
+
"TLCEvalDefinition",
|
|
1124
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcDefByName(tlc2.tool.impl.Tool,tla2sany.semantic.ExprOrOpArgNode[],tlc2.util.Context,tlc2.tool.TLCState,tlc2.tool.TLCState,int,tlc2.tool.coverage.CostModel)",
|
|
1125
|
+
],
|
|
1126
|
+
[
|
|
1127
|
+
"TLCGetOrDefault",
|
|
1128
|
+
"public static tlc2.value.impl.Value tlc2.module.TLCExt.tlcGetOrDefault(tlc2.value.impl.Value,tlc2.value.impl.Value)",
|
|
1129
|
+
],
|
|
1130
|
+
]),
|
|
1131
|
+
],
|
|
1026
1132
|
]);
|
package/src/tlc/messages.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getErrorExitCode,
|
|
3
|
+
getUnexpectedException,
|
|
3
4
|
STACK_OVERFLOW_MESSAGE,
|
|
4
5
|
TlaEvaluationError,
|
|
5
6
|
TlaModuleError,
|
|
7
|
+
TlaSetBoundError,
|
|
8
|
+
TlaStackOverflowError,
|
|
9
|
+
TlaUncodedError,
|
|
10
|
+
TlaWarningAsError,
|
|
11
|
+
TOO_MANY_STATES_MESSAGE,
|
|
6
12
|
UNEXPECTED_EVAL_EXCEPTION,
|
|
7
13
|
UNEXPECTED_EXCEPTION,
|
|
8
14
|
} from "../errors";
|
|
9
15
|
import { setExitCode } from "../exit-codes";
|
|
10
16
|
import type { TlcVersion } from "./version";
|
|
11
17
|
|
|
12
|
-
// TLC's codes for the messages it prints, from tlc2.output.EC.
|
|
13
18
|
export const MESSAGE_CODE = {
|
|
14
19
|
general: 1000,
|
|
20
|
+
stackOverflow: 1005,
|
|
15
21
|
commandLineError: 1102,
|
|
16
22
|
initialState: 2102,
|
|
17
23
|
nestedExpression: 2103,
|
|
18
24
|
assumptionFalse: 2104,
|
|
19
25
|
assumptionEvaluationError: 2105,
|
|
26
|
+
unchangedVariableChanged: 2143,
|
|
20
27
|
exceptAppliedToUnknownField: 2144,
|
|
21
28
|
fingerprintFailed: 2147,
|
|
29
|
+
initialStateIncomplete: 2106,
|
|
22
30
|
invariantViolatedInitial: 2107,
|
|
23
31
|
incompleteSuccessor: 2109,
|
|
24
32
|
propertyViolatedInitial: 2108,
|
|
@@ -28,13 +36,20 @@ export const MESSAGE_CODE = {
|
|
|
28
36
|
actionPropertyEvaluationFailed: 2113,
|
|
29
37
|
deadlockReached: 2114,
|
|
30
38
|
temporalPropertyViolated: 2116,
|
|
39
|
+
noInitialStates: 2118,
|
|
40
|
+
errorState: 2120,
|
|
31
41
|
behaviorUpToThisPoint: 2121,
|
|
32
42
|
backToState: 2122,
|
|
43
|
+
subscriptUndetermined: 2139,
|
|
44
|
+
subscriptMissingVariable: 2140,
|
|
33
45
|
constantLevelInvariant: 2149,
|
|
34
46
|
javaOverrideLoaded: 2168,
|
|
35
47
|
starting: 2185,
|
|
36
48
|
modelChecking: 2187,
|
|
49
|
+
simulating: 2188,
|
|
37
50
|
finished: 2186,
|
|
51
|
+
traceSpecWritten: 2501,
|
|
52
|
+
traceSpecFailed: 2502,
|
|
38
53
|
computingInit: 2189,
|
|
39
54
|
initGenerated1: 2190,
|
|
40
55
|
initGenerated2: 2191,
|
|
@@ -43,14 +58,27 @@ export const MESSAGE_CODE = {
|
|
|
43
58
|
searchDepth: 2194,
|
|
44
59
|
stats: 2199,
|
|
45
60
|
progress: 2200,
|
|
61
|
+
coverageStart: 2201,
|
|
62
|
+
coverageEnd: 2202,
|
|
63
|
+
coverageValue: 2221,
|
|
64
|
+
depthFirstStats: 2204,
|
|
65
|
+
depthFirstLevel: 2205,
|
|
66
|
+
depthFirstProgress: 2206,
|
|
67
|
+
depthFirstInitGenerated: 2208,
|
|
68
|
+
simulationProgress: 2209,
|
|
69
|
+
simulationStats: 2210,
|
|
46
70
|
temporalBranches: 2212,
|
|
71
|
+
statePrint1: 2216,
|
|
47
72
|
statePrint2: 2217,
|
|
48
73
|
statePrint3: 2218,
|
|
49
74
|
sanyFinished: 2219,
|
|
50
75
|
startingSany: 2220,
|
|
51
76
|
stateLevelProperty: 2255,
|
|
77
|
+
noInitialStatesInModel: 2256,
|
|
52
78
|
version: 2262,
|
|
79
|
+
depthFirstModelChecking: 2271,
|
|
53
80
|
noSpecificationButProperty: 2257,
|
|
81
|
+
fairnessTautology: 2258,
|
|
54
82
|
noFairnessButProperty: 2259,
|
|
55
83
|
counterExample: 2264,
|
|
56
84
|
checkingTemporalEnd: 2267,
|
|
@@ -62,17 +90,23 @@ export const MESSAGE_CODE = {
|
|
|
62
90
|
javaOverrideMismatch: 2400,
|
|
63
91
|
postconditionFalse: 2404,
|
|
64
92
|
postconditionFailed: 2405,
|
|
93
|
+
coverageNext: 2772,
|
|
94
|
+
coverageInit: 2773,
|
|
95
|
+
coverageProperty: 2774,
|
|
96
|
+
coverageValueCost: 2775,
|
|
97
|
+
coverageEndOverhead: 2777,
|
|
98
|
+
coverageConstraint: 2778,
|
|
99
|
+
coverageVariable: 2779,
|
|
65
100
|
possibleUnwitnessed: 2780,
|
|
66
101
|
parsingFailed: 3002,
|
|
67
102
|
configFileError: 5001,
|
|
103
|
+
moduleOverrideStdout: 20000,
|
|
68
104
|
} as const;
|
|
69
105
|
|
|
70
|
-
// TLC's message levels, from tlc2.output.MP.
|
|
71
106
|
export const MESSAGE_LEVEL = { none: 0, error: 1, warning: 3, state: 4 } as const;
|
|
72
107
|
|
|
73
108
|
type MessageLevel = (typeof MESSAGE_LEVEL)[keyof typeof MESSAGE_LEVEL];
|
|
74
109
|
|
|
75
|
-
// Without -tool, TLC starts a message with the prefix of its level.
|
|
76
110
|
const LEVEL_PREFIXES: Record<MessageLevel, string> = {
|
|
77
111
|
0: "",
|
|
78
112
|
1: "Error: ",
|
|
@@ -86,14 +120,17 @@ export interface MessagePrinter {
|
|
|
86
120
|
print: (code: number, level: MessageLevel, text: string) => void;
|
|
87
121
|
}
|
|
88
122
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
123
|
+
export const formatMessage = (isTool: boolean, code: number, level: MessageLevel, text: string) =>
|
|
124
|
+
isTool
|
|
125
|
+
? `@!@!@STARTMSG ${code}:${level} @!@!@\n${text}\n@!@!@ENDMSG ${code} @!@!@`
|
|
126
|
+
: `${LEVEL_PREFIXES[level]}${text}`;
|
|
127
|
+
|
|
93
128
|
export const createMessagePrinter = (
|
|
94
129
|
isTool: boolean,
|
|
95
130
|
isWarningEnabled = true,
|
|
96
131
|
version: TlcVersion = "master",
|
|
132
|
+
suppressedCodes: number[] = [],
|
|
133
|
+
errorCodes: number[] = [],
|
|
97
134
|
): MessagePrinter => {
|
|
98
135
|
const warnings = new Set<string>();
|
|
99
136
|
return {
|
|
@@ -101,14 +138,16 @@ export const createMessagePrinter = (
|
|
|
101
138
|
version,
|
|
102
139
|
print: (code, level, text) => {
|
|
103
140
|
const isWarning = level === MESSAGE_LEVEL.warning;
|
|
141
|
+
if (isWarning && errorCodes.includes(code)) {
|
|
142
|
+
throw new TlaWarningAsError(code, text);
|
|
143
|
+
}
|
|
104
144
|
if (isWarning && !isWarningEnabled) return;
|
|
145
|
+
if (level !== MESSAGE_LEVEL.error && suppressedCodes.includes(code)) return;
|
|
105
146
|
const hint =
|
|
106
147
|
isWarning && !isTool && warnings.size === 0
|
|
107
148
|
? "\n(Use the -nowarning option to disable this warning.)"
|
|
108
149
|
: "";
|
|
109
|
-
const message = isTool
|
|
110
|
-
? `@!@!@STARTMSG ${code}:${level} @!@!@\n${text}\n@!@!@ENDMSG ${code} @!@!@`
|
|
111
|
-
: `${LEVEL_PREFIXES[level]}${text}${hint}`;
|
|
150
|
+
const message = formatMessage(isTool, code, level, `${text}${hint}`);
|
|
112
151
|
if (isWarning && warnings.has(message)) return;
|
|
113
152
|
if (isWarning) warnings.add(message);
|
|
114
153
|
console.log(message);
|
|
@@ -116,19 +155,22 @@ export const createMessagePrinter = (
|
|
|
116
155
|
};
|
|
117
156
|
};
|
|
118
157
|
|
|
119
|
-
// TLC 1.7.4's message for a missing initial predicate, which blames a parameterized INSTANCE as
|
|
120
|
-
// well.
|
|
121
158
|
export const MISSING_INIT_174 =
|
|
122
159
|
"The configuration file did not specify the initial state predicate.\nCan also be caused by trying to run TLC on a specification from\na module imported with a parameterized INSTANCE statement.";
|
|
123
160
|
|
|
124
|
-
// The messages that TLC builds from a message code, from tlc2.output.MP, by their code and
|
|
125
|
-
// template, with whether TLC throws them as an EvalException rather than a TLCRuntimeException.
|
|
126
|
-
// TLC's -tool output wraps such a message in its own markers even inside another message.
|
|
127
161
|
const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean][] = [
|
|
128
162
|
[1005, STACK_OVERFLOW_MESSAGE, false],
|
|
163
|
+
[
|
|
164
|
+
1000,
|
|
165
|
+
"In evaluating TLCExt!Trace, the state is not completely specified yet (variable%1% %2% undefined).",
|
|
166
|
+
false,
|
|
167
|
+
],
|
|
168
|
+
[1000, "Could not find operator: %1% in module: %2%", false],
|
|
129
169
|
[2117, "Failed to recover the next state from its fingerprint.", true],
|
|
130
170
|
[2123, "Failed to recover the initial state from its fingerprint.", true],
|
|
131
171
|
[2132, "The first argument of Assert evaluated to FALSE; the second argument was:\n%1%", true],
|
|
172
|
+
[2143, "The variable %1% was changed while it is specified as UNCHANGED at\n%2%", false],
|
|
173
|
+
[2144, "The EXCEPT was applied to non-existing fields of the value at\n%1%", false],
|
|
132
174
|
[2145, "TLCGet(%1%) was undefined.", true],
|
|
133
175
|
[
|
|
134
176
|
2154,
|
|
@@ -147,8 +189,13 @@ const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean]
|
|
|
147
189
|
"Attempted to apply TransitiveClosure to a set containing\nthe following value:\n%1%",
|
|
148
190
|
true,
|
|
149
191
|
],
|
|
192
|
+
[2156, "TLC supports at most %1% model values, but model value %2% exceeds this limit.", false],
|
|
193
|
+
[2156, "tla-ts can't recover a model check from the checkpoint in %1%.", false],
|
|
150
194
|
[2165, "Choose can only deal with numbers up to %1%", false],
|
|
151
195
|
[2169, "The %1% argument of %2% should be a %3%, but instead it is:\n%4%", true],
|
|
196
|
+
[2170, "Argument mismatch in operator application.%1%", false],
|
|
197
|
+
[2171, "Parsing or semantic analysis failed.%1%", false],
|
|
198
|
+
[2172, TOO_MANY_STATES_MESSAGE, false],
|
|
152
199
|
[2176, "Applying %1% to the following value,\nwhich is not %2%:\n%3%", true],
|
|
153
200
|
[
|
|
154
201
|
2177,
|
|
@@ -207,12 +254,23 @@ const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean]
|
|
|
207
254
|
[2233, "The %1% %2% cannot be a constant.", false],
|
|
208
255
|
[2234, "The operator %1% cannot take any argument.", false],
|
|
209
256
|
[2235, "The operator %1% is not defined in the spec.", false],
|
|
257
|
+
[2236, "The operator %1%, which equals %2%,\ncannot be used as a %3%", false],
|
|
210
258
|
[2237, "The spec is trivially false because %1% is false.", false],
|
|
211
259
|
[2238, "TLC cannot handle subscript %1%", false],
|
|
212
260
|
[2239, "TLC cannot handle this conjunct of the spec:\n%1%", false],
|
|
261
|
+
[
|
|
262
|
+
2240,
|
|
263
|
+
"The specification contains more than one conjunct of the form [][Next]_v,\nbut TLC can handle only specifications with one next-state relation.",
|
|
264
|
+
false,
|
|
265
|
+
],
|
|
213
266
|
[2241, "The property %1% is not correctly defined.", false],
|
|
214
267
|
[2242, "The arity of the operator %1% is inconsistent in the configuration file.", false],
|
|
215
268
|
[2244, "TLC can't handle real numbers.\n%1%", false],
|
|
269
|
+
[
|
|
270
|
+
2245,
|
|
271
|
+
"In the configuration file, the module name %1% is not a module in the specification.",
|
|
272
|
+
false,
|
|
273
|
+
],
|
|
216
274
|
[2247, "In computing %1%, TLC expected a %2% expression,\nbut instead found %3%.\n%4%", false],
|
|
217
275
|
[2248, "In computing %1%, TLC expected a %2% expression,\nbut didn't find one.\n%3%", false],
|
|
218
276
|
[2260, "In computing ENABLED, TLC encountered a temporal formula (%1%).\n%2%", false],
|
|
@@ -223,6 +281,21 @@ const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean]
|
|
|
223
281
|
],
|
|
224
282
|
[2265, "TLC can't handle a number this big.\n%1%", false],
|
|
225
283
|
[2266, "The %1% argument of %2% should be an %3%, but instead it is:\n%4%", true],
|
|
284
|
+
[
|
|
285
|
+
2272,
|
|
286
|
+
"The formula %1% at %2% is an action-level formula (i.e., it contains no temporal operators). Only temporal-level (or state-level) formulas are allowed under PROPERTY or PROPERTIES. To check that action %1% holds in *every* step of the behavior, define a temporal property: Let A be the formula at %2%; rewrite A as [][A]_v, where v is a state function (typically the tuple of variables) (compare page 90 of Specifying Systems at https://lamport.azurewebsites.net/tla/book.html).",
|
|
287
|
+
false,
|
|
288
|
+
],
|
|
289
|
+
[
|
|
290
|
+
2273,
|
|
291
|
+
'The formula %1% at %2% is an action-level formula (i.e., it contains no temporal operators). Only temporal-level (or state-level) formulas are allowed under PROPERTY or PROPERTIES. To check that action %1% holds in *every* step of the behavior, define a temporal property by applying the "always" temporal operator ([]) to the formula at %2% (compare page 90 of Specifying Systems at https://lamport.azurewebsites.net/tla/book.html).',
|
|
292
|
+
false,
|
|
293
|
+
],
|
|
294
|
+
[
|
|
295
|
+
2274,
|
|
296
|
+
'The formula %1% at %2% is an action-level formula (i.e., it contains no temporal operators). Only temporal-level (or state-level) formulas are allowed under PROPERTY or PROPERTIES. To check that infinitely many %1% steps occur, define a temporal property by applying the "always eventually" temporal operator combination ([]<>) to the formula at %2% (compare page 91 of Specifying Systems at https://lamport.azurewebsites.net/tla/book.html).',
|
|
297
|
+
false,
|
|
298
|
+
],
|
|
226
299
|
[2280, "In evaluation, the identifier %1% is either undefined or not an operator.\n%2%", false],
|
|
227
300
|
[2281, "The configuration file substitutes constant %1% with non-constant %2%%3%", false],
|
|
228
301
|
[2283, "The argument of %1% should be a %2%, but instead it is:\n%3%", true],
|
|
@@ -249,6 +322,8 @@ const CODED_MESSAGES: [code: number, template: string, isEvalException: boolean]
|
|
|
249
322
|
[5007, "TLC found an error in the configuration file:\n%1%", false],
|
|
250
323
|
// The general message is a prefix of the others above.
|
|
251
324
|
[5002, "TLC found an error in the configuration file at line %1%\n", false],
|
|
325
|
+
[2250, "A state predicate was evaluated to a non-boolean value.", false],
|
|
326
|
+
[2252, "Encountered an action predicate that's not a boolean.", false],
|
|
252
327
|
[2253, "Temporal formula is a tautology (its negation is unsatisfiable).", false],
|
|
253
328
|
[
|
|
254
329
|
2301,
|
|
@@ -262,12 +337,10 @@ interface CodedMessage {
|
|
|
262
337
|
isEvalException: boolean;
|
|
263
338
|
}
|
|
264
339
|
|
|
265
|
-
|
|
266
|
-
value: undefined as { pattern: RegExp; message: CodedMessage }[] | undefined,
|
|
267
|
-
};
|
|
340
|
+
let codedMessagePatterns: { pattern: RegExp; message: CodedMessage }[] | undefined;
|
|
268
341
|
|
|
269
342
|
const getCodedMessagePatterns = () =>
|
|
270
|
-
(codedMessagePatterns
|
|
343
|
+
(codedMessagePatterns ??= CODED_MESSAGES.map(([code, template, isEvalException]) => ({
|
|
271
344
|
pattern: new RegExp(
|
|
272
345
|
`^${template
|
|
273
346
|
.split(/%\d+%/)
|
|
@@ -277,33 +350,27 @@ const getCodedMessagePatterns = () =>
|
|
|
277
350
|
message: { code, isEvalException },
|
|
278
351
|
})));
|
|
279
352
|
|
|
280
|
-
// The overflows of SetOfFcnsValue and SetOfTuplesValue, which TLC raises with a plain message that
|
|
281
|
-
// reads like the coded overflow of SetOfRcdsValue and SubsetValue.
|
|
282
353
|
const UNCODED_MESSAGE_PATTERN =
|
|
283
|
-
/^Overflow when computing the number of elements in( |:\n\[(?![A-Za-z0-9_]
|
|
354
|
+
/^Overflow when computing the number of elements in( |:\n\[(?![A-Za-z0-9_]+: ))|\nis an element of a set of \d+-tuples\.$|^In computing ENABLED, TLC encountered a temporal formula \(a (~> b|-\+-> formula)\)\./;
|
|
284
355
|
|
|
285
356
|
export const getCodedMessage = (text: string): CodedMessage | undefined =>
|
|
286
357
|
UNCODED_MESSAGE_PATTERN.test(text)
|
|
287
358
|
? undefined
|
|
288
359
|
: getCodedMessagePatterns().find((item) => item.pattern.test(text))?.message;
|
|
289
360
|
|
|
290
|
-
// Whether TLC raises an error as an EvalException, which only a standard module's Java code throws,
|
|
291
|
-
// rather than as the TLCRuntimeException of every Assert.fail.
|
|
292
361
|
export const isEvalException = (error: TlaEvaluationError) =>
|
|
293
362
|
error instanceof TlaModuleError || getCodedMessage(error.message)?.isEvalException === true;
|
|
294
363
|
|
|
295
|
-
// The messages that end with the message of the error they report, after this text.
|
|
296
364
|
const INNER_MESSAGE_PREFIXES = new Map([
|
|
297
|
-
// "The exception was a <class>\n: "
|
|
298
365
|
[1000, "\n: "],
|
|
299
366
|
[2105, "failed.\n"],
|
|
300
367
|
[2154, "but it produced the following error:\n"],
|
|
368
|
+
[2171, "Parsing or semantic analysis failed."],
|
|
301
369
|
[2213, ":\n"],
|
|
302
370
|
[2281, " - specifically: "],
|
|
371
|
+
[2405, "failed.\n"],
|
|
303
372
|
]);
|
|
304
373
|
|
|
305
|
-
// The text of a coded message with the message of the error it reports marked in -tool output, as
|
|
306
|
-
// TLC's message holds that error's text as TLC printed it.
|
|
307
374
|
export const formatInnerMessage = (code: number, text: string, isTool: boolean) => {
|
|
308
375
|
const prefix = isTool ? INNER_MESSAGE_PREFIXES.get(code) : undefined;
|
|
309
376
|
const index = prefix === undefined ? -1 : text.indexOf(prefix);
|
|
@@ -312,7 +379,6 @@ export const formatInnerMessage = (code: number, text: string, isTool: boolean)
|
|
|
312
379
|
return `${text.slice(0, end)}${formatNestedMessage(text.slice(end), isTool)}`;
|
|
313
380
|
};
|
|
314
381
|
|
|
315
|
-
// The text of an error's message as TLC prints it inside another message.
|
|
316
382
|
export const formatNestedMessage = (text: string, isTool: boolean): string => {
|
|
317
383
|
const code = isTool ? getCodedMessage(text)?.code : undefined;
|
|
318
384
|
return code === undefined
|
|
@@ -322,7 +388,6 @@ export const formatNestedMessage = (text: string, isTool: boolean): string => {
|
|
|
322
388
|
|
|
323
389
|
const zeroPad = (value: number) => String(value).padStart(2, "0");
|
|
324
390
|
|
|
325
|
-
// TLC's convertRuntimeToHumanReadable: a duration in its two largest units.
|
|
326
391
|
export const formatTlcDuration = (milliseconds: number) => {
|
|
327
392
|
const seconds = Math.floor(milliseconds / 1000) % 60;
|
|
328
393
|
const minutes = Math.floor(milliseconds / 60_000) % 60;
|
|
@@ -334,12 +399,9 @@ export const formatTlcDuration = (milliseconds: number) => {
|
|
|
334
399
|
: `${zeroPad(seconds)}s`;
|
|
335
400
|
};
|
|
336
401
|
|
|
337
|
-
// TLC's SimpleDateFormat("yyyy-MM-dd HH:mm:ss") in the local time zone.
|
|
338
402
|
export const formatTlcDate = (date: Date) =>
|
|
339
403
|
`${date.getFullYear()}-${zeroPad(date.getMonth() + 1)}-${zeroPad(date.getDate())} ${zeroPad(date.getHours())}:${zeroPad(date.getMinutes())}:${zeroPad(date.getSeconds())}`;
|
|
340
404
|
|
|
341
|
-
// An error that TLC reports with a message of its own, by that message's code and first line, and
|
|
342
|
-
// the error whose message follows.
|
|
343
405
|
interface HeadedError {
|
|
344
406
|
code: number;
|
|
345
407
|
headline: string;
|
|
@@ -360,18 +422,16 @@ export const withHeadline = (error: unknown, code: number, headline: string) =>
|
|
|
360
422
|
|
|
361
423
|
export const isHeadedError = (error: Error) => headedErrors.has(error);
|
|
362
424
|
|
|
425
|
+
const WRONG_INVOCATION_EXCEPTION = getUnexpectedException("util.WrongInvocationException");
|
|
426
|
+
|
|
363
427
|
const UNEXPECTED_HEADLINE = UNEXPECTED_EXCEPTION.slice(0, UNEXPECTED_EXCEPTION.indexOf("\n"));
|
|
364
428
|
|
|
365
|
-
// TLC 1.7.4's Worker wraps an error in adding a successor in a RuntimeException, whose message
|
|
366
|
-
// names the class of the error.
|
|
367
429
|
const WRAPPED_EVAL_EXCEPTION = `${UNEXPECTED_EXCEPTION}tlc2.tool.EvalException: `;
|
|
368
430
|
const WRAPPED_RUNTIME_EXCEPTION = `${UNEXPECTED_EXCEPTION}util.Assert$TLCRuntimeException: `;
|
|
369
431
|
|
|
370
432
|
export const getWrappedException = (error: TlaEvaluationError) =>
|
|
371
433
|
isEvalException(error) ? WRAPPED_EVAL_EXCEPTION : WRAPPED_RUNTIME_EXCEPTION;
|
|
372
434
|
|
|
373
|
-
// TLC reports an EvalException, or a TLCRuntimeException without a message of its own, as an
|
|
374
|
-
// exception it didn't expect.
|
|
375
435
|
export const withUnexpectedException = <Result>(compute: () => Result) => {
|
|
376
436
|
try {
|
|
377
437
|
return compute();
|
|
@@ -392,19 +452,15 @@ const UNEXPECTED_EXCEPTION_PREFIXES = [
|
|
|
392
452
|
UNEXPECTED_EVAL_EXCEPTION,
|
|
393
453
|
];
|
|
394
454
|
|
|
395
|
-
// The text of an error's message, with the message of a coded error inside it marked in -tool
|
|
396
|
-
// output as TLC marks it.
|
|
397
455
|
const formatErrorMessage = (error: TlaEvaluationError, isTool: boolean): string => {
|
|
398
456
|
const headed = headedErrors.get(error);
|
|
399
457
|
if (headed) return `${headed.headline}\n${formatErrorMessage(headed.inner, isTool)}`;
|
|
400
458
|
const message = error.message;
|
|
459
|
+
if (error instanceof TlaUncodedError) return message;
|
|
401
460
|
const prefix = UNEXPECTED_EXCEPTION_PREFIXES.find((start) => message.startsWith(start)) ?? "";
|
|
402
461
|
return `${prefix}${formatNestedMessage(message.slice(prefix.length), isTool)}`;
|
|
403
462
|
};
|
|
404
463
|
|
|
405
|
-
// How TLC reports an error: with the code of its own message for an error that it reports with a
|
|
406
|
-
// headline; and, when the error escapes the computation of next states, with the code of an
|
|
407
|
-
// EvalException, or as an unexpected exception for any other error.
|
|
408
464
|
export interface FailureMessage {
|
|
409
465
|
code: number;
|
|
410
466
|
message: string;
|
|
@@ -424,6 +480,13 @@ export const getFailureMessage = (
|
|
|
424
480
|
toolMessage: formatErrorMessage(error, true),
|
|
425
481
|
};
|
|
426
482
|
}
|
|
483
|
+
if (error instanceof TlaStackOverflowError) {
|
|
484
|
+
return {
|
|
485
|
+
code: isNextState ? MESSAGE_CODE.stackOverflow : MESSAGE_CODE.general,
|
|
486
|
+
message,
|
|
487
|
+
toolMessage: message,
|
|
488
|
+
};
|
|
489
|
+
}
|
|
427
490
|
if (isNextState && isEvalException(error)) {
|
|
428
491
|
return {
|
|
429
492
|
code: getCodedMessage(message)?.code ?? MESSAGE_CODE.general,
|
|
@@ -431,8 +494,11 @@ export const getFailureMessage = (
|
|
|
431
494
|
toolMessage: message,
|
|
432
495
|
};
|
|
433
496
|
}
|
|
434
|
-
const isUnexpected =
|
|
435
|
-
|
|
497
|
+
const isUnexpected =
|
|
498
|
+
isNextState && !message.startsWith(UNEXPECTED_HEADLINE) && !(error instanceof TlaUncodedError);
|
|
499
|
+
const exception =
|
|
500
|
+
error instanceof TlaSetBoundError ? WRONG_INVOCATION_EXCEPTION : UNEXPECTED_EXCEPTION;
|
|
501
|
+
const prefix = isUnexpected ? exception : "";
|
|
436
502
|
return {
|
|
437
503
|
code: MESSAGE_CODE.general,
|
|
438
504
|
message: `${prefix}${message}`,
|