hinmil 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +2306 -2
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +338 -0
- package/dist/cli.js.map +1 -0
- package/dist/commentParser.d.ts +384 -0
- package/dist/commentParser.d.ts.map +1 -0
- package/dist/commentParser.js +2487 -0
- package/dist/commentParser.js.map +1 -0
- package/dist/config.d.ts +203 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +375 -0
- package/dist/config.js.map +1 -0
- package/dist/debugLog.d.ts +13 -0
- package/dist/debugLog.d.ts.map +1 -0
- package/dist/debugLog.js +44 -0
- package/dist/debugLog.js.map +1 -0
- package/dist/estree.d.ts +100 -0
- package/dist/estree.d.ts.map +1 -0
- package/dist/estree.js +34 -0
- package/dist/estree.js.map +1 -0
- package/dist/hm/env.d.ts +134 -0
- package/dist/hm/env.d.ts.map +1 -0
- package/dist/hm/env.js +939 -0
- package/dist/hm/env.js.map +1 -0
- package/dist/hm/index.d.ts +7 -0
- package/dist/hm/index.d.ts.map +1 -0
- package/dist/hm/index.js +26 -0
- package/dist/hm/index.js.map +1 -0
- package/dist/hm/substitution.d.ts +57 -0
- package/dist/hm/substitution.d.ts.map +1 -0
- package/dist/hm/substitution.js +546 -0
- package/dist/hm/substitution.js.map +1 -0
- package/dist/hm/typeParser.d.ts +39 -0
- package/dist/hm/typeParser.d.ts.map +1 -0
- package/dist/hm/typeParser.js +1285 -0
- package/dist/hm/typeParser.js.map +1 -0
- package/dist/hm/typeUtils.d.ts +248 -0
- package/dist/hm/typeUtils.d.ts.map +1 -0
- package/dist/hm/typeUtils.js +905 -0
- package/dist/hm/typeUtils.js.map +1 -0
- package/dist/hm/types.d.ts +738 -0
- package/dist/hm/types.d.ts.map +1 -0
- package/dist/hm/types.js +1853 -0
- package/dist/hm/types.js.map +1 -0
- package/dist/hm/unify.d.ts +59 -0
- package/dist/hm/unify.d.ts.map +1 -0
- package/dist/hm/unify.js +1700 -0
- package/dist/hm/unify.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +196 -0
- package/dist/index.js.map +1 -0
- package/dist/infer/annotation-rigid.d.ts +76 -0
- package/dist/infer/annotation-rigid.d.ts.map +1 -0
- package/dist/infer/annotation-rigid.js +542 -0
- package/dist/infer/annotation-rigid.js.map +1 -0
- package/dist/infer/annotation-validation.d.ts +109 -0
- package/dist/infer/annotation-validation.d.ts.map +1 -0
- package/dist/infer/annotation-validation.js +1078 -0
- package/dist/infer/annotation-validation.js.map +1 -0
- package/dist/infer/annotations.d.ts +277 -0
- package/dist/infer/annotations.d.ts.map +1 -0
- package/dist/infer/annotations.js +1343 -0
- package/dist/infer/annotations.js.map +1 -0
- package/dist/infer/call-overloads.d.ts +24 -0
- package/dist/infer/call-overloads.d.ts.map +1 -0
- package/dist/infer/call-overloads.js +900 -0
- package/dist/infer/call-overloads.js.map +1 -0
- package/dist/infer/call-rows.d.ts +154 -0
- package/dist/infer/call-rows.d.ts.map +1 -0
- package/dist/infer/call-rows.js +2162 -0
- package/dist/infer/call-rows.js.map +1 -0
- package/dist/infer/calls.d.ts +20 -0
- package/dist/infer/calls.d.ts.map +1 -0
- package/dist/infer/calls.js +1468 -0
- package/dist/infer/calls.js.map +1 -0
- package/dist/infer/constraints.d.ts +99 -0
- package/dist/infer/constraints.d.ts.map +1 -0
- package/dist/infer/constraints.js +1208 -0
- package/dist/infer/constraints.js.map +1 -0
- package/dist/infer/expr-assignment.d.ts +20 -0
- package/dist/infer/expr-assignment.d.ts.map +1 -0
- package/dist/infer/expr-assignment.js +620 -0
- package/dist/infer/expr-assignment.js.map +1 -0
- package/dist/infer/expr-constraint-lookup.d.ts +44 -0
- package/dist/infer/expr-constraint-lookup.d.ts.map +1 -0
- package/dist/infer/expr-constraint-lookup.js +207 -0
- package/dist/infer/expr-constraint-lookup.js.map +1 -0
- package/dist/infer/expr-functions.d.ts +20 -0
- package/dist/infer/expr-functions.d.ts.map +1 -0
- package/dist/infer/expr-functions.js +1359 -0
- package/dist/infer/expr-functions.js.map +1 -0
- package/dist/infer/expr-jsx.d.ts +19 -0
- package/dist/infer/expr-jsx.d.ts.map +1 -0
- package/dist/infer/expr-jsx.js +310 -0
- package/dist/infer/expr-jsx.js.map +1 -0
- package/dist/infer/expr-member.d.ts +40 -0
- package/dist/infer/expr-member.d.ts.map +1 -0
- package/dist/infer/expr-member.js +1154 -0
- package/dist/infer/expr-member.js.map +1 -0
- package/dist/infer/expr-prototype.d.ts +11 -0
- package/dist/infer/expr-prototype.d.ts.map +1 -0
- package/dist/infer/expr-prototype.js +202 -0
- package/dist/infer/expr-prototype.js.map +1 -0
- package/dist/infer/expressions.d.ts +40 -0
- package/dist/infer/expressions.d.ts.map +1 -0
- package/dist/infer/expressions.js +1497 -0
- package/dist/infer/expressions.js.map +1 -0
- package/dist/infer/functionPatterns.d.ts +229 -0
- package/dist/infer/functionPatterns.d.ts.map +1 -0
- package/dist/infer/functionPatterns.js +1035 -0
- package/dist/infer/functionPatterns.js.map +1 -0
- package/dist/infer/helpers.d.ts +73 -0
- package/dist/infer/helpers.d.ts.map +1 -0
- package/dist/infer/helpers.js +187 -0
- package/dist/infer/helpers.js.map +1 -0
- package/dist/infer/index.d.ts +551 -0
- package/dist/infer/index.d.ts.map +1 -0
- package/dist/infer/index.js +1127 -0
- package/dist/infer/index.js.map +1 -0
- package/dist/infer/jsx-dom.d.ts +26 -0
- package/dist/infer/jsx-dom.d.ts.map +1 -0
- package/dist/infer/jsx-dom.js +303 -0
- package/dist/infer/jsx-dom.js.map +1 -0
- package/dist/infer/moduleReps.d.ts +7 -0
- package/dist/infer/moduleReps.d.ts.map +1 -0
- package/dist/infer/moduleReps.js +48 -0
- package/dist/infer/moduleReps.js.map +1 -0
- package/dist/infer/modules.d.ts +10 -0
- package/dist/infer/modules.d.ts.map +1 -0
- package/dist/infer/modules.js +775 -0
- package/dist/infer/modules.js.map +1 -0
- package/dist/infer/narrowing.d.ts +199 -0
- package/dist/infer/narrowing.d.ts.map +1 -0
- package/dist/infer/narrowing.js +1428 -0
- package/dist/infer/narrowing.js.map +1 -0
- package/dist/infer/results.d.ts +24 -0
- package/dist/infer/results.d.ts.map +1 -0
- package/dist/infer/results.js +611 -0
- package/dist/infer/results.js.map +1 -0
- package/dist/infer/setupPass.d.ts +11 -0
- package/dist/infer/setupPass.d.ts.map +1 -0
- package/dist/infer/setupPass.js +524 -0
- package/dist/infer/setupPass.js.map +1 -0
- package/dist/infer/statements.d.ts +26 -0
- package/dist/infer/statements.d.ts.map +1 -0
- package/dist/infer/statements.js +750 -0
- package/dist/infer/statements.js.map +1 -0
- package/dist/infer/stmt-bindings.d.ts +22 -0
- package/dist/infer/stmt-bindings.d.ts.map +1 -0
- package/dist/infer/stmt-bindings.js +1482 -0
- package/dist/infer/stmt-bindings.js.map +1 -0
- package/dist/infer/stmt-destructure.d.ts +29 -0
- package/dist/infer/stmt-destructure.d.ts.map +1 -0
- package/dist/infer/stmt-destructure.js +490 -0
- package/dist/infer/stmt-destructure.js.map +1 -0
- package/dist/infer/types.d.ts +220 -0
- package/dist/infer/types.d.ts.map +1 -0
- package/dist/infer/types.js +46 -0
- package/dist/infer/types.js.map +1 -0
- package/dist/infer/unifyDiag.d.ts +46 -0
- package/dist/infer/unifyDiag.d.ts.map +1 -0
- package/dist/infer/unifyDiag.js +642 -0
- package/dist/infer/unifyDiag.js.map +1 -0
- package/dist/parsing-babel.d.ts +3 -0
- package/dist/parsing-babel.d.ts.map +1 -0
- package/dist/parsing-babel.js +353 -0
- package/dist/parsing-babel.js.map +1 -0
- package/dist/parsing.d.ts +69 -0
- package/dist/parsing.d.ts.map +1 -0
- package/dist/parsing.js +288 -0
- package/dist/parsing.js.map +1 -0
- package/dist/registries/constraintRegistry.d.ts +233 -0
- package/dist/registries/constraintRegistry.d.ts.map +1 -0
- package/dist/registries/constraintRegistry.js +803 -0
- package/dist/registries/constraintRegistry.js.map +1 -0
- package/dist/registries/dataTypeRegistry.d.ts +63 -0
- package/dist/registries/dataTypeRegistry.d.ts.map +1 -0
- package/dist/registries/dataTypeRegistry.js +180 -0
- package/dist/registries/dataTypeRegistry.js.map +1 -0
- package/dist/registries/domGlobals.d.ts +33 -0
- package/dist/registries/domGlobals.d.ts.map +1 -0
- package/dist/registries/domGlobals.js +309 -0
- package/dist/registries/domGlobals.js.map +1 -0
- package/dist/registries/methodRegistry.d.ts +277 -0
- package/dist/registries/methodRegistry.d.ts.map +1 -0
- package/dist/registries/methodRegistry.js +2074 -0
- package/dist/registries/methodRegistry.js.map +1 -0
- package/dist/registries/session.d.ts +38 -0
- package/dist/registries/session.d.ts.map +1 -0
- package/dist/registries/session.js +75 -0
- package/dist/registries/session.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1896 -0
- package/dist/server.js.map +1 -0
- package/dist/services/codeActions.d.ts +22 -0
- package/dist/services/codeActions.d.ts.map +1 -0
- package/dist/services/codeActions.js +465 -0
- package/dist/services/codeActions.js.map +1 -0
- package/dist/services/completion.d.ts +259 -0
- package/dist/services/completion.d.ts.map +1 -0
- package/dist/services/completion.js +2794 -0
- package/dist/services/completion.js.map +1 -0
- package/dist/services/definitions.d.ts +37 -0
- package/dist/services/definitions.d.ts.map +1 -0
- package/dist/services/definitions.js +605 -0
- package/dist/services/definitions.js.map +1 -0
- package/dist/services/diagnosticCodes.d.ts +70 -0
- package/dist/services/diagnosticCodes.d.ts.map +1 -0
- package/dist/services/diagnosticCodes.js +239 -0
- package/dist/services/diagnosticCodes.js.map +1 -0
- package/dist/services/diagnostics.d.ts +86 -0
- package/dist/services/diagnostics.d.ts.map +1 -0
- package/dist/services/diagnostics.js +665 -0
- package/dist/services/diagnostics.js.map +1 -0
- package/dist/services/documentCache.d.ts +88 -0
- package/dist/services/documentCache.d.ts.map +1 -0
- package/dist/services/documentCache.js +108 -0
- package/dist/services/documentCache.js.map +1 -0
- package/dist/services/documentSymbols.d.ts +20 -0
- package/dist/services/documentSymbols.d.ts.map +1 -0
- package/dist/services/documentSymbols.js +381 -0
- package/dist/services/documentSymbols.js.map +1 -0
- package/dist/services/fileSelection.d.ts +24 -0
- package/dist/services/fileSelection.d.ts.map +1 -0
- package/dist/services/fileSelection.js +154 -0
- package/dist/services/fileSelection.js.map +1 -0
- package/dist/services/fileSelectionRefresh.d.ts +26 -0
- package/dist/services/fileSelectionRefresh.d.ts.map +1 -0
- package/dist/services/fileSelectionRefresh.js +77 -0
- package/dist/services/fileSelectionRefresh.js.map +1 -0
- package/dist/services/files.d.ts +342 -0
- package/dist/services/files.d.ts.map +1 -0
- package/dist/services/files.js +1712 -0
- package/dist/services/files.js.map +1 -0
- package/dist/services/fsProbe.d.ts +14 -0
- package/dist/services/fsProbe.d.ts.map +1 -0
- package/dist/services/fsProbe.js +112 -0
- package/dist/services/fsProbe.js.map +1 -0
- package/dist/services/globalsLoader.d.ts +20 -0
- package/dist/services/globalsLoader.d.ts.map +1 -0
- package/dist/services/globalsLoader.js +122 -0
- package/dist/services/globalsLoader.js.map +1 -0
- package/dist/services/hmFileServices.d.ts +113 -0
- package/dist/services/hmFileServices.d.ts.map +1 -0
- package/dist/services/hmFileServices.js +686 -0
- package/dist/services/hmFileServices.js.map +1 -0
- package/dist/services/hover.d.ts +280 -0
- package/dist/services/hover.d.ts.map +1 -0
- package/dist/services/hover.js +1687 -0
- package/dist/services/hover.js.map +1 -0
- package/dist/services/importContext.d.ts +396 -0
- package/dist/services/importContext.d.ts.map +1 -0
- package/dist/services/importContext.js +1999 -0
- package/dist/services/importContext.js.map +1 -0
- package/dist/services/projectChecker.d.ts +50 -0
- package/dist/services/projectChecker.d.ts.map +1 -0
- package/dist/services/projectChecker.js +228 -0
- package/dist/services/projectChecker.js.map +1 -0
- package/dist/services/references.d.ts +41 -0
- package/dist/services/references.d.ts.map +1 -0
- package/dist/services/references.js +757 -0
- package/dist/services/references.js.map +1 -0
- package/dist/services/rename.d.ts +22 -0
- package/dist/services/rename.d.ts.map +1 -0
- package/dist/services/rename.js +101 -0
- package/dist/services/rename.js.map +1 -0
- package/dist/services/shortCircuit.d.ts +27 -0
- package/dist/services/shortCircuit.d.ts.map +1 -0
- package/dist/services/shortCircuit.js +28 -0
- package/dist/services/shortCircuit.js.map +1 -0
- package/dist/services/sidecarPerf.d.ts +19 -0
- package/dist/services/sidecarPerf.d.ts.map +1 -0
- package/dist/services/sidecarPerf.js +59 -0
- package/dist/services/sidecarPerf.js.map +1 -0
- package/dist/services/signatureHelp.d.ts +27 -0
- package/dist/services/signatureHelp.d.ts.map +1 -0
- package/dist/services/signatureHelp.js +984 -0
- package/dist/services/signatureHelp.js.map +1 -0
- package/dist/walking.d.ts +25 -0
- package/dist/walking.d.ts.map +1 -0
- package/dist/walking.js +107 -0
- package/dist/walking.js.map +1 -0
- package/hm-types-builtin/assert.hm +20 -0
- package/hm-types-builtin/buffer.hm +8 -0
- package/hm-types-builtin/child_process.hm +16 -0
- package/hm-types-builtin/crypto.hm +17 -0
- package/hm-types-builtin/fs.hm +15 -0
- package/hm-types-builtin/http.hm +14 -0
- package/hm-types-builtin/os.hm +19 -0
- package/hm-types-builtin/path.hm +18 -0
- package/hm-types-builtin/react-dom.hm +27 -0
- package/hm-types-builtin/react.hm +113 -0
- package/hm-types-builtin/url.hm +7 -0
- package/hm-types-builtin/zlib.hm +12 -0
- package/package.json +53 -4
- package/schemas/hinmil.config.schema.json +261 -0
- package/schemas/package-hinmil.schema.json +59 -0
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Result construction — export maps, top-level bindings, display cleanup
|
|
4
|
+
//
|
|
5
|
+
// Plain language: after all inference is done, this file packs up the
|
|
6
|
+
// answers: which names the file exports (and their final types), the type of
|
|
7
|
+
// every top-level binding, all with internal artefacts cleaned out so hover
|
|
8
|
+
// popups show polished results.
|
|
9
|
+
//
|
|
10
|
+
// Extracted from the InferenceEngine class. These functions run at the end
|
|
11
|
+
// of `engine.infer()` to assemble the InferenceResult: building the export
|
|
12
|
+
// map and top-level binding table, scrubbing `$error` poison, normalizing
|
|
13
|
+
// kv-constraints for display, and post-processing constraint rewrites.
|
|
14
|
+
// ============================================================================
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.buildResult = buildResult;
|
|
17
|
+
exports.buildExportMap = buildExportMap;
|
|
18
|
+
exports.buildTopLevelBindings = buildTopLevelBindings;
|
|
19
|
+
exports.overrideSumtypeIdentifierTypes = overrideSumtypeIdentifierTypes;
|
|
20
|
+
exports.postProcessConstraintRewrites = postProcessConstraintRewrites;
|
|
21
|
+
const helpers_1 = require("./helpers");
|
|
22
|
+
const types_1 = require("../hm/types");
|
|
23
|
+
const env_1 = require("../hm/env");
|
|
24
|
+
const commentParser_1 = require("../commentParser");
|
|
25
|
+
const constraintRegistry_1 = require("../registries/constraintRegistry");
|
|
26
|
+
const dataTypeRegistry_1 = require("../registries/dataTypeRegistry");
|
|
27
|
+
const annotations_1 = require("./annotations");
|
|
28
|
+
const typeUtils_1 = require("../hm/typeUtils");
|
|
29
|
+
const types_2 = require("../hm/types");
|
|
30
|
+
/**
|
|
31
|
+
* Post-inference normalization of `kvConstraints` for hover/completion
|
|
32
|
+
* display.
|
|
33
|
+
*
|
|
34
|
+
* Higher-kinded (functor) constraint fragments are registered under each
|
|
35
|
+
* fresh per-instantiation kv id — every `of`/`ap`/... call gets its own
|
|
36
|
+
* functor variable. When those variables later unify onto a shared
|
|
37
|
+
* representative, their constraint fragments stay scattered under the
|
|
38
|
+
* original ids and are never merged. As a result the *same* expression can
|
|
39
|
+
* display an arbitrary, often weaker, subset (e.g. `Apply f` leaking from an
|
|
40
|
+
* `ap` call instead of the `Applicative f` that `of` requires), and two
|
|
41
|
+
* identical expressions can disagree.
|
|
42
|
+
*
|
|
43
|
+
* This pass resolves every kv id to its representative (chasing both
|
|
44
|
+
* `TVar -> TVar` links and kv-`TCon` bindings), unions the *functor-kind*
|
|
45
|
+
* (`* -> *`) constraints across each representative group, applies superclass
|
|
46
|
+
* subsumption (dropping any constraint that is a proper superclass of another
|
|
47
|
+
* present one — keeping the strongest), and writes the reconciled set back so
|
|
48
|
+
* a lookup by any contributing id returns the same set.
|
|
49
|
+
*
|
|
50
|
+
* Only `* -> *` constraints are merged: kind-`*` constraints such as
|
|
51
|
+
* `Setoid (f b)` must never migrate onto the `* -> *` functor variable.
|
|
52
|
+
*/
|
|
53
|
+
function normalizeKvConstraintsForDisplay(engine) {
|
|
54
|
+
const map = engine.kvConstraints;
|
|
55
|
+
if (map.size === 0)
|
|
56
|
+
return;
|
|
57
|
+
const resolveRep = (id) => {
|
|
58
|
+
let cur = id;
|
|
59
|
+
const seen = new Set();
|
|
60
|
+
for (;;) {
|
|
61
|
+
if (seen.has(cur))
|
|
62
|
+
return cur;
|
|
63
|
+
seen.add(cur);
|
|
64
|
+
const bound = engine.subst.lookup(cur);
|
|
65
|
+
if (!bound)
|
|
66
|
+
return cur;
|
|
67
|
+
if (bound.tag === 'TVar') {
|
|
68
|
+
if (bound.id === cur)
|
|
69
|
+
return cur;
|
|
70
|
+
cur = bound.id;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (bound.tag === 'TCon') {
|
|
74
|
+
const kv = (0, types_1.parseKvName)(bound.name);
|
|
75
|
+
if (kv && kv.varId !== cur) {
|
|
76
|
+
cur = kv.varId;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return cur;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const isFunctorKind = (name) => (0, constraintRegistry_1.lookupConstraint)(name)?.expectedKind === '* -> *';
|
|
84
|
+
// Union functor-kind constraint names per representative.
|
|
85
|
+
const groupFunctor = new Map();
|
|
86
|
+
for (const [id, names] of map) {
|
|
87
|
+
const rep = resolveRep(id);
|
|
88
|
+
let set = groupFunctor.get(rep);
|
|
89
|
+
if (!set) {
|
|
90
|
+
set = new Set();
|
|
91
|
+
groupFunctor.set(rep, set);
|
|
92
|
+
}
|
|
93
|
+
for (const n of names)
|
|
94
|
+
if (isFunctorKind(n))
|
|
95
|
+
set.add(n);
|
|
96
|
+
}
|
|
97
|
+
// Superclass subsumption: drop any name that is a proper superclass
|
|
98
|
+
// (transitive `extends` ancestor) of another present name.
|
|
99
|
+
const subsume = (names) => {
|
|
100
|
+
const arr = [...names];
|
|
101
|
+
return arr.filter(n => !arr.some(other => other !== n && (0, constraintRegistry_1.constraintSuperclassClosure)(other).has(n)));
|
|
102
|
+
};
|
|
103
|
+
const repFunctor = new Map();
|
|
104
|
+
for (const [rep, set] of groupFunctor)
|
|
105
|
+
repFunctor.set(rep, subsume(set));
|
|
106
|
+
const dedupe = (xs) => [...new Set(xs)];
|
|
107
|
+
// Write back onto every id that already carries a functor-kind constraint,
|
|
108
|
+
// preserving its non-functor constraints. Do not inject a functor
|
|
109
|
+
// constraint onto ids that only hold kind-`*` constraints.
|
|
110
|
+
for (const [id, names] of map) {
|
|
111
|
+
const reconciled = repFunctor.get(resolveRep(id));
|
|
112
|
+
if (!reconciled || reconciled.length === 0)
|
|
113
|
+
continue;
|
|
114
|
+
if (!names.some(isFunctorKind))
|
|
115
|
+
continue;
|
|
116
|
+
const nonFunctor = names.filter(n => !isFunctorKind(n));
|
|
117
|
+
map.set(id, dedupe([...reconciled, ...nonFunctor]));
|
|
118
|
+
}
|
|
119
|
+
// Ensure each representative itself carries the reconciled set (it may not
|
|
120
|
+
// have had a direct entry of its own).
|
|
121
|
+
for (const [rep, reconciled] of repFunctor) {
|
|
122
|
+
if (reconciled.length === 0)
|
|
123
|
+
continue;
|
|
124
|
+
const existing = map.get(rep) ?? [];
|
|
125
|
+
const nonFunctor = existing.filter(n => !isFunctorKind(n));
|
|
126
|
+
map.set(rep, dedupe([...reconciled, ...nonFunctor]));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function buildResult(engine, opts) {
|
|
130
|
+
normalizeKvConstraintsForDisplay(engine);
|
|
131
|
+
return {
|
|
132
|
+
type: opts.type,
|
|
133
|
+
substitution: engine.subst,
|
|
134
|
+
diagnostics: opts.diagnostics,
|
|
135
|
+
nodeTypes: engine.nodeTypes,
|
|
136
|
+
declaredSchemes: engine.declaredSchemes,
|
|
137
|
+
nodeTypesByEnd: engine.nodeTypesByEnd,
|
|
138
|
+
functionNodeTypes: engine.functionNodeTypes,
|
|
139
|
+
annotations: engine.annotationMap,
|
|
140
|
+
annotationsByOffset: engine.annotationByOffset,
|
|
141
|
+
methodSignatures: engine.methodSignatures,
|
|
142
|
+
exports: opts.exports,
|
|
143
|
+
kvConstraints: engine.kvConstraints,
|
|
144
|
+
kvConstructorConstraints: engine.kvConstructorConstraints,
|
|
145
|
+
typeAliases: (0, annotations_1.buildTypeAliasResult)(engine.typeAliases, engine.annotationMap),
|
|
146
|
+
curriedNodes: engine.curriedNodes,
|
|
147
|
+
callSiteOverloadIndex: engine.callSiteOverloadIndex,
|
|
148
|
+
unboundIdentifiers: engine.unboundIdentifiers,
|
|
149
|
+
topLevelBindings: opts.topLevelBindings,
|
|
150
|
+
dataVariantNames: (0, dataTypeRegistry_1.getVariantNames)(),
|
|
151
|
+
unconstrainedPropAccesses: engine.unconstrainedPropAccesses,
|
|
152
|
+
importedConstructors: engine.importedConstructors,
|
|
153
|
+
instanceCallables: engine.instanceCallables,
|
|
154
|
+
constructorParentSumtype: engine.constructorParentSumtype,
|
|
155
|
+
frozenPropertyTypeStr: engine.frozenPropertyTypeStr,
|
|
156
|
+
frozenParamType: scrubFrozenParamSkolems(engine),
|
|
157
|
+
bindingExtents: engine.bindingExtents,
|
|
158
|
+
skolemDisplayNames: engine.skolemDisplayNames,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Annotated parameters of bodies checked against rigid skolems are frozen
|
|
163
|
+
* with those skolems; render them with the annotation's letters so no result
|
|
164
|
+
* consumer (hover, signature help, tests) ever sees a `§N` constant.
|
|
165
|
+
*/
|
|
166
|
+
function scrubFrozenParamSkolems(engine) {
|
|
167
|
+
const frozen = engine.frozenParamType;
|
|
168
|
+
if (engine.skolemDisplayNames.size === 0)
|
|
169
|
+
return frozen;
|
|
170
|
+
for (const [offset, t] of frozen) {
|
|
171
|
+
if ((0, typeUtils_1.someType)(t, types_2.isSkolem))
|
|
172
|
+
frozen.set(offset, (0, typeUtils_1.scrubSkolems)(t, engine.skolemDisplayNames));
|
|
173
|
+
}
|
|
174
|
+
return frozen;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Replace every `$error` sentinel in a type with a fresh type variable.
|
|
178
|
+
* `poisonFreeVars` binds free TVars to `$error` after a unification
|
|
179
|
+
* failure to stop cascading diagnostics — but if such a binding survives
|
|
180
|
+
* into `buildExportMap`, it would bake `$error` into the exported scheme
|
|
181
|
+
* (and `generalize` then produces `vars=[]` because `$error` has no free
|
|
182
|
+
* vars, collapsing polymorphism for the consumer). Scrubbing restores
|
|
183
|
+
* polymorphism so consumers continue to see a usable signature even when
|
|
184
|
+
* the producing module's body had a unification error.
|
|
185
|
+
*/
|
|
186
|
+
function scrubErrorWithFreshVars(t) {
|
|
187
|
+
if (t.tag === 'TCon') {
|
|
188
|
+
if (t.name === types_1.T_ERROR)
|
|
189
|
+
return (0, types_1.tVar)();
|
|
190
|
+
if (!t.args || t.args.length === 0)
|
|
191
|
+
return t;
|
|
192
|
+
const newArgs = t.args.map(a => scrubErrorWithFreshVars(a));
|
|
193
|
+
let changed = false;
|
|
194
|
+
for (let i = 0; i < newArgs.length; i++) {
|
|
195
|
+
if (newArgs[i] !== t.args[i]) {
|
|
196
|
+
changed = true;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return changed ? { ...t, args: newArgs } : t;
|
|
201
|
+
}
|
|
202
|
+
if (t.tag === 'TFun') {
|
|
203
|
+
const p = scrubErrorWithFreshVars(t.param);
|
|
204
|
+
const r = scrubErrorWithFreshVars(t.result);
|
|
205
|
+
return (p === t.param && r === t.result) ? t : { tag: 'TFun', param: p, result: r };
|
|
206
|
+
}
|
|
207
|
+
if (t.tag === 'TRecord') {
|
|
208
|
+
const newFields = {};
|
|
209
|
+
let changed = false;
|
|
210
|
+
for (const [k, v] of Object.entries(t.fields)) {
|
|
211
|
+
const nv = scrubErrorWithFreshVars(v);
|
|
212
|
+
newFields[k] = nv;
|
|
213
|
+
if (nv !== v)
|
|
214
|
+
changed = true;
|
|
215
|
+
}
|
|
216
|
+
return changed ? { ...t, fields: newFields } : t;
|
|
217
|
+
}
|
|
218
|
+
return t;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Select the `::rep` entries from this file that apply to the given
|
|
222
|
+
* constraints. Used to attach call-scoped constraint representations to an
|
|
223
|
+
* exported scheme so they travel to import sites.
|
|
224
|
+
*/
|
|
225
|
+
function repsForConstraints(engine, constraints) {
|
|
226
|
+
const allReps = [...engine.fileReps, ...engine.importedReps];
|
|
227
|
+
if (!constraints || constraints.length === 0 || allReps.length === 0) {
|
|
228
|
+
return [];
|
|
229
|
+
}
|
|
230
|
+
// Superclasses too: a `Plus f` scheme needs `f`'s Alt and Functor
|
|
231
|
+
// instances to be discharged at the call site.
|
|
232
|
+
const names = new Set();
|
|
233
|
+
for (const c of constraints) {
|
|
234
|
+
names.add(c.className);
|
|
235
|
+
for (const sup of (0, constraintRegistry_1.constraintSuperclassClosure)(c.className))
|
|
236
|
+
names.add(sup);
|
|
237
|
+
}
|
|
238
|
+
return allReps.filter((r) => names.has(r.constraint));
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Copy narrowing-related metadata (type predicate, conditional-return
|
|
242
|
+
* narrowing, optional-parameter slots) from one scheme onto another so it
|
|
243
|
+
* travels with an exported scheme to the import site. Used uniformly by all
|
|
244
|
+
* `buildExportMap` branches.
|
|
245
|
+
*/
|
|
246
|
+
function copyNarrowingMetadata(from, to) {
|
|
247
|
+
if (from.typePredicate)
|
|
248
|
+
to.typePredicate = from.typePredicate;
|
|
249
|
+
if (from.conditionalReturn)
|
|
250
|
+
to.conditionalReturn = from.conditionalReturn;
|
|
251
|
+
if (from.optionalParamSlots && from.optionalParamSlots.length > 0) {
|
|
252
|
+
to.optionalParamSlots = from.optionalParamSlots.slice();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function buildExportMap(engine, finalEnv, baseEnv) {
|
|
256
|
+
const exportMap = new Map();
|
|
257
|
+
for (const name of engine.exportedNames) {
|
|
258
|
+
// `module.exports = { key: <expr> }`: the export IS the property value.
|
|
259
|
+
if (engine.cjsValueExports.has(name)) {
|
|
260
|
+
const cjsType = engine.cjsExportTypes.get(name);
|
|
261
|
+
const resolvedType = scrubErrorWithFreshVars(engine.subst.apply(cjsType));
|
|
262
|
+
exportMap.set(name, (0, env_1.generalize)(baseEnv, resolvedType));
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const scheme = finalEnv.lookup(name);
|
|
266
|
+
if (scheme) {
|
|
267
|
+
// Annotation-authoritative export: when a top-level binding has an
|
|
268
|
+
// explicit user annotation, export the annotation scheme verbatim.
|
|
269
|
+
// Body inference may have unified the annotation's type variables
|
|
270
|
+
// with concrete types from the body; applying `engine.subst` to the
|
|
271
|
+
// scheme would leak those bindings into the consumer's view of the
|
|
272
|
+
// signature. The body is still inferred (and validated against
|
|
273
|
+
// the annotation) — only the *exported* scheme is held authoritative
|
|
274
|
+
// to the user's declared signature.
|
|
275
|
+
const ann = engine.annotationMap.get(name);
|
|
276
|
+
if (ann && ann.scheme && !ann.receiver && (0, commentParser_1.isLocalAnnotation)(ann)) {
|
|
277
|
+
const annScheme = ann.scheme;
|
|
278
|
+
const exportedScheme = {
|
|
279
|
+
vars: annScheme.vars.slice(),
|
|
280
|
+
type: annScheme.type,
|
|
281
|
+
};
|
|
282
|
+
if (annScheme.constraints && annScheme.constraints.length > 0) {
|
|
283
|
+
exportedScheme.constraints = annScheme.constraints.slice();
|
|
284
|
+
const reps = repsForConstraints(engine, exportedScheme.constraints);
|
|
285
|
+
if (reps.length > 0)
|
|
286
|
+
exportedScheme.reps = reps;
|
|
287
|
+
}
|
|
288
|
+
if (scheme.optionalParamSlots && scheme.optionalParamSlots.length > 0) {
|
|
289
|
+
exportedScheme.optionalParamSlots = scheme.optionalParamSlots.slice();
|
|
290
|
+
}
|
|
291
|
+
if (scheme.typePredicate)
|
|
292
|
+
exportedScheme.typePredicate = scheme.typePredicate;
|
|
293
|
+
if (scheme.conditionalReturn)
|
|
294
|
+
exportedScheme.conditionalReturn = scheme.conditionalReturn;
|
|
295
|
+
if (engine.curryFunctionNames.has(name))
|
|
296
|
+
exportedScheme.isCurryWrapper = true;
|
|
297
|
+
if (engine.curryNFunctionNames.has(name))
|
|
298
|
+
exportedScheme.curryLeadingArgs = engine.curryNFunctionNames.get(name);
|
|
299
|
+
if (scheme.isCurriedResult)
|
|
300
|
+
exportedScheme.isCurriedResult = true;
|
|
301
|
+
exportMap.set(name, exportedScheme);
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
const applied = (0, env_1.applySubstToScheme)(engine.subst, scheme);
|
|
305
|
+
// Scrub `$error` poison before generalize: free TVars that were
|
|
306
|
+
// bound to `$error` by error recovery would otherwise collapse the
|
|
307
|
+
// polymorphism of the exported scheme (generalize sees no free
|
|
308
|
+
// vars in `$error`). Replace each `$error` with a fresh TVar so
|
|
309
|
+
// generalize re-quantifies them and consumers see a usable
|
|
310
|
+
// signature even when the body had a unification error.
|
|
311
|
+
const scrubbedType = scrubErrorWithFreshVars(applied.type);
|
|
312
|
+
const resolvedScheme = (0, env_1.generalize)(baseEnv, scrubbedType);
|
|
313
|
+
const boundSet = new Set(resolvedScheme.vars);
|
|
314
|
+
for (const v of scheme.vars) {
|
|
315
|
+
if (!boundSet.has(v))
|
|
316
|
+
resolvedScheme.vars.push(v);
|
|
317
|
+
}
|
|
318
|
+
// `generalize` produces a fresh Scheme with only `vars` and `type` —
|
|
319
|
+
// preserve the original scheme's metadata (constraints, narrowing
|
|
320
|
+
// predicates, conditional-return narrowing, curry markers) so the
|
|
321
|
+
// exported scheme behaves identically at the import site.
|
|
322
|
+
if (applied.constraints && applied.constraints.length > 0) {
|
|
323
|
+
resolvedScheme.constraints = applied.constraints;
|
|
324
|
+
const reps = repsForConstraints(engine, applied.constraints);
|
|
325
|
+
if (reps.length > 0)
|
|
326
|
+
resolvedScheme.reps = reps;
|
|
327
|
+
}
|
|
328
|
+
if (applied.typePredicate)
|
|
329
|
+
resolvedScheme.typePredicate = applied.typePredicate;
|
|
330
|
+
if (applied.conditionalReturn)
|
|
331
|
+
resolvedScheme.conditionalReturn = applied.conditionalReturn;
|
|
332
|
+
if (applied.optionalParamSlots && applied.optionalParamSlots.length > 0) {
|
|
333
|
+
resolvedScheme.optionalParamSlots = applied.optionalParamSlots.slice();
|
|
334
|
+
}
|
|
335
|
+
if (engine.curryFunctionNames.has(name))
|
|
336
|
+
resolvedScheme.isCurryWrapper = true;
|
|
337
|
+
if (engine.curryNFunctionNames.has(name))
|
|
338
|
+
resolvedScheme.curryLeadingArgs = engine.curryNFunctionNames.get(name);
|
|
339
|
+
if (scheme.isCurriedResult)
|
|
340
|
+
resolvedScheme.isCurriedResult = true;
|
|
341
|
+
exportMap.set(name, resolvedScheme);
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
// Fallback: `exports.X = expr` (CommonJS) where X is not bound in env
|
|
345
|
+
const cjsType = engine.cjsExportTypes.get(name);
|
|
346
|
+
// Annotation-authoritative, same as declarations above: `// X :: T`
|
|
347
|
+
// followed by `exports.X = expr` exports T verbatim (with its
|
|
348
|
+
// constraints), not the inferred implementation type.
|
|
349
|
+
const cjsAnn = cjsType ? engine.annotationMap.get(name) : undefined;
|
|
350
|
+
if (cjsType && cjsAnn && cjsAnn.scheme && !cjsAnn.receiver && (0, commentParser_1.isLocalAnnotation)(cjsAnn)) {
|
|
351
|
+
const annScheme = cjsAnn.scheme;
|
|
352
|
+
const exportedScheme = { vars: annScheme.vars.slice(), type: annScheme.type };
|
|
353
|
+
if (annScheme.constraints && annScheme.constraints.length > 0) {
|
|
354
|
+
exportedScheme.constraints = annScheme.constraints.slice();
|
|
355
|
+
const reps = repsForConstraints(engine, exportedScheme.constraints);
|
|
356
|
+
if (reps.length > 0)
|
|
357
|
+
exportedScheme.reps = reps;
|
|
358
|
+
}
|
|
359
|
+
copyNarrowingMetadata(annScheme, exportedScheme);
|
|
360
|
+
exportMap.set(name, exportedScheme);
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
if (cjsType) {
|
|
364
|
+
const resolvedType = scrubErrorWithFreshVars(engine.subst.apply(cjsType));
|
|
365
|
+
exportMap.set(name, (0, env_1.generalize)(baseEnv, resolvedType));
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (engine.defaultExportName) {
|
|
369
|
+
const fields = {};
|
|
370
|
+
const prefix = engine.defaultExportName + '.';
|
|
371
|
+
for (const [annName, ann] of engine.annotationMap) {
|
|
372
|
+
if (annName.startsWith(prefix) && ann.scheme) {
|
|
373
|
+
if (ann.receiver)
|
|
374
|
+
continue;
|
|
375
|
+
const propName = annName.slice(prefix.length);
|
|
376
|
+
fields[propName] = (0, env_1.instantiate)(ann.scheme);
|
|
377
|
+
if (!exportMap.has(propName))
|
|
378
|
+
exportMap.set(propName, ann.scheme);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// Unannotated static factories assigned to the default export
|
|
382
|
+
// (e.g. `Response.Redirect = _Redirect;` with no `// Response.Redirect ::`
|
|
383
|
+
// annotation). Export the inferred function type so a consumer that
|
|
384
|
+
// destructures `const { Redirect } = Response` sees the real signature
|
|
385
|
+
// instead of falling back to a fresh type variable. Explicit
|
|
386
|
+
// annotations (collected above) take precedence.
|
|
387
|
+
const staticMembers = engine.staticMemberTypes.get(engine.defaultExportName);
|
|
388
|
+
if (staticMembers) {
|
|
389
|
+
for (const [propName, propType] of staticMembers) {
|
|
390
|
+
if (propName in fields || exportMap.has(propName))
|
|
391
|
+
continue;
|
|
392
|
+
const resolved = scrubErrorWithFreshVars(engine.subst.apply(propType));
|
|
393
|
+
const memberScheme = (0, env_1.generalize)(baseEnv, resolved);
|
|
394
|
+
fields[propName] = (0, env_1.instantiate)(memberScheme);
|
|
395
|
+
exportMap.set(propName, memberScheme);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
// Is the default identifier itself callable? A default export like
|
|
399
|
+
// `module.exports = _Id` where `_Id :: a -> Id a` PLUS static props
|
|
400
|
+
// `_Id.of` / `_Id.chainRec` must stay callable in the consumer —
|
|
401
|
+
// exporting a bare `{ of, chainRec, name }` record would make the
|
|
402
|
+
// importer's `Id(x)` call fail ("not callable"). The static props
|
|
403
|
+
// remain reachable via their own named exports (set above) and the
|
|
404
|
+
// static-method registry, so we drop the record and fall through to
|
|
405
|
+
// the callable annotation-authoritative branch below.
|
|
406
|
+
let defaultIsCallable = false;
|
|
407
|
+
const defAnn = engine.annotationMap.get(engine.defaultExportName);
|
|
408
|
+
if (defAnn && defAnn.scheme && !defAnn.receiver && (0, commentParser_1.isLocalAnnotation)(defAnn)) {
|
|
409
|
+
const t = defAnn.scheme.type;
|
|
410
|
+
defaultIsCallable = t.tag === 'TFun' || (0, types_1.isAppliedFunction)(t);
|
|
411
|
+
}
|
|
412
|
+
if (!defaultIsCallable) {
|
|
413
|
+
const envScheme = finalEnv.lookup(engine.defaultExportName);
|
|
414
|
+
if (envScheme) {
|
|
415
|
+
const t = engine.subst.apply(envScheme.type);
|
|
416
|
+
defaultIsCallable = t.tag === 'TFun' || (0, types_1.isAppliedFunction)(t);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (Object.keys(fields).length > 0 && !defaultIsCallable) {
|
|
420
|
+
const recordType = (0, types_1.tRecord)(fields);
|
|
421
|
+
const scheme = (0, env_1.generalize)(baseEnv, recordType);
|
|
422
|
+
exportMap.set('default', scheme);
|
|
423
|
+
}
|
|
424
|
+
else if (!exportMap.has('default')) {
|
|
425
|
+
const identScheme = finalEnv.lookup(engine.defaultExportName);
|
|
426
|
+
if (identScheme) {
|
|
427
|
+
// Annotation-authoritative default export: when the chosen
|
|
428
|
+
// identifier has an explicit user annotation IN THIS FILE,
|
|
429
|
+
// export the annotation scheme verbatim (mirrors the named-
|
|
430
|
+
// export branch above). Applying `engine.subst` to the
|
|
431
|
+
// identScheme.type would leak body unification bindings into
|
|
432
|
+
// the consumer's view — and `generalize` then drops the
|
|
433
|
+
// polymorphic vars because the body bound them, producing a
|
|
434
|
+
// monomorphic scheme that exposes raw scheme TVar ids (e.g.
|
|
435
|
+
// chain's `m@6`) to the importer. The `isLocalAnnotation`
|
|
436
|
+
// guard prevents merged sidecar / globals / `::types`
|
|
437
|
+
// annotations (e.g. query-builder.hm's `default :: ...`) from
|
|
438
|
+
// accidentally overwriting an unrelated default export.
|
|
439
|
+
const ann = engine.annotationMap.get(engine.defaultExportName);
|
|
440
|
+
if (ann && ann.scheme && !ann.receiver && (0, commentParser_1.isLocalAnnotation)(ann)) {
|
|
441
|
+
const annScheme = ann.scheme;
|
|
442
|
+
const exportedScheme = {
|
|
443
|
+
vars: annScheme.vars.slice(),
|
|
444
|
+
type: annScheme.type,
|
|
445
|
+
};
|
|
446
|
+
if (annScheme.constraints && annScheme.constraints.length > 0) {
|
|
447
|
+
exportedScheme.constraints = annScheme.constraints.slice();
|
|
448
|
+
const reps = repsForConstraints(engine, exportedScheme.constraints);
|
|
449
|
+
if (reps.length > 0)
|
|
450
|
+
exportedScheme.reps = reps;
|
|
451
|
+
}
|
|
452
|
+
copyNarrowingMetadata(identScheme, exportedScheme);
|
|
453
|
+
if (identScheme.isCurriedResult)
|
|
454
|
+
exportedScheme.isCurriedResult = true;
|
|
455
|
+
if (identScheme.isCurryWrapper || engine.curryFunctionNames.has(engine.defaultExportName)) {
|
|
456
|
+
exportedScheme.isCurryWrapper = true;
|
|
457
|
+
}
|
|
458
|
+
{
|
|
459
|
+
const n = identScheme.curryLeadingArgs ?? engine.curryNFunctionNames.get(engine.defaultExportName);
|
|
460
|
+
if (n)
|
|
461
|
+
exportedScheme.curryLeadingArgs = n;
|
|
462
|
+
}
|
|
463
|
+
exportMap.set('default', exportedScheme);
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
const appliedDefault = (0, env_1.applySubstToScheme)(engine.subst, identScheme);
|
|
467
|
+
const resolvedType = scrubErrorWithFreshVars(appliedDefault.type);
|
|
468
|
+
const resolvedScheme = (0, env_1.generalize)(baseEnv, resolvedType);
|
|
469
|
+
if (appliedDefault.constraints && appliedDefault.constraints.length > 0) {
|
|
470
|
+
resolvedScheme.constraints = appliedDefault.constraints;
|
|
471
|
+
const reps = repsForConstraints(engine, appliedDefault.constraints);
|
|
472
|
+
if (reps.length > 0)
|
|
473
|
+
resolvedScheme.reps = reps;
|
|
474
|
+
}
|
|
475
|
+
copyNarrowingMetadata(appliedDefault, resolvedScheme);
|
|
476
|
+
if (identScheme.isCurriedResult)
|
|
477
|
+
resolvedScheme.isCurriedResult = true;
|
|
478
|
+
if (identScheme.isCurryWrapper || engine.curryFunctionNames.has(engine.defaultExportName)) {
|
|
479
|
+
resolvedScheme.isCurryWrapper = true;
|
|
480
|
+
}
|
|
481
|
+
{
|
|
482
|
+
const n = identScheme.curryLeadingArgs ?? engine.curryNFunctionNames.get(engine.defaultExportName);
|
|
483
|
+
if (n)
|
|
484
|
+
resolvedScheme.curryLeadingArgs = n;
|
|
485
|
+
}
|
|
486
|
+
exportMap.set('default', resolvedScheme);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
// CommonJS `module.exports = { … }`: for ESM interop (Node, Babel) the
|
|
492
|
+
// default import IS the module.exports object — `import nr from "FP-library";
|
|
493
|
+
// nr.RTask` — so expose the object's record type as `default`.
|
|
494
|
+
if (!exportMap.has('default') && engine.cjsObjectExportType) {
|
|
495
|
+
const resolvedType = scrubErrorWithFreshVars(engine.subst.apply(engine.cjsObjectExportType));
|
|
496
|
+
if (resolvedType.tag === 'TRecord')
|
|
497
|
+
exportMap.set('default', (0, env_1.generalize)(baseEnv, resolvedType));
|
|
498
|
+
}
|
|
499
|
+
// Same for `exports.X = …` / `module.exports.X = …` modules: the default
|
|
500
|
+
// import is the exports object, i.e. the record of the named exports.
|
|
501
|
+
if (!exportMap.has('default') && engine.usesCjsExports && exportMap.size > 0) {
|
|
502
|
+
exportMap.set('default', (0, env_1.generalize)(baseEnv, (0, helpers_1.exportsToRecord)(exportMap)));
|
|
503
|
+
}
|
|
504
|
+
return exportMap;
|
|
505
|
+
}
|
|
506
|
+
function buildTopLevelBindings(engine, finalEnv, baseEnv) {
|
|
507
|
+
const topLevelBindings = new Map();
|
|
508
|
+
for (const [name, sch] of finalEnv.entries()) {
|
|
509
|
+
if (!baseEnv.lookup(name)) {
|
|
510
|
+
topLevelBindings.set(name, {
|
|
511
|
+
...sch,
|
|
512
|
+
type: engine.applyConstraintConstructorRewrites(engine.subst.apply(sch.type)),
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return topLevelBindings;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* For every JS identifier whose name matches a registered sumtype
|
|
520
|
+
* (e.g. `function Maybe`, `class Either`, `const Param = {}`), override
|
|
521
|
+
* its type with the variant union (`Just a | Nothing`, `Left e | Right a`,
|
|
522
|
+
* `Path | Query`). This makes hover surface the sumtype's variant union
|
|
523
|
+
* instead of the inferred class/object/function shape. Static methods
|
|
524
|
+
* (e.g. `Either.of`) keep working because static lookup resolves by
|
|
525
|
+
* identifier name through the method registry, not by env binding type.
|
|
526
|
+
*/
|
|
527
|
+
function overrideSumtypeIdentifierTypes(engine, source, topLevelBindings) {
|
|
528
|
+
const buildUnion = (typeName) => {
|
|
529
|
+
const dt = (0, dataTypeRegistry_1.getDataType)(typeName);
|
|
530
|
+
if (!dt)
|
|
531
|
+
return null;
|
|
532
|
+
const args = dt.decl.typeVars.map(() => (0, types_1.tVar)());
|
|
533
|
+
const variantTypes = dt.decl.variants.map(v => {
|
|
534
|
+
const vArgs = v.fields.map(f => {
|
|
535
|
+
// Fast path: a bare type-variable field maps directly to its slot.
|
|
536
|
+
const idx = dt.decl.typeVars.indexOf(f);
|
|
537
|
+
if (idx >= 0)
|
|
538
|
+
return args[idx];
|
|
539
|
+
// Complex field (record `{...}` or parenthesized application):
|
|
540
|
+
// map it to the first parent type variable it references so the
|
|
541
|
+
// sum type's parametricity surfaces in hover. Falls back to a
|
|
542
|
+
// fresh var when the field is fully concrete.
|
|
543
|
+
for (const ref of (0, commentParser_1.fieldTypeVars)(f)) {
|
|
544
|
+
const refIdx = dt.decl.typeVars.indexOf(ref);
|
|
545
|
+
if (refIdx >= 0)
|
|
546
|
+
return args[refIdx];
|
|
547
|
+
}
|
|
548
|
+
return (0, types_1.tVar)();
|
|
549
|
+
});
|
|
550
|
+
return (0, types_1.tCon)(v.name, vArgs);
|
|
551
|
+
});
|
|
552
|
+
return (0, types_1.tUnion)(variantTypes);
|
|
553
|
+
};
|
|
554
|
+
for (const [name] of topLevelBindings) {
|
|
555
|
+
if (!(0, dataTypeRegistry_1.isDataType)(name))
|
|
556
|
+
continue;
|
|
557
|
+
const overrideType = buildUnion(name);
|
|
558
|
+
if (!overrideType)
|
|
559
|
+
continue;
|
|
560
|
+
topLevelBindings.set(name, { vars: [], type: overrideType });
|
|
561
|
+
// Override every nodeTypes entry whose start offset begins with the
|
|
562
|
+
// identifier `name` as a complete word. This captures both bare
|
|
563
|
+
// identifier nodes (`Param` in `Param.Path = ...`) and binding
|
|
564
|
+
// declaration nodes (`const Param = {}`, `function Maybe() {...}`,
|
|
565
|
+
// `class Either {...}`) which all start at the identifier token.
|
|
566
|
+
const re = new RegExp(`\\b${name}\\b`, 'g');
|
|
567
|
+
const ids = new Set();
|
|
568
|
+
let m;
|
|
569
|
+
while ((m = re.exec(source)) !== null)
|
|
570
|
+
ids.add(m.index);
|
|
571
|
+
for (const [s, entry] of engine.nodeTypes) {
|
|
572
|
+
if (!ids.has(s))
|
|
573
|
+
continue;
|
|
574
|
+
// Only override when the existing entry doesn't already represent
|
|
575
|
+
// a TFun that returns the parent sumtype's variant — those are
|
|
576
|
+
// legitimate variant constructors (e.g. `Just :: a -> Maybe a`)
|
|
577
|
+
// that happen to live next to a bare identifier of the parent
|
|
578
|
+
// name. Identifier text starts at `name` exactly: skip variant
|
|
579
|
+
// names, which are guarded above by `isDataType` (variants are
|
|
580
|
+
// not data types themselves).
|
|
581
|
+
engine.nodeTypes.set(s, { type: overrideType, end: entry.end });
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function postProcessConstraintRewrites(engine) {
|
|
586
|
+
if (engine.constraintConstructorRewrites.length === 0)
|
|
587
|
+
return;
|
|
588
|
+
for (const [offset, entry] of engine.nodeTypes) {
|
|
589
|
+
const resolved = engine.subst.apply(entry.type);
|
|
590
|
+
const rewritten = engine.applyConstraintConstructorRewrites(resolved);
|
|
591
|
+
if (rewritten !== resolved) {
|
|
592
|
+
engine.nodeTypes.set(offset, { type: rewritten, end: entry.end });
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
const stringRewrites = engine.constraintConstructorRewrites.map(rw => ({
|
|
596
|
+
from: (0, types_1.typeToString)(rw.from),
|
|
597
|
+
to: (0, types_1.typeToString)(rw.to),
|
|
598
|
+
}));
|
|
599
|
+
for (const diag of engine.diagnostics) {
|
|
600
|
+
for (const sr of stringRewrites) {
|
|
601
|
+
const paren = `(${sr.from})`;
|
|
602
|
+
if (diag.message.includes(paren)) {
|
|
603
|
+
diag.message = diag.message.split(paren).join(sr.to);
|
|
604
|
+
}
|
|
605
|
+
if (diag.message.includes(sr.from)) {
|
|
606
|
+
diag.message = diag.message.split(sr.from).join(sr.to);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../src/infer/results.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,yEAAyE;AACzE,EAAE;AACF,sEAAsE;AACtE,6EAA6E;AAC7E,4EAA4E;AAC5E,gCAAgC;AAChC,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,uEAAuE;AACvE,+EAA+E;;AAsH/E,kCAoCC;AA4FD,wCAiOC;AAED,sDAWC;AAWD,wEAuDC;AAED,sEA0BC;AAhkBD,uCAA4C;AAE5C,uCAYqB;AACrB,mCAAiF;AACjF,oDAAoE;AACpE,yEAAiG;AACjG,qEAA0F;AAC1F,+CAAqD;AACrD,+CAAyD;AACzD,uCAAuC;AAGvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAS,gCAAgC,CAAC,MAAuB;IAC/D,MAAM,GAAG,GAAG,MAAM,CAAC,aAAa,CAAC;IACjC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO;IAE3B,MAAM,UAAU,GAAG,CAAC,EAAU,EAAU,EAAE;QACxC,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,SAAS,CAAC;YACR,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,GAAG,CAAC;YAC9B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACvC,IAAI,CAAC,KAAK;gBAAE,OAAO,GAAG,CAAC;YACvB,IAAI,KAAK,CAAC,GAAG,KAAK,MAAM,EAAE,CAAC;gBACzB,IAAI,KAAK,CAAC,EA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AAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InferenceEngine } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* Run the pre-inference annotation/directive setup pass: build annotation
|
|
4
|
+
* maps (merging project globals), report annotation parse errors, process
|
|
5
|
+
* `::constraint` / `::data` / `::types` / `::rep` / curry directives,
|
|
6
|
+
* pre-resolve imports (aliases, constructors, instance-callables, reps),
|
|
7
|
+
* validate orphan/duplicate/unknown annotations, and bake constructor-style
|
|
8
|
+
* constraints into the annotation types. Mutates engine state in place.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runAnnotationSetup(engine: InferenceEngine, source: string): void;
|
|
11
|
+
//# sourceMappingURL=setupPass.d.ts.map
|