lemmascript 0.6.13 → 0.6.15
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 +10 -0
- package/package.json +1 -1
- package/tools/dist/alias-check-pass.js +13 -1
- package/tools/dist/builtins.js +20 -20
- package/tools/dist/checked-reads.js +125 -38
- package/tools/dist/condition-facts.js +113 -31
- package/tools/dist/config.js +42 -6
- package/tools/dist/dafny-commands.js +22 -6
- package/tools/dist/dafny-emit.js +35 -4
- package/tools/dist/dafny-proof-additions.js +1 -1
- package/tools/dist/extract.js +34 -13
- package/tools/dist/lean-emit.js +164 -25
- package/tools/dist/lsc.js +10 -5
- package/tools/dist/narrow-checks.js +9 -3
- package/tools/dist/narrow.js +42 -41
- package/tools/dist/place-lowering.js +22 -63
- package/tools/dist/resolve.js +752 -224
- package/tools/dist/run-log.js +15 -1
- package/tools/dist/specparser.js +10 -6
- package/tools/dist/transform.js +971 -440
- package/tools/dist/typedecls.js +7 -0
- package/tools/dist/typedir.js +19 -1
- package/tools/dist/types.js +52 -15
package/tools/dist/run-log.js
CHANGED
|
@@ -170,7 +170,7 @@ export class RunLog {
|
|
|
170
170
|
failed: results?.failed ?? [],
|
|
171
171
|
passed: results?.passed ?? [],
|
|
172
172
|
tsHash: this.tsHash,
|
|
173
|
-
dfyHash: safely(() =>
|
|
173
|
+
dfyHash: safely(() => this.proofHash(outcome.dfyPath)),
|
|
174
174
|
lsc: this.init.lscVersion,
|
|
175
175
|
};
|
|
176
176
|
appendFileSync(path.join(dir, "runs.jsonl"), JSON.stringify(record) + "\n");
|
|
@@ -185,6 +185,20 @@ export class RunLog {
|
|
|
185
185
|
this.done = true;
|
|
186
186
|
this.removeTextLogDir();
|
|
187
187
|
}
|
|
188
|
+
proofHash(dfyPath) {
|
|
189
|
+
const content = readFileSync(dfyPath, "utf8");
|
|
190
|
+
const files = [...new Set((this.init.proofFiles ?? []).map(file => path.resolve(file)))];
|
|
191
|
+
// Preserve historical comparisons for sources without registered proofs.
|
|
192
|
+
if (files.length === 0)
|
|
193
|
+
return hashText(content);
|
|
194
|
+
const proofs = files.map(file => [
|
|
195
|
+
path.relative(this.init.logDir, file).split(path.sep).join("/"),
|
|
196
|
+
readFileSync(file, "utf8"),
|
|
197
|
+
]);
|
|
198
|
+
proofs.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
199
|
+
// Include paths and file boundaries, independent of registration order or checkout location.
|
|
200
|
+
return hashText(JSON.stringify([content, proofs]));
|
|
201
|
+
}
|
|
188
202
|
textLogPath() {
|
|
189
203
|
return path.join(this.textLogDir, "verify.txt");
|
|
190
204
|
}
|
package/tools/dist/specparser.js
CHANGED
|
@@ -179,9 +179,14 @@ class Parser {
|
|
|
179
179
|
}
|
|
180
180
|
if (t?.type === "op" && ["===", "!==", "==", "!=", ">=", "<=", ">", "<"].includes(t.value)) {
|
|
181
181
|
this.advance();
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
182
|
+
const right = this.parseAdd();
|
|
183
|
+
const isNullishAtom = (x) => x.kind === "var" && (x.name === "null" || x.name === "undefined");
|
|
184
|
+
// Keep loose `==` / `!=` distinct when comparing against `null`/`undefined`
|
|
185
|
+
// so `//@ ensures x == null` checks both sentinels on `Nullish<T>` (#304),
|
|
186
|
+
// while non-nullish spec equalities (`a == b`) continue normalizing to `===`.
|
|
187
|
+
const keepLoose = (t.value === "==" || t.value === "!=") && (isNullishAtom(left) || isNullishAtom(right));
|
|
188
|
+
const op = keepLoose ? t.value : t.value === "==" ? "===" : t.value === "!=" ? "!==" : t.value;
|
|
189
|
+
return { kind: "binop", op, left, right };
|
|
185
190
|
}
|
|
186
191
|
return left;
|
|
187
192
|
}
|
|
@@ -268,11 +273,10 @@ class Parser {
|
|
|
268
273
|
this.advance();
|
|
269
274
|
return { kind: "bool", value: false };
|
|
270
275
|
}
|
|
271
|
-
//
|
|
272
|
-
// `undefined` are interchangeable in LS, both map to None.
|
|
276
|
+
// Preserve `null` distinctly from `undefined` (#304).
|
|
273
277
|
if (t.value === "null") {
|
|
274
278
|
this.advance();
|
|
275
|
-
return { kind: "var", name: "
|
|
279
|
+
return { kind: "var", name: "null" };
|
|
276
280
|
}
|
|
277
281
|
// new Set<T>() / new Map<K,V>()
|
|
278
282
|
if (t.value === "new") {
|