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,542 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Annotation rigid checking — rigid skolem comparison of inferred types
|
|
4
|
+
// against polymorphic annotations, plus diagnostic narrowing helpers
|
|
5
|
+
// (split from annotations.ts; verbatim moves)
|
|
6
|
+
//
|
|
7
|
+
// Plain language: an annotation like `f :: a -> a` is a PROMISE — "f works
|
|
8
|
+
// for any type the caller picks". To verify it, the checker replaces `a`
|
|
9
|
+
// with an untouchable made-up type (a *skolem*, rendered `§N`) and re-checks
|
|
10
|
+
// the function body. If the body secretly assumes `a` is e.g. Number, the
|
|
11
|
+
// skolem refuses to match and the broken promise is reported. "Rigid" means
|
|
12
|
+
// the variable is not allowed to bend to what the body wants.
|
|
13
|
+
// ============================================================================
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.maybeRigidCheck = maybeRigidCheck;
|
|
16
|
+
exports.hasUnknownTConDiagForScheme = hasUnknownTConDiagForScheme;
|
|
17
|
+
exports.narrowToIdentifier = narrowToIdentifier;
|
|
18
|
+
exports.bindingNameFromNode = bindingNameFromNode;
|
|
19
|
+
exports.annotationMismatchMessage = annotationMismatchMessage;
|
|
20
|
+
exports.shouldSuppressMismatch = shouldSuppressMismatch;
|
|
21
|
+
exports.methodNameMismatchMessage = methodNameMismatchMessage;
|
|
22
|
+
exports.checkAnnotationRigid = checkAnnotationRigid;
|
|
23
|
+
exports.usesLenientArrowCheck = usesLenientArrowCheck;
|
|
24
|
+
const types_1 = require("../hm/types");
|
|
25
|
+
const env_1 = require("../hm/env");
|
|
26
|
+
const unify_1 = require("../hm/unify");
|
|
27
|
+
const typeUtils_1 = require("../hm/typeUtils");
|
|
28
|
+
const types_2 = require("../hm/types");
|
|
29
|
+
const types_3 = require("../hm/types");
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Context interface for methods that need engine state
|
|
32
|
+
const annotations_1 = require("./annotations");
|
|
33
|
+
const annotation_validation_1 = require("./annotation-validation");
|
|
34
|
+
/**
|
|
35
|
+
* Decide whether to run a rigid annotation check for a polymorphic scheme,
|
|
36
|
+
* and run it if appropriate. Skips when:
|
|
37
|
+
* - The annotation uses spread types (which can cause false positives)
|
|
38
|
+
* - A body-level return-type mismatch was already reported
|
|
39
|
+
* - The return type contains quantified vars (constructor pattern)
|
|
40
|
+
* and the scheme is unconstrained — UNLESS there is a parameter shape
|
|
41
|
+
* mismatch (curried vs tuple), which is always a structural error.
|
|
42
|
+
*/
|
|
43
|
+
function maybeRigidCheck(ctx, inferredType, annScheme, node) {
|
|
44
|
+
// Skip when the annotation references unknown type constructors — any
|
|
45
|
+
// mismatch is a consequence of the missing definition, not a real error.
|
|
46
|
+
if (hasUnknownTConDiagForScheme(ctx.diagnostics, annScheme))
|
|
47
|
+
return;
|
|
48
|
+
// Skip spread-annotated functions: both spread-TUPLE params
|
|
49
|
+
// (`((a, b, ...) -> z) -> …`) and spread ARROW CHAINS
|
|
50
|
+
// (`(a -> b -> ... -> z) -> …`). The `...` marker makes these annotations
|
|
51
|
+
// intentionally variadic, so rigid structural matching against a concrete
|
|
52
|
+
// inferred body would produce spurious mismatches.
|
|
53
|
+
if (annScheme.type.tag === 'TFun' && ((0, typeUtils_1.isSpreadTupleOrArray)(annScheme.type.param) ||
|
|
54
|
+
(0, typeUtils_1.hasSpreadInArrowChain)(annScheme.type.param) ||
|
|
55
|
+
(annScheme.type.param.tag === 'TFun' && (0, typeUtils_1.isSpreadTupleOrArray)(annScheme.type.param.param))))
|
|
56
|
+
return;
|
|
57
|
+
// Skip if a body-level return-type mismatch diagnostic already exists
|
|
58
|
+
if (ctx.diagnostics.some(d => d.message.startsWith('Type mismatch:')))
|
|
59
|
+
return;
|
|
60
|
+
// Always run the rigid check when the parameter shape (curried vs tuple)
|
|
61
|
+
// differs between annotation and inferred type — this is a structural
|
|
62
|
+
// mismatch regardless of whether the return type is polymorphic.
|
|
63
|
+
const resolvedInferred = ctx.subst.apply(inferredType);
|
|
64
|
+
// Kind-level mismatch between an annotation and a function value. Only
|
|
65
|
+
// meaningful when the value is actually a function.
|
|
66
|
+
if (resolvedInferred.tag === 'TFun') {
|
|
67
|
+
const annType = annScheme.type;
|
|
68
|
+
// Overloaded annotation (a Union of function branches): the body must
|
|
69
|
+
// match AT LEAST ONE branch. Report only when none of them match.
|
|
70
|
+
if (annType.tag === 'TCon' && annType.name === types_1.T_UNION
|
|
71
|
+
&& annType.args.length >= 2
|
|
72
|
+
&& annType.args.every(b => b.tag === 'TFun')) {
|
|
73
|
+
const branches = annType.args;
|
|
74
|
+
// An overloaded implementation typically returns DIFFERENT values in
|
|
75
|
+
// different code paths, each satisfying a DIFFERENT overload branch
|
|
76
|
+
// (e.g. `concat` returns an array in one path and an object in
|
|
77
|
+
// another). So the body is valid when every distinct value it can
|
|
78
|
+
// return is accepted by AT LEAST ONE branch's result type — not when
|
|
79
|
+
// the whole function matches a single branch.
|
|
80
|
+
const actualReturn = ctx.subst.apply((0, types_1.getReturnType)(resolvedInferred));
|
|
81
|
+
const actualMembers = (0, types_1.isUnion)(actualReturn) ? actualReturn.args : [actualReturn];
|
|
82
|
+
const allCovered = actualMembers.every(member => branches.some(branch => rigidReturnMatches(ctx, member, { vars: annScheme.vars, type: (0, types_1.getReturnType)(branch) })));
|
|
83
|
+
if (!allCovered) {
|
|
84
|
+
ctx.addDiag(`Function body matches none of the ${branches.length} overload signatures: `
|
|
85
|
+
+ branches.map(b => (0, types_1.prettyTypeToString)(b)).join('; '), narrowToIdentifier(node));
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// The value is a function but the annotation is a concrete, non-function
|
|
90
|
+
// data type (e.g. `f :: Array a`). Route to the rigid check, which
|
|
91
|
+
// unifies the two and emits the standard mismatch message.
|
|
92
|
+
if (isConcreteNonFunctionAnnotation(ctx, annType)) {
|
|
93
|
+
checkAnnotationRigid(ctx, inferredType, annScheme, node);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if ((0, annotation_validation_1.hasParamShapeMismatch)(annScheme.type, resolvedInferred)) {
|
|
98
|
+
checkAnnotationRigid(ctx, inferredType, annScheme, node);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const hasConstraints = annScheme.constraints && annScheme.constraints.length > 0;
|
|
102
|
+
if (hasConstraints) {
|
|
103
|
+
checkAnnotationRigid(ctx, inferredType, annScheme, node);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
const returnType = (0, types_1.getReturnType)(annScheme.type);
|
|
107
|
+
if (!(0, typeUtils_1.containsQuantifiedVar)(returnType, new Set(annScheme.vars))) {
|
|
108
|
+
checkAnnotationRigid(ctx, inferredType, annScheme, node);
|
|
109
|
+
}
|
|
110
|
+
else if ((0, annotation_validation_1.hasStructuralMismatch)(annScheme.type, resolvedInferred)) {
|
|
111
|
+
// Return type has quantified vars — skip full rigid check to avoid
|
|
112
|
+
// false positives from wildcards, BUT still catch clear structural
|
|
113
|
+
// mismatches (wrong return TCon, param count difference, etc.).
|
|
114
|
+
checkAnnotationRigid(ctx, inferredType, annScheme, node);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Check, in isolation, whether a single value the body can return is accepted
|
|
120
|
+
* by one overload branch's result type. The branch's result is instantiated
|
|
121
|
+
* with FRESH flexible variables so its polymorphic positions can absorb the
|
|
122
|
+
* concrete value (e.g. branch result `{ ...a, ...b }` accepts an empty `{}`).
|
|
123
|
+
* Used to implement "every body return must satisfy at least one overload".
|
|
124
|
+
*/
|
|
125
|
+
function rigidReturnMatches(ctx, actualMember, branchReturnScheme) {
|
|
126
|
+
const freshReturn = (0, env_1.instantiate)(branchReturnScheme);
|
|
127
|
+
const expected = (0, annotations_1.expandAliases)(ctx.typeAliases, freshReturn, undefined, ctx.aliasVars);
|
|
128
|
+
const actual = (0, annotations_1.expandAliases)(ctx.typeAliases, ctx.subst.apply(actualMember), undefined, ctx.aliasVars);
|
|
129
|
+
if ((0, types_1.containsErrorType)(actual) || (0, types_1.containsErrorType)(expected))
|
|
130
|
+
return true;
|
|
131
|
+
// A branch whose result is an OPEN / merged record (`{ ...a, ...b }`,
|
|
132
|
+
// `{ x :: T, ...r }`) accepts any object the body produces — the row
|
|
133
|
+
// variables can absorb (or be) whatever fields are present, including an
|
|
134
|
+
// empty object. So treat any record-valued body return as matching such a
|
|
135
|
+
// branch directly (plain unification can't reduce a `Merge` marker).
|
|
136
|
+
if (actual.tag === 'TRecord' && isOpenOrMergeRecord(expected))
|
|
137
|
+
return true;
|
|
138
|
+
try {
|
|
139
|
+
(0, unify_1.unify)(actual, expected);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
if (e instanceof unify_1.UnificationError)
|
|
144
|
+
return false;
|
|
145
|
+
throw e;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** True when a type is an open record (has a row rest) or a `Merge` marker. */
|
|
149
|
+
function isOpenOrMergeRecord(t) {
|
|
150
|
+
if (t.tag === 'TCon' && t.name === types_1.T_MERGE)
|
|
151
|
+
return true;
|
|
152
|
+
if (t.tag === 'TRecord' && t.rest != null)
|
|
153
|
+
return true;
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* True when `t` is a concrete, non-function data type that a function value
|
|
158
|
+
* could never inhabit (`Array a`, `Number`, `Maybe a`, …). Bare type
|
|
159
|
+
* variables, wildcards, `any`, `Object`, tuples and function types are
|
|
160
|
+
* deliberately excluded so legitimate polymorphic / structural annotations
|
|
161
|
+
* are never flagged.
|
|
162
|
+
*/
|
|
163
|
+
function isConcreteNonFunctionAnnotation(ctx, t) {
|
|
164
|
+
const expanded = (0, annotations_1.expandAliases)(ctx.typeAliases, t, undefined, ctx.aliasVars);
|
|
165
|
+
if (expanded.tag !== 'TCon')
|
|
166
|
+
return false;
|
|
167
|
+
const name = expanded.name;
|
|
168
|
+
if (name === 'Object' || name === types_1.T_UNION)
|
|
169
|
+
return false;
|
|
170
|
+
if ((0, types_1.isWildcard)(expanded) || (0, types_1.isAnyType)(expanded))
|
|
171
|
+
return false;
|
|
172
|
+
if ((0, types_1.isTuple)(expanded))
|
|
173
|
+
return false;
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Replace all wildcard types (* or *:name) with fresh TVars so that
|
|
178
|
+
* the rigid check's unification is not silently bypassed.
|
|
179
|
+
*/
|
|
180
|
+
function stripWildcards(t) {
|
|
181
|
+
return (0, typeUtils_1.mapType)(t, n => (0, types_1.isWildcard)(n) ? (0, types_1.tVar)() : undefined);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Collect all type constructor names referenced in a type.
|
|
185
|
+
*/
|
|
186
|
+
function collectTypeConstructorNames(t, out = new Set()) {
|
|
187
|
+
(0, typeUtils_1.eachType)(t, node => { if (node.tag === 'TCon')
|
|
188
|
+
out.add(node.name); });
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Check whether any existing diagnostic reports an unknown type constructor
|
|
193
|
+
* that appears in the given annotation scheme. When true, further mismatch
|
|
194
|
+
* diagnostics should be suppressed because the type system cannot meaningfully
|
|
195
|
+
* compare types that reference undefined constructors.
|
|
196
|
+
*/
|
|
197
|
+
function hasUnknownTConDiagForScheme(diagnostics, scheme) {
|
|
198
|
+
const tcons = collectTypeConstructorNames(scheme.type);
|
|
199
|
+
return diagnostics.some(d => {
|
|
200
|
+
const m = d.message.match(/Unknown type constructor '([^']+)'/);
|
|
201
|
+
return m != null && tcons.has(m[1]);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Narrow an AST node range to its most relevant identifier. Used by
|
|
206
|
+
* `unifyWithDiagnostic` so that only the function/variable name is
|
|
207
|
+
* underlined red, not the entire expression or declaration.
|
|
208
|
+
*
|
|
209
|
+
* Handles: VariableDeclarator, FunctionDeclaration, CallExpression,
|
|
210
|
+
* MemberExpression, AssignmentExpression, MethodDefinition,
|
|
211
|
+
* and falls back to the node itself.
|
|
212
|
+
*/
|
|
213
|
+
function narrowToIdentifier(node) {
|
|
214
|
+
// VariableDeclarator / FunctionDeclaration / ClassDeclaration → id
|
|
215
|
+
if ('id' in node && node.id && typeof node.id.start === 'number' && typeof node.id.end === 'number') {
|
|
216
|
+
return node.id;
|
|
217
|
+
}
|
|
218
|
+
// MethodDefinition → key (the method name)
|
|
219
|
+
if (node.type === 'MethodDefinition' && node.key
|
|
220
|
+
&& typeof node.key.start === 'number' && typeof node.key.end === 'number') {
|
|
221
|
+
return node.key;
|
|
222
|
+
}
|
|
223
|
+
// CallExpression → callee (or callee.property for member calls)
|
|
224
|
+
if (node.type === 'CallExpression' && node.callee) {
|
|
225
|
+
if (node.callee.type === 'MemberExpression' && node.callee.property
|
|
226
|
+
&& typeof node.callee.property.start === 'number') {
|
|
227
|
+
return node.callee.property;
|
|
228
|
+
}
|
|
229
|
+
return node.callee;
|
|
230
|
+
}
|
|
231
|
+
// AssignmentExpression → left identifier or left.property
|
|
232
|
+
if (node.type === 'AssignmentExpression' && node.left) {
|
|
233
|
+
if (node.left.type === 'MemberExpression' && node.left.property
|
|
234
|
+
&& typeof node.left.property.start === 'number') {
|
|
235
|
+
return node.left.property;
|
|
236
|
+
}
|
|
237
|
+
if (node.left.type === 'Identifier')
|
|
238
|
+
return node.left;
|
|
239
|
+
}
|
|
240
|
+
// MemberExpression → property
|
|
241
|
+
if (node.type === 'MemberExpression' && node.property
|
|
242
|
+
&& typeof node.property.start === 'number') {
|
|
243
|
+
return node.property;
|
|
244
|
+
}
|
|
245
|
+
// ConditionalExpression → underline the whole ternary.
|
|
246
|
+
// Narrowing to `node.test` would point at the boolean condition (e.g.
|
|
247
|
+
// `flag ? a : b` → `flag`), which has nothing to do with the type of
|
|
248
|
+
// the expression's value. The whole ternary is the honest source.
|
|
249
|
+
if (node.type === 'ConditionalExpression'
|
|
250
|
+
&& typeof node.start === 'number' && typeof node.end === 'number') {
|
|
251
|
+
return { start: node.start, end: node.end };
|
|
252
|
+
}
|
|
253
|
+
// ArrowFunctionExpression / FunctionExpression → parameter list (signature),
|
|
254
|
+
// not the entire body. Keeps "Cannot unify" diagnostics on the function
|
|
255
|
+
// signature instead of underlining a multi-line block.
|
|
256
|
+
if (node.type === 'ArrowFunctionExpression' || node.type === 'FunctionExpression') {
|
|
257
|
+
const params = node.params;
|
|
258
|
+
if (params && params.length > 0) {
|
|
259
|
+
const first = params[0];
|
|
260
|
+
const last = params[params.length - 1];
|
|
261
|
+
if (typeof first.start === 'number' && typeof last.end === 'number') {
|
|
262
|
+
return { start: first.start, end: last.end };
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// No params (or unparseable): underline just up to the body start.
|
|
266
|
+
const body = node.body;
|
|
267
|
+
if (body && typeof node.start === 'number' && typeof body.start === 'number'
|
|
268
|
+
&& body.start > node.start) {
|
|
269
|
+
return { start: node.start, end: body.start };
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return node;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Extract the binding identifier name from common AST nodes that introduce
|
|
276
|
+
* an annotation (variable declarators, function declarations, methods).
|
|
277
|
+
* Used to build user-friendly diagnostic messages that mention the symbol
|
|
278
|
+
* by name instead of using generic phrasing.
|
|
279
|
+
*/
|
|
280
|
+
function bindingNameFromNode(node) {
|
|
281
|
+
if ('id' in node && node.id && node.id.type === 'Identifier') {
|
|
282
|
+
return node.id.name;
|
|
283
|
+
}
|
|
284
|
+
if (node.type === 'MethodDefinition' && node.key && node.key.type === 'Identifier') {
|
|
285
|
+
return node.key.name;
|
|
286
|
+
}
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Unified diagnostic message for any kind of annotation-vs-implementation
|
|
291
|
+
* mismatch (full-type mismatch, return-type union mismatch, rigid check
|
|
292
|
+
* failure, ...). Using one consistent template across emit sites makes
|
|
293
|
+
* the diagnostics easier to scan and to filter on.
|
|
294
|
+
*/
|
|
295
|
+
function annotationMismatchMessage(name, inferred, expected) {
|
|
296
|
+
const subject = name ? `'${name}'` : 'value';
|
|
297
|
+
const [inf, exp] = (0, types_1.prettyTypeToStringPair)(inferred, expected);
|
|
298
|
+
return `Type mismatch: ${subject} has type '${inf}' but annotation expects '${exp}'`;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Should an annotation-mismatch diagnostic be SUPPRESSED? Returns true
|
|
302
|
+
* when either the inferred or expected type contains the `$error`
|
|
303
|
+
* sentinel — those types are produced by error recovery (poisoned free
|
|
304
|
+
* type variables after a failed unification) and reporting them only
|
|
305
|
+
* cascades the original root-cause diagnostic into noise.
|
|
306
|
+
*
|
|
307
|
+
* The `$error` sentinel never appears in user-written annotations or in
|
|
308
|
+
* a clean inference run, so suppressing is safe: a real mismatch always
|
|
309
|
+
* has a clean type on at least one side... wait, NO — both sides can be
|
|
310
|
+
* polluted simultaneously. Skip if EITHER side is polluted.
|
|
311
|
+
*/
|
|
312
|
+
function shouldSuppressMismatch(inferred, expected) {
|
|
313
|
+
return (0, types_1.containsErrorType)(inferred) || (0, types_1.containsErrorType)(expected);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Diagnostic message for a method-name mismatch between a declared
|
|
317
|
+
* member and its preceding annotation (e.g. `// foo :: …` over `bar() {}`).
|
|
318
|
+
*/
|
|
319
|
+
function methodNameMismatchMessage(methodName, annotationName) {
|
|
320
|
+
return `Method name '${methodName}' does not match annotation '${annotationName}'`;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Does the annotation contain a chain-container / bare arrow-chain tuple —
|
|
324
|
+
* `(a -> b, b -> c, ..., y -> z)` (possibly wrapped in a container
|
|
325
|
+
* `f (a -> b, ..., y -> z)`)? Such combinators (pipe / compose over a
|
|
326
|
+
* Foldable) legitimately infer an *endomorphic collapse* of the chain in
|
|
327
|
+
* their body — a standard `reduce`/apply fold cannot express the full
|
|
328
|
+
* heterogeneous `a -> z` — so the rigid check would spuriously report the
|
|
329
|
+
* body as "less polymorphic than the annotation". When the annotation uses
|
|
330
|
+
* this pattern we trust the declared signature and skip the rigid mismatch.
|
|
331
|
+
*/
|
|
332
|
+
function annotationHasArrowChainTuple(t) {
|
|
333
|
+
let found = false;
|
|
334
|
+
(0, typeUtils_1.eachType)(t, n => {
|
|
335
|
+
if (found)
|
|
336
|
+
return;
|
|
337
|
+
if ((0, typeUtils_1.isArrowChainTuple)(n))
|
|
338
|
+
found = true;
|
|
339
|
+
});
|
|
340
|
+
return found;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Check that the inferred type is compatible with an annotation scheme
|
|
344
|
+
* using rigid (skolem) type variables. This catches cases where the
|
|
345
|
+
* implementation is *less* polymorphic than the annotation claims.
|
|
346
|
+
*
|
|
347
|
+
* The check runs in isolation — it does NOT affect the main substitution.
|
|
348
|
+
*/
|
|
349
|
+
function checkAnnotationRigid(ctx, inferredType, annotationScheme, node) {
|
|
350
|
+
// The inferred type may still carry rigid skolems (`§N`) that were minted
|
|
351
|
+
// while checking an annotated body. They must be scrubbed back to ordinary
|
|
352
|
+
// display variables before the comparison: a body skolem can never unify
|
|
353
|
+
// with the fresh rigid skolem this check mints from the annotation, which
|
|
354
|
+
// would otherwise emit a spurious "value has type X but annotation expects
|
|
355
|
+
// X" self-mismatch. Genuine body/return shape differences survive the
|
|
356
|
+
// scrub (e.g. a stub returning `()` instead of a variable) and still report.
|
|
357
|
+
inferredType = (0, typeUtils_1.scrubSkolems)(inferredType, ctx.skolemDisplayNames);
|
|
358
|
+
if (annotationScheme.constraints && annotationScheme.constraints.length > 0) {
|
|
359
|
+
// For applied constraints with TypeRep parameters, the scheme has
|
|
360
|
+
// a bare TVar inside TypeRep (e.g. TypeRep m) while the inferred
|
|
361
|
+
// type has the applied kv-TCon (e.g. TypeRep (m a)). Apply the
|
|
362
|
+
// same fixup to the scheme for consistent rigid comparison.
|
|
363
|
+
// Only for vars from *applied* constraints, not non-applied ones.
|
|
364
|
+
let schemeForRigid = annotationScheme;
|
|
365
|
+
const appliedVarNames = new Set();
|
|
366
|
+
for (const c of annotationScheme.constraints) {
|
|
367
|
+
if (c.isApplied)
|
|
368
|
+
appliedVarNames.add(c.typeVarName);
|
|
369
|
+
}
|
|
370
|
+
const kvApps = new Map();
|
|
371
|
+
(0, typeUtils_1.collectKvApplications)(annotationScheme.type, kvApps);
|
|
372
|
+
// Mirror the instantiation-side pinning rule: only *applied* constraint
|
|
373
|
+
// vars (e.g. `Monoid (m a)`) get their TypeRep param rewritten, and only
|
|
374
|
+
// when the var is kv-applied to a single consistent argument across the
|
|
375
|
+
// type. Non-applied constraint vars stay bare — unifyTypeRep binds a
|
|
376
|
+
// bare `TypeRep f` var to the witness's bare constructor directly.
|
|
377
|
+
const sigByName = new Map();
|
|
378
|
+
// Seed with each applied constraint's OWN application signature
|
|
379
|
+
// (`Setoid (f b)` applies `f` to `b`) — the constraint's app may not
|
|
380
|
+
// occur in the type itself, yet still conflicts with a differing use
|
|
381
|
+
// (interchange's `f (a -> b)`).
|
|
382
|
+
for (const c of annotationScheme.constraints) {
|
|
383
|
+
if (!c.isApplied || !c.appliedArgNames || c.appliedArgNames.length === 0)
|
|
384
|
+
continue;
|
|
385
|
+
const sig = c.appliedArgs
|
|
386
|
+
? c.appliedArgs.map(t => (0, types_1.typeToString)(t)).join(',')
|
|
387
|
+
: c.appliedArgNames.join(',');
|
|
388
|
+
const prev = sigByName.get(c.typeVarName);
|
|
389
|
+
if (prev === undefined)
|
|
390
|
+
sigByName.set(c.typeVarName, sig);
|
|
391
|
+
else if (prev !== sig)
|
|
392
|
+
sigByName.set(c.typeVarName, null);
|
|
393
|
+
}
|
|
394
|
+
(0, typeUtils_1.eachType)(annotationScheme.type, n => {
|
|
395
|
+
if (n.tag !== 'TCon')
|
|
396
|
+
return;
|
|
397
|
+
const kv = (0, types_1.parseKvName)(n.name);
|
|
398
|
+
if (!kv || n.args.length === 0)
|
|
399
|
+
return;
|
|
400
|
+
if (!appliedVarNames.has(kv.varName))
|
|
401
|
+
return;
|
|
402
|
+
const sig = n.args.map(a => (0, types_1.typeToString)(a)).join(',');
|
|
403
|
+
const prev = sigByName.get(kv.varName);
|
|
404
|
+
if (prev === undefined)
|
|
405
|
+
sigByName.set(kv.varName, sig);
|
|
406
|
+
else if (prev !== sig)
|
|
407
|
+
sigByName.set(kv.varName, null);
|
|
408
|
+
});
|
|
409
|
+
if (appliedVarNames.size > 0) {
|
|
410
|
+
// Keep kv-applications whose var belongs to an applied constraint and
|
|
411
|
+
// is consistently applied — drop the rest.
|
|
412
|
+
for (const [varId, kvType] of kvApps) {
|
|
413
|
+
if (kvType.tag === 'TCon') {
|
|
414
|
+
const kv = (0, types_1.parseKvName)(kvType.name);
|
|
415
|
+
if (kv && (!appliedVarNames.has(kv.varName) || sigByName.get(kv.varName) === null)) {
|
|
416
|
+
kvApps.delete(varId);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
kvApps.clear();
|
|
423
|
+
}
|
|
424
|
+
if (kvApps.size > 0) {
|
|
425
|
+
schemeForRigid = { ...annotationScheme, type: (0, typeUtils_1.fixTypeRepKvVars)(annotationScheme.type, kvApps) };
|
|
426
|
+
}
|
|
427
|
+
const { type: rigidAnnotType } = (0, env_1.instantiateRigid)(schemeForRigid);
|
|
428
|
+
const resolvedInferred = stripWildcards(ctx.subst.apply(inferredType));
|
|
429
|
+
try {
|
|
430
|
+
(0, unify_1.unify)(resolvedInferred, rigidAnnotType);
|
|
431
|
+
}
|
|
432
|
+
catch (e) {
|
|
433
|
+
if (e instanceof unify_1.UnificationError) {
|
|
434
|
+
// Fold-completion leniency (mirrors unifyWithDiagnostic): a TOP-LEVEL
|
|
435
|
+
// spread arrow chain reconciled against a non-function annotation
|
|
436
|
+
// stands for "the chain once fully applied", so compare the chain's
|
|
437
|
+
// terminal result instead of the whole chain before reporting.
|
|
438
|
+
if (chainTerminalMatches(resolvedInferred, rigidAnnotType))
|
|
439
|
+
return;
|
|
440
|
+
// A narrower union result than the annotation declares is fine.
|
|
441
|
+
if ((0, unify_1.unifyWidening)(resolvedInferred, rigidAnnotType))
|
|
442
|
+
return;
|
|
443
|
+
// Use a non-rigid instantiation for display so user-facing
|
|
444
|
+
// messages don't leak skolem (§) variable names.
|
|
445
|
+
const displayAnnot = (0, env_1.instantiate)(schemeForRigid);
|
|
446
|
+
if ((0, types_1.containsErrorType)(resolvedInferred) || (0, types_1.containsErrorType)(displayAnnot))
|
|
447
|
+
return;
|
|
448
|
+
if (annotationHasArrowChainTuple(annotationScheme.type))
|
|
449
|
+
return;
|
|
450
|
+
ctx.addDiag(annotationMismatchMessage(bindingNameFromNode(node), resolvedInferred, displayAnnot), narrowToIdentifier(node));
|
|
451
|
+
}
|
|
452
|
+
else {
|
|
453
|
+
throw e;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
// Param-only skolemization: variables in a parameter / `this` position are
|
|
459
|
+
// fixed by the caller and must match rigidly; variables that occur only in
|
|
460
|
+
// the return position are chosen by the body, so they stay flexible and a
|
|
461
|
+
// concrete return value (e.g. `[Number]` for an annotated `[b]`) is accepted.
|
|
462
|
+
const { type: rigidAnnotType } = (0, env_1.instantiateSkolem)(annotationScheme);
|
|
463
|
+
// Scrub registered body skolems AFTER applying the substitution: a skolem
|
|
464
|
+
// can be hidden behind a substitution binding (e.g. a `this`-instance type
|
|
465
|
+
// argument that the body unified with a parameter skolem), so scrubbing the
|
|
466
|
+
// raw inferred type alone leaves it in the resolved type and produces a
|
|
467
|
+
// spurious self-mismatch (`(a,b) -> Pair §0 §1` vs `(a,b) -> Pair §2 §3`).
|
|
468
|
+
const resolvedInferred = (0, annotations_1.expandAliases)(ctx.typeAliases, (0, typeUtils_1.scrubSkolems)(stripWildcards(ctx.subst.apply(inferredType)), ctx.skolemDisplayNames), undefined, ctx.aliasVars);
|
|
469
|
+
const expandedAnnot = (0, annotations_1.expandAliases)(ctx.typeAliases, rigidAnnotType, undefined, ctx.aliasVars);
|
|
470
|
+
try {
|
|
471
|
+
const inferredReturn = (0, types_1.getReturnType)(resolvedInferred);
|
|
472
|
+
const annotReturn = (0, types_1.getReturnType)(expandedAnnot);
|
|
473
|
+
if ((0, types_1.isUnion)(inferredReturn) &&
|
|
474
|
+
!(0, types_1.isUnion)(annotReturn)) {
|
|
475
|
+
for (const member of inferredReturn.args) {
|
|
476
|
+
(0, unify_1.unify)(member, annotReturn);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
(0, unify_1.unify)(resolvedInferred, expandedAnnot);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
catch (e) {
|
|
484
|
+
if (e instanceof unify_1.UnificationError) {
|
|
485
|
+
// Fold-completion leniency — see the constrained branch above.
|
|
486
|
+
if (chainTerminalMatches(resolvedInferred, expandedAnnot))
|
|
487
|
+
return;
|
|
488
|
+
// A narrower union result than the annotation declares is fine.
|
|
489
|
+
if ((0, unify_1.unifyWidening)(resolvedInferred, expandedAnnot))
|
|
490
|
+
return;
|
|
491
|
+
const displayAnnot = (0, annotations_1.expandAliases)(ctx.typeAliases, (0, env_1.instantiate)(annotationScheme), undefined, ctx.aliasVars);
|
|
492
|
+
if ((0, types_1.containsErrorType)(resolvedInferred) || (0, types_1.containsErrorType)(displayAnnot))
|
|
493
|
+
return;
|
|
494
|
+
if (annotationHasArrowChainTuple(annotationScheme.type))
|
|
495
|
+
return;
|
|
496
|
+
ctx.addDiag(annotationMismatchMessage(bindingNameFromNode(node), resolvedInferred, displayAnnot), narrowToIdentifier(node));
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
throw e;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Does the inferred type's spread-chain TERMINAL unify with a non-function
|
|
505
|
+
* annotation type? A top-level spread arrow chain (`a -> b -> ... -> z`)
|
|
506
|
+
* only arises from an explicit `...` annotation and stands for the
|
|
507
|
+
* heterogeneous fold that consumes all of its parameters at runtime, so an
|
|
508
|
+
* asserting boundary (the annotation) compares against the completed fold —
|
|
509
|
+
* the chain's terminal result. Runs in isolation (trial unify only).
|
|
510
|
+
*/
|
|
511
|
+
function chainTerminalMatches(inferred, annot) {
|
|
512
|
+
if (inferred.tag !== 'TFun' || !(0, typeUtils_1.hasTopLevelSpreadChain)(inferred))
|
|
513
|
+
return false;
|
|
514
|
+
if (annot.tag === 'TFun')
|
|
515
|
+
return false;
|
|
516
|
+
try {
|
|
517
|
+
(0, unify_1.unify)((0, types_3.flattenCurriedType)(inferred).result, annot);
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
520
|
+
catch (e) {
|
|
521
|
+
if (e instanceof unify_1.UnificationError)
|
|
522
|
+
return false;
|
|
523
|
+
throw e;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Annotations that keep the lenient (structural) check for function-valued
|
|
528
|
+
* `const` bindings: overload unions (the body only has to satisfy SOME
|
|
529
|
+
* branch per returned value) and spread-annotated variadics (`...`), whose
|
|
530
|
+
* fixed-arity body can never match the open chain rigidly.
|
|
531
|
+
*/
|
|
532
|
+
const lenientArrowMemo = new WeakMap();
|
|
533
|
+
function usesLenientArrowCheck(scheme) {
|
|
534
|
+
const memo = lenientArrowMemo.get(scheme);
|
|
535
|
+
if (memo !== undefined)
|
|
536
|
+
return memo;
|
|
537
|
+
const t = scheme.type;
|
|
538
|
+
const lenient = (t.tag === 'TCon' && t.name === types_1.T_UNION) || (0, typeUtils_1.someType)(t, types_2.isSpread);
|
|
539
|
+
lenientArrowMemo.set(scheme, lenient);
|
|
540
|
+
return lenient;
|
|
541
|
+
}
|
|
542
|
+
//# sourceMappingURL=annotation-rigid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation-rigid.js","sourceRoot":"","sources":["../../src/infer/annotation-rigid.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,wEAAwE;AACxE,qEAAqE;AACrE,8CAA8C;AAC9C,EAAE;AACF,2EAA2E;AAC3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