lambdajson-js 3.1.1 → 3.1.2
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 +4 -0
- package/package.json +1 -1
- package/src/types.js +2 -2
package/README.md
CHANGED
|
@@ -32,6 +32,10 @@ and the errors and warnings (impossible paths, possibly missing operands, mismat
|
|
|
32
32
|
comparisons, unbound variables) found from the type of the input, without running the program.
|
|
33
33
|
See the language documentation.
|
|
34
34
|
|
|
35
|
+
## Changes in 3.1.2
|
|
36
|
+
|
|
37
|
+
* `infer`: after an impossible path the walk continues with any value, so the problem isn't reported a second time where the value is used.
|
|
38
|
+
|
|
35
39
|
## Changes in 3.1.1
|
|
36
40
|
|
|
37
41
|
* `infer`: an impossible segment in some members of a union yields a missing value (`T | null`) instead of being dropped.
|
package/package.json
CHANGED
package/src/types.js
CHANGED
|
@@ -269,14 +269,14 @@ export function walkSegment(t, k) {
|
|
|
269
269
|
return { type: union(...results.filter(r => !r.error).map(r => r.type), ...(results.some(r => r.error) ? [NULL] : [])) };
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
/** Walks a path; calls `fail(message)` at the first impossible segment and continues with
|
|
272
|
+
/** Walks a path; calls `fail(message)` at the first impossible segment and continues with any value, so the problem isn't reported twice. */
|
|
273
273
|
export function walkPath(t, segments, fail) {
|
|
274
274
|
let current = t;
|
|
275
275
|
for (const segment of segments) {
|
|
276
276
|
const step = walkSegment(current, segment);
|
|
277
277
|
if (step.error) {
|
|
278
278
|
fail(step.error);
|
|
279
|
-
return
|
|
279
|
+
return ANY;
|
|
280
280
|
}
|
|
281
281
|
current = step.type;
|
|
282
282
|
}
|