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.
Files changed (301) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2306 -2
  3. package/dist/cli.d.ts +15 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +338 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commentParser.d.ts +384 -0
  8. package/dist/commentParser.d.ts.map +1 -0
  9. package/dist/commentParser.js +2487 -0
  10. package/dist/commentParser.js.map +1 -0
  11. package/dist/config.d.ts +203 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +375 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/debugLog.d.ts +13 -0
  16. package/dist/debugLog.d.ts.map +1 -0
  17. package/dist/debugLog.js +44 -0
  18. package/dist/debugLog.js.map +1 -0
  19. package/dist/estree.d.ts +100 -0
  20. package/dist/estree.d.ts.map +1 -0
  21. package/dist/estree.js +34 -0
  22. package/dist/estree.js.map +1 -0
  23. package/dist/hm/env.d.ts +134 -0
  24. package/dist/hm/env.d.ts.map +1 -0
  25. package/dist/hm/env.js +939 -0
  26. package/dist/hm/env.js.map +1 -0
  27. package/dist/hm/index.d.ts +7 -0
  28. package/dist/hm/index.d.ts.map +1 -0
  29. package/dist/hm/index.js +26 -0
  30. package/dist/hm/index.js.map +1 -0
  31. package/dist/hm/substitution.d.ts +57 -0
  32. package/dist/hm/substitution.d.ts.map +1 -0
  33. package/dist/hm/substitution.js +546 -0
  34. package/dist/hm/substitution.js.map +1 -0
  35. package/dist/hm/typeParser.d.ts +39 -0
  36. package/dist/hm/typeParser.d.ts.map +1 -0
  37. package/dist/hm/typeParser.js +1285 -0
  38. package/dist/hm/typeParser.js.map +1 -0
  39. package/dist/hm/typeUtils.d.ts +248 -0
  40. package/dist/hm/typeUtils.d.ts.map +1 -0
  41. package/dist/hm/typeUtils.js +905 -0
  42. package/dist/hm/typeUtils.js.map +1 -0
  43. package/dist/hm/types.d.ts +738 -0
  44. package/dist/hm/types.d.ts.map +1 -0
  45. package/dist/hm/types.js +1853 -0
  46. package/dist/hm/types.js.map +1 -0
  47. package/dist/hm/unify.d.ts +59 -0
  48. package/dist/hm/unify.d.ts.map +1 -0
  49. package/dist/hm/unify.js +1700 -0
  50. package/dist/hm/unify.js.map +1 -0
  51. package/dist/index.d.ts +20 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +196 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/infer/annotation-rigid.d.ts +76 -0
  56. package/dist/infer/annotation-rigid.d.ts.map +1 -0
  57. package/dist/infer/annotation-rigid.js +542 -0
  58. package/dist/infer/annotation-rigid.js.map +1 -0
  59. package/dist/infer/annotation-validation.d.ts +109 -0
  60. package/dist/infer/annotation-validation.d.ts.map +1 -0
  61. package/dist/infer/annotation-validation.js +1078 -0
  62. package/dist/infer/annotation-validation.js.map +1 -0
  63. package/dist/infer/annotations.d.ts +277 -0
  64. package/dist/infer/annotations.d.ts.map +1 -0
  65. package/dist/infer/annotations.js +1343 -0
  66. package/dist/infer/annotations.js.map +1 -0
  67. package/dist/infer/call-overloads.d.ts +24 -0
  68. package/dist/infer/call-overloads.d.ts.map +1 -0
  69. package/dist/infer/call-overloads.js +900 -0
  70. package/dist/infer/call-overloads.js.map +1 -0
  71. package/dist/infer/call-rows.d.ts +154 -0
  72. package/dist/infer/call-rows.d.ts.map +1 -0
  73. package/dist/infer/call-rows.js +2162 -0
  74. package/dist/infer/call-rows.js.map +1 -0
  75. package/dist/infer/calls.d.ts +20 -0
  76. package/dist/infer/calls.d.ts.map +1 -0
  77. package/dist/infer/calls.js +1468 -0
  78. package/dist/infer/calls.js.map +1 -0
  79. package/dist/infer/constraints.d.ts +99 -0
  80. package/dist/infer/constraints.d.ts.map +1 -0
  81. package/dist/infer/constraints.js +1208 -0
  82. package/dist/infer/constraints.js.map +1 -0
  83. package/dist/infer/expr-assignment.d.ts +20 -0
  84. package/dist/infer/expr-assignment.d.ts.map +1 -0
  85. package/dist/infer/expr-assignment.js +620 -0
  86. package/dist/infer/expr-assignment.js.map +1 -0
  87. package/dist/infer/expr-constraint-lookup.d.ts +44 -0
  88. package/dist/infer/expr-constraint-lookup.d.ts.map +1 -0
  89. package/dist/infer/expr-constraint-lookup.js +207 -0
  90. package/dist/infer/expr-constraint-lookup.js.map +1 -0
  91. package/dist/infer/expr-functions.d.ts +20 -0
  92. package/dist/infer/expr-functions.d.ts.map +1 -0
  93. package/dist/infer/expr-functions.js +1359 -0
  94. package/dist/infer/expr-functions.js.map +1 -0
  95. package/dist/infer/expr-jsx.d.ts +19 -0
  96. package/dist/infer/expr-jsx.d.ts.map +1 -0
  97. package/dist/infer/expr-jsx.js +310 -0
  98. package/dist/infer/expr-jsx.js.map +1 -0
  99. package/dist/infer/expr-member.d.ts +40 -0
  100. package/dist/infer/expr-member.d.ts.map +1 -0
  101. package/dist/infer/expr-member.js +1154 -0
  102. package/dist/infer/expr-member.js.map +1 -0
  103. package/dist/infer/expr-prototype.d.ts +11 -0
  104. package/dist/infer/expr-prototype.d.ts.map +1 -0
  105. package/dist/infer/expr-prototype.js +202 -0
  106. package/dist/infer/expr-prototype.js.map +1 -0
  107. package/dist/infer/expressions.d.ts +40 -0
  108. package/dist/infer/expressions.d.ts.map +1 -0
  109. package/dist/infer/expressions.js +1497 -0
  110. package/dist/infer/expressions.js.map +1 -0
  111. package/dist/infer/functionPatterns.d.ts +229 -0
  112. package/dist/infer/functionPatterns.d.ts.map +1 -0
  113. package/dist/infer/functionPatterns.js +1035 -0
  114. package/dist/infer/functionPatterns.js.map +1 -0
  115. package/dist/infer/helpers.d.ts +73 -0
  116. package/dist/infer/helpers.d.ts.map +1 -0
  117. package/dist/infer/helpers.js +187 -0
  118. package/dist/infer/helpers.js.map +1 -0
  119. package/dist/infer/index.d.ts +551 -0
  120. package/dist/infer/index.d.ts.map +1 -0
  121. package/dist/infer/index.js +1127 -0
  122. package/dist/infer/index.js.map +1 -0
  123. package/dist/infer/jsx-dom.d.ts +26 -0
  124. package/dist/infer/jsx-dom.d.ts.map +1 -0
  125. package/dist/infer/jsx-dom.js +303 -0
  126. package/dist/infer/jsx-dom.js.map +1 -0
  127. package/dist/infer/moduleReps.d.ts +7 -0
  128. package/dist/infer/moduleReps.d.ts.map +1 -0
  129. package/dist/infer/moduleReps.js +48 -0
  130. package/dist/infer/moduleReps.js.map +1 -0
  131. package/dist/infer/modules.d.ts +10 -0
  132. package/dist/infer/modules.d.ts.map +1 -0
  133. package/dist/infer/modules.js +775 -0
  134. package/dist/infer/modules.js.map +1 -0
  135. package/dist/infer/narrowing.d.ts +199 -0
  136. package/dist/infer/narrowing.d.ts.map +1 -0
  137. package/dist/infer/narrowing.js +1428 -0
  138. package/dist/infer/narrowing.js.map +1 -0
  139. package/dist/infer/results.d.ts +24 -0
  140. package/dist/infer/results.d.ts.map +1 -0
  141. package/dist/infer/results.js +611 -0
  142. package/dist/infer/results.js.map +1 -0
  143. package/dist/infer/setupPass.d.ts +11 -0
  144. package/dist/infer/setupPass.d.ts.map +1 -0
  145. package/dist/infer/setupPass.js +524 -0
  146. package/dist/infer/setupPass.js.map +1 -0
  147. package/dist/infer/statements.d.ts +26 -0
  148. package/dist/infer/statements.d.ts.map +1 -0
  149. package/dist/infer/statements.js +750 -0
  150. package/dist/infer/statements.js.map +1 -0
  151. package/dist/infer/stmt-bindings.d.ts +22 -0
  152. package/dist/infer/stmt-bindings.d.ts.map +1 -0
  153. package/dist/infer/stmt-bindings.js +1482 -0
  154. package/dist/infer/stmt-bindings.js.map +1 -0
  155. package/dist/infer/stmt-destructure.d.ts +29 -0
  156. package/dist/infer/stmt-destructure.d.ts.map +1 -0
  157. package/dist/infer/stmt-destructure.js +490 -0
  158. package/dist/infer/stmt-destructure.js.map +1 -0
  159. package/dist/infer/types.d.ts +220 -0
  160. package/dist/infer/types.d.ts.map +1 -0
  161. package/dist/infer/types.js +46 -0
  162. package/dist/infer/types.js.map +1 -0
  163. package/dist/infer/unifyDiag.d.ts +46 -0
  164. package/dist/infer/unifyDiag.d.ts.map +1 -0
  165. package/dist/infer/unifyDiag.js +642 -0
  166. package/dist/infer/unifyDiag.js.map +1 -0
  167. package/dist/parsing-babel.d.ts +3 -0
  168. package/dist/parsing-babel.d.ts.map +1 -0
  169. package/dist/parsing-babel.js +353 -0
  170. package/dist/parsing-babel.js.map +1 -0
  171. package/dist/parsing.d.ts +69 -0
  172. package/dist/parsing.d.ts.map +1 -0
  173. package/dist/parsing.js +288 -0
  174. package/dist/parsing.js.map +1 -0
  175. package/dist/registries/constraintRegistry.d.ts +233 -0
  176. package/dist/registries/constraintRegistry.d.ts.map +1 -0
  177. package/dist/registries/constraintRegistry.js +803 -0
  178. package/dist/registries/constraintRegistry.js.map +1 -0
  179. package/dist/registries/dataTypeRegistry.d.ts +63 -0
  180. package/dist/registries/dataTypeRegistry.d.ts.map +1 -0
  181. package/dist/registries/dataTypeRegistry.js +180 -0
  182. package/dist/registries/dataTypeRegistry.js.map +1 -0
  183. package/dist/registries/domGlobals.d.ts +33 -0
  184. package/dist/registries/domGlobals.d.ts.map +1 -0
  185. package/dist/registries/domGlobals.js +309 -0
  186. package/dist/registries/domGlobals.js.map +1 -0
  187. package/dist/registries/methodRegistry.d.ts +277 -0
  188. package/dist/registries/methodRegistry.d.ts.map +1 -0
  189. package/dist/registries/methodRegistry.js +2074 -0
  190. package/dist/registries/methodRegistry.js.map +1 -0
  191. package/dist/registries/session.d.ts +38 -0
  192. package/dist/registries/session.d.ts.map +1 -0
  193. package/dist/registries/session.js +75 -0
  194. package/dist/registries/session.js.map +1 -0
  195. package/dist/server.d.ts +2 -0
  196. package/dist/server.d.ts.map +1 -0
  197. package/dist/server.js +1896 -0
  198. package/dist/server.js.map +1 -0
  199. package/dist/services/codeActions.d.ts +22 -0
  200. package/dist/services/codeActions.d.ts.map +1 -0
  201. package/dist/services/codeActions.js +465 -0
  202. package/dist/services/codeActions.js.map +1 -0
  203. package/dist/services/completion.d.ts +259 -0
  204. package/dist/services/completion.d.ts.map +1 -0
  205. package/dist/services/completion.js +2794 -0
  206. package/dist/services/completion.js.map +1 -0
  207. package/dist/services/definitions.d.ts +37 -0
  208. package/dist/services/definitions.d.ts.map +1 -0
  209. package/dist/services/definitions.js +605 -0
  210. package/dist/services/definitions.js.map +1 -0
  211. package/dist/services/diagnosticCodes.d.ts +70 -0
  212. package/dist/services/diagnosticCodes.d.ts.map +1 -0
  213. package/dist/services/diagnosticCodes.js +239 -0
  214. package/dist/services/diagnosticCodes.js.map +1 -0
  215. package/dist/services/diagnostics.d.ts +86 -0
  216. package/dist/services/diagnostics.d.ts.map +1 -0
  217. package/dist/services/diagnostics.js +665 -0
  218. package/dist/services/diagnostics.js.map +1 -0
  219. package/dist/services/documentCache.d.ts +88 -0
  220. package/dist/services/documentCache.d.ts.map +1 -0
  221. package/dist/services/documentCache.js +108 -0
  222. package/dist/services/documentCache.js.map +1 -0
  223. package/dist/services/documentSymbols.d.ts +20 -0
  224. package/dist/services/documentSymbols.d.ts.map +1 -0
  225. package/dist/services/documentSymbols.js +381 -0
  226. package/dist/services/documentSymbols.js.map +1 -0
  227. package/dist/services/fileSelection.d.ts +24 -0
  228. package/dist/services/fileSelection.d.ts.map +1 -0
  229. package/dist/services/fileSelection.js +154 -0
  230. package/dist/services/fileSelection.js.map +1 -0
  231. package/dist/services/fileSelectionRefresh.d.ts +26 -0
  232. package/dist/services/fileSelectionRefresh.d.ts.map +1 -0
  233. package/dist/services/fileSelectionRefresh.js +77 -0
  234. package/dist/services/fileSelectionRefresh.js.map +1 -0
  235. package/dist/services/files.d.ts +342 -0
  236. package/dist/services/files.d.ts.map +1 -0
  237. package/dist/services/files.js +1712 -0
  238. package/dist/services/files.js.map +1 -0
  239. package/dist/services/fsProbe.d.ts +14 -0
  240. package/dist/services/fsProbe.d.ts.map +1 -0
  241. package/dist/services/fsProbe.js +112 -0
  242. package/dist/services/fsProbe.js.map +1 -0
  243. package/dist/services/globalsLoader.d.ts +20 -0
  244. package/dist/services/globalsLoader.d.ts.map +1 -0
  245. package/dist/services/globalsLoader.js +122 -0
  246. package/dist/services/globalsLoader.js.map +1 -0
  247. package/dist/services/hmFileServices.d.ts +113 -0
  248. package/dist/services/hmFileServices.d.ts.map +1 -0
  249. package/dist/services/hmFileServices.js +686 -0
  250. package/dist/services/hmFileServices.js.map +1 -0
  251. package/dist/services/hover.d.ts +280 -0
  252. package/dist/services/hover.d.ts.map +1 -0
  253. package/dist/services/hover.js +1687 -0
  254. package/dist/services/hover.js.map +1 -0
  255. package/dist/services/importContext.d.ts +396 -0
  256. package/dist/services/importContext.d.ts.map +1 -0
  257. package/dist/services/importContext.js +1999 -0
  258. package/dist/services/importContext.js.map +1 -0
  259. package/dist/services/projectChecker.d.ts +50 -0
  260. package/dist/services/projectChecker.d.ts.map +1 -0
  261. package/dist/services/projectChecker.js +228 -0
  262. package/dist/services/projectChecker.js.map +1 -0
  263. package/dist/services/references.d.ts +41 -0
  264. package/dist/services/references.d.ts.map +1 -0
  265. package/dist/services/references.js +757 -0
  266. package/dist/services/references.js.map +1 -0
  267. package/dist/services/rename.d.ts +22 -0
  268. package/dist/services/rename.d.ts.map +1 -0
  269. package/dist/services/rename.js +101 -0
  270. package/dist/services/rename.js.map +1 -0
  271. package/dist/services/shortCircuit.d.ts +27 -0
  272. package/dist/services/shortCircuit.d.ts.map +1 -0
  273. package/dist/services/shortCircuit.js +28 -0
  274. package/dist/services/shortCircuit.js.map +1 -0
  275. package/dist/services/sidecarPerf.d.ts +19 -0
  276. package/dist/services/sidecarPerf.d.ts.map +1 -0
  277. package/dist/services/sidecarPerf.js +59 -0
  278. package/dist/services/sidecarPerf.js.map +1 -0
  279. package/dist/services/signatureHelp.d.ts +27 -0
  280. package/dist/services/signatureHelp.d.ts.map +1 -0
  281. package/dist/services/signatureHelp.js +984 -0
  282. package/dist/services/signatureHelp.js.map +1 -0
  283. package/dist/walking.d.ts +25 -0
  284. package/dist/walking.d.ts.map +1 -0
  285. package/dist/walking.js +107 -0
  286. package/dist/walking.js.map +1 -0
  287. package/hm-types-builtin/assert.hm +20 -0
  288. package/hm-types-builtin/buffer.hm +8 -0
  289. package/hm-types-builtin/child_process.hm +16 -0
  290. package/hm-types-builtin/crypto.hm +17 -0
  291. package/hm-types-builtin/fs.hm +15 -0
  292. package/hm-types-builtin/http.hm +14 -0
  293. package/hm-types-builtin/os.hm +19 -0
  294. package/hm-types-builtin/path.hm +18 -0
  295. package/hm-types-builtin/react-dom.hm +27 -0
  296. package/hm-types-builtin/react.hm +113 -0
  297. package/hm-types-builtin/url.hm +7 -0
  298. package/hm-types-builtin/zlib.hm +12 -0
  299. package/package.json +53 -4
  300. package/schemas/hinmil.config.schema.json +261 -0
  301. package/schemas/package-hinmil.schema.json +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupPass.d.ts","sourceRoot":"","sources":["../../src/infer/setupPass.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkD/C;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA2gBhF"}
@@ -0,0 +1,524 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Annotation & directive setup pass
4
+ //
5
+ // Plain language: before the engine reads any actual code, it first reads
6
+ // ALL the comments — collecting annotations, processing directives, loading
7
+ // imports and type aliases — like reading a recipe's ingredient list before
8
+ // starting to cook. This file is that preparation step.
9
+ //
10
+ // Extracted from the InferenceEngine class. Runs at the start of `infer()`,
11
+ // before the AST walk: builds the annotation maps, processes all `::`
12
+ // directives, resolves imports/sidecars into aliases and constructors,
13
+ // validates annotations, and bakes constructor-style constraints.
14
+ // ============================================================================
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.runAnnotationSetup = runAnnotationSetup;
17
+ const types_1 = require("../hm/types");
18
+ const commentParser_1 = require("../commentParser");
19
+ const methodRegistry_1 = require("../registries/methodRegistry");
20
+ const constraintRegistry_1 = require("../registries/constraintRegistry");
21
+ const moduleReps_1 = require("./moduleReps");
22
+ const dataTypeRegistry_1 = require("../registries/dataTypeRegistry");
23
+ const annotations_1 = require("./annotations");
24
+ const types_2 = require("./types");
25
+ const constraints_1 = require("./constraints");
26
+ /**
27
+ * Run the pre-inference annotation/directive setup pass: build annotation
28
+ * maps (merging project globals), report annotation parse errors, process
29
+ * `::constraint` / `::data` / `::types` / `::rep` / curry directives,
30
+ * pre-resolve imports (aliases, constructors, instance-callables, reps),
31
+ * validate orphan/duplicate/unknown annotations, and bake constructor-style
32
+ * constraints into the annotation types. Mutates engine state in place.
33
+ */
34
+ function runAnnotationSetup(engine, source) {
35
+ // Extract HM annotations from comments
36
+ engine.annotationMap = (0, commentParser_1.buildAnnotationMap)(source);
37
+ engine.annotationsByDeclaration = (0, commentParser_1.buildAnnotationsByDeclaration)(source);
38
+ engine.annotationByOffset = (0, commentParser_1.buildAnnotationByOffset)(source);
39
+ // Merge annotations from the project globals file (if provided), so that
40
+ // project-wide aliases like `Selector :: ...` and value annotations like
41
+ // `tables :: { ... }` are visible to every file the engine infers without
42
+ // requiring an explicit `// ::types` directive in each consumer. The
43
+ // file's own annotations always win on collision.
44
+ if (engine.globalsSource) {
45
+ const globalAnns = (0, commentParser_1.buildAnnotationMap)(engine.globalsSource);
46
+ for (const [name, ann] of globalAnns) {
47
+ if (!engine.annotationMap.has(name)) {
48
+ // Tag the merged entry so downstream consumers that must be
49
+ // file-local-only (export schemes, dotted-name constraint
50
+ // injection, prototype receivers, bare-binding lookups) can
51
+ // skip globals via `isLocalAnnotation`.
52
+ engine.annotationMap.set(name, { ...ann, origin: 'globals' });
53
+ }
54
+ }
55
+ }
56
+ // `::curried` belongs in `.hm` files. In JavaScript the code shows whether
57
+ // a function is curried (`curry ((a, b) => …)` versus `a => b => …`), and
58
+ // marking `a => b => …` would hide that `f (a, b)` returns a function.
59
+ for (const loc of (0, commentParser_1.extractCurriedDirectiveLocations)(source)) {
60
+ engine.addDiag('::curried only works in .hm files. In JavaScript, give the curry helper a signature ' +
61
+ '(curry :: ((a, b, ...) -> z) -> a -> b -> ... -> z) and the functions built with it accept any grouping', loc, undefined, 2);
62
+ }
63
+ // Report parse errors in annotations (including those without a name)
64
+ const allAnnotations = (0, commentParser_1.extractAnnotations)(source);
65
+ // Apply standalone `// ::hidden` markers to method registry so completion
66
+ // can suppress them. Markers are dropped on every `clearCustomMethods`,
67
+ // so they are scoped per inference run.
68
+ for (const m of (0, commentParser_1.extractStandaloneHiddenMarkers)(source)) {
69
+ if (m.typeName)
70
+ (0, methodRegistry_1.markMethodHidden)(m.typeName, m.methodName);
71
+ (0, methodRegistry_1.markHiddenPropertyOffset)(m.memberStart);
72
+ }
73
+ // Apply standalone `// ::private` markers (privacy implies hidden).
74
+ for (const m of (0, commentParser_1.extractStandalonePrivateMarkers)(source)) {
75
+ if (m.typeName) {
76
+ (0, methodRegistry_1.markMethodPrivate)(m.typeName, m.methodName);
77
+ (0, methodRegistry_1.markMethodHidden)(m.typeName, m.methodName);
78
+ }
79
+ (0, methodRegistry_1.markHiddenPropertyOffset)(m.memberStart);
80
+ }
81
+ // Apply `private: true` annotation flags to the registry. This covers
82
+ // member annotations like `// Type#name :: ...` with `// ::private`
83
+ // directly above them — regardless of which inference path registers
84
+ // the method later (class method, prototype assignment, constructor body).
85
+ for (const ann of allAnnotations) {
86
+ if (!ann.private || !ann.name)
87
+ continue;
88
+ const name = ann.name;
89
+ // Member annotations are `Type#name`, `Type##name`, or `Type.name`.
90
+ const m = /^([A-Za-z_$][\w$]*)(?:##|[#.])([A-Za-z_$][\w$]*)$/.exec(name);
91
+ if (!m)
92
+ continue;
93
+ (0, methodRegistry_1.markMethodPrivate)(m[1], m[2]);
94
+ (0, methodRegistry_1.markMethodHidden)(m[1], m[2]);
95
+ }
96
+ for (const ann of allAnnotations) {
97
+ if (ann.error) {
98
+ const message = ann.name
99
+ ? `Invalid type annotation for '${ann.name}': ${ann.error}`
100
+ : `Invalid type annotation: ${ann.error}`;
101
+ // Signature-related diagnostics underline the annotation name in the
102
+ // comment itself (e.g. the `getTwo` in `// getTwo :: ...`) so the user
103
+ // sees the issue exactly where the signature lives. Fall back to the
104
+ // whole comment when no annotation name is available.
105
+ const diagLoc = ann.signatureNameStart !== undefined && ann.signatureNameEnd !== undefined
106
+ ? { start: ann.signatureNameStart, end: ann.signatureNameEnd }
107
+ : { start: ann.commentStart, end: ann.commentEnd };
108
+ engine.addDiag(message, diagLoc);
109
+ }
110
+ // Report name mismatches (e.g. `// memoize :: ...` above `const memoizee = ...`)
111
+ // The diagnostic points at the declaration name so the user sees the
112
+ // problem at the implementation site.
113
+ if (ann.nameMismatch && ann.nodeStart !== undefined) {
114
+ const nameIdx = source.indexOf(ann.nameMismatch, ann.nodeStart);
115
+ const start = nameIdx >= 0 ? nameIdx : ann.nodeStart;
116
+ const end = start + ann.nameMismatch.length;
117
+ engine.addDiag(`Declaration name '${ann.nameMismatch}' does not match annotation name '${ann.name}'`, { start, end }, [{ message: `Annotation '${ann.name}' defined here`, start: ann.commentStart, end: ann.commentEnd }]);
118
+ }
119
+ // Report nameless annotations above named declarations
120
+ // (e.g. `// :: Number -> Boolean` above `const getValue = ...`)
121
+ if (ann.namelessOnNamed) {
122
+ engine.addDiag(`Nameless annotation '// :: ...' is only allowed for anonymous functions. Use '// ${ann.namelessOnNamed} :: ...' instead`, { start: ann.commentStart, end: ann.commentEnd });
123
+ }
124
+ }
125
+ // Detect duplicate overload signatures. Two value-level annotations that
126
+ // share a declaration name are merged into one overloaded scheme by
127
+ // `buildAnnotationMap`; if a later one is alpha-equivalent to an earlier
128
+ // one it adds nothing, so flag it. Method (`Type#m`) / dotted names are
129
+ // excluded — they follow a different (non-overload-merge) path.
130
+ {
131
+ const seenKeysByName = new Map();
132
+ const declOf = (0, commentParser_1.declarationStarts)(allAnnotations);
133
+ for (const ann of allAnnotations) {
134
+ if (!ann.name || !ann.scheme || ann.namelessOnNamed)
135
+ continue;
136
+ if (ann.name.endsWith('()'))
137
+ continue;
138
+ if (ann.name.includes('#') || ann.name.includes('.'))
139
+ continue;
140
+ const key = (0, types_1.canonicalSchemeKey)(ann.scheme);
141
+ // Per declaration: a same-named helper in another scope is no overload.
142
+ const declKey = `${ann.name}@${declOf.get(ann) ?? ''}`;
143
+ let seen = seenKeysByName.get(declKey);
144
+ if (!seen) {
145
+ seen = new Set();
146
+ seenKeysByName.set(declKey, seen);
147
+ }
148
+ if (seen.has(key)) {
149
+ const diagLoc = ann.signatureNameStart !== undefined && ann.signatureNameEnd !== undefined
150
+ ? { start: ann.signatureNameStart, end: ann.signatureNameEnd }
151
+ : { start: ann.commentStart, end: ann.commentEnd };
152
+ engine.addDiag(`Duplicate overload signature for '${ann.name}': '${ann.raw.trim()}'`, diagLoc);
153
+ }
154
+ else {
155
+ seen.add(key);
156
+ }
157
+ }
158
+ }
159
+ // Build annotation context for the processing pipeline
160
+ const annCtx = {
161
+ annotationMap: engine.annotationMap,
162
+ annotationByOffset: engine.annotationByOffset,
163
+ typeAliases: new Map(),
164
+ typeAliasVars: new Map(),
165
+ typeDirectiveResolver: engine.typeDirectiveResolver,
166
+ curryFunctionNames: engine.curryFunctionNames,
167
+ instanceCallablesFromDirectives: new Map(),
168
+ // `::global` members first: `::types` methods re-registered later win.
169
+ directiveMethods: [...engine.globalDirectiveMethods],
170
+ directiveRepSources: [],
171
+ addDiag: (msg, loc, severity) => engine.addDiag(msg, loc, undefined, severity),
172
+ };
173
+ // Process ::constraint directives
174
+ (0, annotations_1.processConstraintDirectives)(source, (msg, loc) => engine.addDiag(msg, loc));
175
+ // Process sumtype directives (sum type declarations)
176
+ // Must run before processMethodAnnotations so auto-generated constructor
177
+ // annotations are in place, and before validateAnnotationTypes so sumtype
178
+ // types are recognized as known.
179
+ (0, annotations_1.processDataDirectives)(annCtx, source);
180
+ // Process curry wrapper auto-detection
181
+ (0, annotations_1.processCurryDirectives)(allAnnotations, engine.curryFunctionNames, engine.curryNFunctionNames);
182
+ // Process ::types directives (load external type annotations)
183
+ (0, annotations_1.processTypeDirectives)(annCtx, source);
184
+ // Pre-resolve imports so that data types, method registrations, and
185
+ // constraint registrations from imported files are available before
186
+ // annotation validation. The import resolver caches results, so the
187
+ // actual AST-walk import processing later will simply hit the cache.
188
+ if (engine.importResolver) {
189
+ for (const specifier of (0, commentParser_1.extractImportModuleSpecifiers)(source)) {
190
+ const resolved = engine.importResolver(specifier);
191
+ // Collect `::rep` representatives carried by imported schemes so the
192
+ // importing file can discharge the same constraint for the same
193
+ // container type (and propagate them further on re-export).
194
+ if (resolved && resolved !== types_2.UNTYPED_MODULE && resolved instanceof Map) {
195
+ for (const sch of resolved.values()) {
196
+ if (sch.reps && sch.reps.length > 0) {
197
+ for (const rep of sch.reps)
198
+ (0, moduleReps_1.addRepUnique)(engine.importedReps, rep);
199
+ }
200
+ }
201
+ // Reps visible in the imported module itself (its own + its
202
+ // imports'), so they also cross unannotated intermediates.
203
+ for (const rep of (0, moduleReps_1.getModuleReps)(resolved))
204
+ (0, moduleReps_1.addRepUnique)(engine.importedReps, rep);
205
+ }
206
+ }
207
+ // Import engines switch the global active allocator to their own.
208
+ // Restore this engine's allocator so TVars created during the main
209
+ // inference belong to the correct allocator.
210
+ (0, types_1.setActiveAllocator)(engine.allocator);
211
+ }
212
+ // Build type alias map from standalone type annotations
213
+ engine.typeAliases = (0, annotations_1.buildTypeAliases)(engine.annotationMap);
214
+ engine.typeAliasVars = (0, annotations_1.buildTypeAliasVars)(engine.annotationMap, engine.typeAliases);
215
+ engine.importedConstructors = new Map();
216
+ engine.instanceCallables = new Map();
217
+ engine.bindingExtents = [];
218
+ // Populate instance-callables from the local source first. Local
219
+ // declarations always win over sidecar entries on name collision.
220
+ for (const [name, schemes] of (0, commentParser_1.extractInstanceCallables)(source)) {
221
+ engine.instanceCallables.set(name, [...schemes]);
222
+ }
223
+ // Merge in type aliases declared in imported `.hm` files (sidecars and
224
+ // overrides). Local aliases take precedence on name collision so the
225
+ // consumer can override an upstream definition. This is what makes
226
+ // bare type names like `Selector` appearing inside an imported scheme
227
+ // expand to their union body at unification sites.
228
+ if (engine.importTypeAliasResolver) {
229
+ // A relative `// ::types ./module` names the same types as importing
230
+ // from that module: its own aliases (already in the annotation map via
231
+ // `processTypeDirectives`) plus its `::types` closure and its imports.
232
+ // Without this, `::types ./a` where `a` has `::types ./b` left the
233
+ // names of `b` unexpanded inside `a`'s aliases, and the consumer then
234
+ // met the same alias as a bare constructor and as a record ("Cannot
235
+ // unify 'X' with 'X'").
236
+ const relativeDirectives = (0, commentParser_1.extractTypeDirectives)(source)
237
+ .filter((spec) => spec.startsWith('.') || spec.startsWith('/'));
238
+ for (const specifier of [...(0, commentParser_1.extractImportModuleSpecifiers)(source), ...relativeDirectives]) {
239
+ const imported = engine.importTypeAliasResolver(specifier);
240
+ if (!imported)
241
+ continue;
242
+ for (const [name, type] of imported.aliases) {
243
+ if (!engine.typeAliases.has(name))
244
+ engine.typeAliases.set(name, type);
245
+ }
246
+ for (const [name, vars] of imported.aliasVars) {
247
+ if (!engine.typeAliasVars.has(name))
248
+ engine.typeAliasVars.set(name, vars);
249
+ }
250
+ if (imported.constructors) {
251
+ for (const [name, scheme] of imported.constructors) {
252
+ // Local annotations always win; otherwise first imported wins.
253
+ if (engine.annotationMap.has(name))
254
+ continue;
255
+ if (!engine.importedConstructors.has(name)) {
256
+ engine.importedConstructors.set(name, scheme);
257
+ }
258
+ }
259
+ }
260
+ if (imported.instanceCallables) {
261
+ for (const [name, schemes] of imported.instanceCallables) {
262
+ // Local declarations win on name collision.
263
+ if (engine.instanceCallables.has(name))
264
+ continue;
265
+ engine.instanceCallables.set(name, [...schemes]);
266
+ }
267
+ }
268
+ // Apply `::extend <Name> <typeExpr>` directives collected from
269
+ // this specifier's sidecar(s) / override(s). Done per-specifier
270
+ // so each import sees its own augmented alias map; ordering
271
+ // mirrors the merge order (sidecar first, override last).
272
+ if (imported.aliasExtensions && imported.aliasExtensions.length > 0) {
273
+ (0, annotations_1.applyAliasExtensions)(engine.typeAliases, imported.aliasExtensions, engine.typeAliasVars);
274
+ }
275
+ }
276
+ (0, types_1.setActiveAllocator)(engine.allocator);
277
+ }
278
+ // Apply `::extend` directives declared in the local source. Local
279
+ // extensions are applied after imported ones so they can further
280
+ // augment an alias that an imported sidecar (or its override)
281
+ // already extended.
282
+ const localAliasExtensions = (0, commentParser_1.extractAliasExtensions)(source);
283
+ if (localAliasExtensions.length > 0) {
284
+ (0, annotations_1.applyAliasExtensions)(engine.typeAliases, localAliasExtensions, engine.typeAliasVars, (message, loc) => engine.diagnostics.push({ message, start: loc.start, end: loc.end }));
285
+ }
286
+ // Merge instance-callables loaded via `// ::types <pkg>` directives.
287
+ // Local source wins; previously-set imported entries also win since
288
+ // they are typically more specific (the consumer chose to import the
289
+ // module). Otherwise add the directive-loaded scheme so values of
290
+ // type `Name` from a sidecar can be invoked at the call site.
291
+ if (annCtx.instanceCallablesFromDirectives) {
292
+ for (const [name, schemes] of annCtx.instanceCallablesFromDirectives) {
293
+ if (engine.instanceCallables.has(name))
294
+ continue;
295
+ engine.instanceCallables.set(name, [...schemes]);
296
+ }
297
+ }
298
+ // Drop orphan imported instance-callables: a `Name() :: ...` from a
299
+ // sidecar / override only makes sense when a constructor `Name :: ...`
300
+ // exists somewhere in scope (local annotation OR imported from any
301
+ // sidecar — which is the override scenario where the constructor
302
+ // lives in the base package sidecar and only `Name()` is overridden).
303
+ // This is the import-time mirror of the local orphan diagnostic below.
304
+ for (const name of [...engine.instanceCallables.keys()]) {
305
+ // Skip locals; they are validated (and possibly diagnosed) below.
306
+ if (engine.annotationMap.has(name + '()'))
307
+ continue;
308
+ if (!engine.annotationMap.has(name) && !engine.importedConstructors.has(name)) {
309
+ engine.instanceCallables.delete(name);
310
+ }
311
+ }
312
+ // Enforce: every `Name() :: ...` (instance-callable) requires a
313
+ // matching constructor `Name :: ...` (locally defined or imported
314
+ // via a sidecar). An instance-callable describes how a value of
315
+ // type `Name` is invoked; it is meaningless if `Name` itself has
316
+ // no value-level definition. Orphan local entries are diagnosed
317
+ // and dropped here. (Sidecar orphans are dropped silently in
318
+ // `parseHmTypeAliases`.)
319
+ {
320
+ const allAnnotations = (0, commentParser_1.extractAnnotations)(source);
321
+ for (const ann of allAnnotations) {
322
+ if (!ann.name || !ann.scheme)
323
+ continue;
324
+ if (!ann.name.endsWith('()'))
325
+ continue;
326
+ const baseName = ann.name.slice(0, -2);
327
+ if (!baseName)
328
+ continue;
329
+ const hasConstructor = engine.annotationMap.has(baseName) || engine.importedConstructors.has(baseName);
330
+ if (!hasConstructor) {
331
+ engine.addDiag(`Instance-callable annotation '${baseName}() :: ...' has no constructor '${baseName} :: ...' in scope. Declare a constructor for '${baseName}' first.`, { start: ann.commentStart, end: ann.commentEnd });
332
+ engine.instanceCallables.delete(baseName);
333
+ }
334
+ }
335
+ }
336
+ // Enforce: every `Name#method` / `Name.method` annotation requires a
337
+ // corresponding `Name` to exist as a value-level definition. A method
338
+ // or static annotation is meaningless when its receiver type does not
339
+ // exist as a constructor / class / sumtype in scope. Orphan local
340
+ // entries are diagnosed and removed from the annotation map so they
341
+ // are never registered into the method registry.
342
+ //
343
+ // `Name` is considered to exist when ANY of:
344
+ // - `Name :: ...` annotation exists locally (`annotationMap`)
345
+ // - `Name :: ...` is imported via a sidecar (`importedConstructors`)
346
+ // - `Name` is a sumtype registered via `data Name = ...` (`isDataType`)
347
+ // - `Name` is declared as an ES `class Name { ... }` in the source
348
+ {
349
+ // Cheap pre-scan for class declarations. We only need NAMES here;
350
+ // running a full AST walk would be premature (the AST is parsed a
351
+ // few steps later). Matches `class Foo`, `export class Foo`, and
352
+ // `export default class Foo`.
353
+ const classNames = new Set();
354
+ const classDeclRe = /\b(?:export\s+(?:default\s+)?)?class\s+([A-Z][\w$]*)\b/g;
355
+ let m;
356
+ while ((m = classDeclRe.exec(source)) !== null) {
357
+ classNames.add(m[1]);
358
+ }
359
+ // Plain-object hosts: `const/let/var X = { ... }` used as a dictionary
360
+ // that later gets extended via `X.Y = function (...) { ... }`. Such
361
+ // hosts are valid binding-side bases for member-binding annotations
362
+ // (`// X.Y :: T` or chained `// X.Y :: SomeType#method :: T`).
363
+ const plainObjectHosts = new Set();
364
+ const plainObjRe = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*\{/g;
365
+ while ((m = plainObjRe.exec(source)) !== null) {
366
+ plainObjectHosts.add(m[1]);
367
+ }
368
+ const hasConstructor = (name) => engine.annotationMap.has(name)
369
+ || engine.importedConstructors.has(name)
370
+ || (0, dataTypeRegistry_1.isDataType)(name)
371
+ || classNames.has(name)
372
+ // Built-in types (String, Number, Array, ...) are first-class
373
+ // receivers: the method registry already serves their methods
374
+ // and `customMethods` accepts user-added entries (used by
375
+ // ::global/::types). Allow prototype-extension annotations
376
+ // like `String#equals :: String ~> String -> Boolean` to pass.
377
+ || (0, methodRegistry_1.isBuiltinType)(name)
378
+ // Plain-object hosts (`let builtIn = {}; builtIn.X = ...`) are
379
+ // valid binding-side bases for `Host.Member :: T` annotations
380
+ // (the binding is processed by the annotated member-assignment
381
+ // path). Skip the orphan check for them.
382
+ || plainObjectHosts.has(name);
383
+ const orphanMethodKeys = [];
384
+ for (const [key, ann] of engine.annotationMap) {
385
+ if (!ann.scheme)
386
+ continue;
387
+ // Chained-secondary entries (`// A :: B.x :: T`) are binding
388
+ // annotations under the second name, not static-method
389
+ // declarations on a constructor `B`. Skip the orphan check
390
+ // for them so e.g. `// Array#chain :: builtIn.Array :: T` does
391
+ // not require `builtIn` to be a declared constructor.
392
+ if (ann.chainedSecondary)
393
+ continue;
394
+ const hashIdx = key.indexOf('#');
395
+ const dotIdx = key.indexOf('.');
396
+ let baseName = null;
397
+ let kind = null;
398
+ if (hashIdx > 0) {
399
+ baseName = key.slice(0, hashIdx);
400
+ kind = 'method';
401
+ }
402
+ else if (dotIdx > 0) {
403
+ baseName = key.slice(0, dotIdx);
404
+ kind = 'static';
405
+ }
406
+ if (!baseName || !kind)
407
+ continue;
408
+ if (hasConstructor(baseName))
409
+ continue;
410
+ const label = kind === 'method' ? 'Method' : 'Static';
411
+ engine.addDiag(`${label} annotation '${key} :: ...' has no constructor '${baseName} :: ...' in scope. Declare a constructor / class / sumtype for '${baseName}' first.`, { start: ann.commentStart, end: ann.commentEnd });
412
+ orphanMethodKeys.push(key);
413
+ }
414
+ for (const key of orphanMethodKeys)
415
+ engine.annotationMap.delete(key);
416
+ }
417
+ annCtx.typeAliases = engine.typeAliases;
418
+ annCtx.typeAliasVars = engine.typeAliasVars;
419
+ // Expand type aliases in all parsed annotation types
420
+ (0, annotations_1.expandAllAnnotationAliases)(annCtx);
421
+ // Same expansion for each declaration's own annotation (same-named
422
+ // helpers in other scopes); the cached map itself stays untouched.
423
+ if (annCtx.typeAliases.size > 0 && engine.annotationsByDeclaration.size > 0) {
424
+ const expanded = new Map();
425
+ for (const [at, ann] of engine.annotationsByDeclaration) {
426
+ expanded.set(at, (0, annotations_1.expandAnnotationAliases)(annCtx.typeAliases, ann, annCtx.typeAliasVars));
427
+ }
428
+ engine.annotationsByDeclaration = expanded;
429
+ }
430
+ (0, annotations_1.registerDirectiveMethodsExpanded)(annCtx);
431
+ // Process method annotations (Name#method :: ReceiverType ~> MethodType)
432
+ (0, annotations_1.processMethodAnnotations)(engine.annotationMap);
433
+ // Process ::rep directives (constraint representations). Must run after
434
+ // processMethodAnnotations so the local `Type#method :: ...` annotation is
435
+ // present in this.annotationMap and after processConstraintDirectives so
436
+ // the named constraint is registered.
437
+ engine.fileReps = (0, annotations_1.processRepDirectives)(source, engine.annotationMap, (msg, loc) => engine.addDiag(msg, loc));
438
+ // Instances from `::types` targets: validated in their own file, so no
439
+ // diagnostics here.
440
+ for (const targetSource of annCtx.directiveRepSources ?? []) {
441
+ engine.fileReps.push(...(0, annotations_1.processRepDirectives)(targetSource, (0, commentParser_1.buildAnnotationMap)(targetSource), () => { }));
442
+ }
443
+ // Register kv constraints from method annotations so that factory results
444
+ // (which retain the annotation's parser-local kv ids) can look up constraint
445
+ // methods via lookupConstraintMethod.
446
+ for (const [, ann] of engine.annotationMap) {
447
+ if (ann.scheme?.constraints && ann.receiver && ann.methodType) {
448
+ const varNames = new Map();
449
+ (0, types_1.collectVarNames)(ann.receiver, varNames);
450
+ (0, types_1.collectVarNames)(ann.methodType, varNames);
451
+ for (const constraint of ann.scheme.constraints) {
452
+ // Validate that the constraint is defined
453
+ const def = (0, constraintRegistry_1.lookupConstraint)(constraint.className);
454
+ if (!def) {
455
+ // `TypeRep` is a witness marker, not a `::constraint` class. It is
456
+ // baked into the type (`var := TypeRep <arg>`) by
457
+ // bakeCtorConstraintsOnAnnotation, so it is never "unknown".
458
+ if (constraint.className === types_1.T_TYPEREP) {
459
+ continue;
460
+ }
461
+ // Constructor-style constraint (`Pair p => ...`): the className
462
+ // names a known type constructor rather than a ::constraint
463
+ // class. These are resolved during instantiation (the var is
464
+ // bound to the named constructor), so they are not "unknown".
465
+ const namesKnownConstructor = (0, methodRegistry_1.isBuiltinType)(constraint.className) ||
466
+ (0, dataTypeRegistry_1.isDataType)(constraint.className) ||
467
+ engine.annotationMap.has(constraint.className) ||
468
+ engine.importedConstructors.has(constraint.className) ||
469
+ (0, constraints_1.typeConstructorArity)(constraint.className) > 0;
470
+ if (namesKnownConstructor) {
471
+ continue;
472
+ }
473
+ const diagLoc = ann.signatureNameStart !== undefined && ann.signatureNameEnd !== undefined
474
+ ? { start: ann.signatureNameStart, end: ann.signatureNameEnd }
475
+ : { start: ann.commentStart, end: ann.commentEnd };
476
+ engine.addDiag(`Unknown constraint '${constraint.className}'. Define it with \`// ::constraint ${constraint.className} ${constraint.typeVarName} { ... }\``, diagLoc);
477
+ continue;
478
+ }
479
+ for (const [varId, name] of varNames) {
480
+ if (name === constraint.typeVarName) {
481
+ (0, constraints_1.registerKvConstraint)(engine, varId, constraint);
482
+ break;
483
+ }
484
+ }
485
+ }
486
+ }
487
+ }
488
+ // Bake constructor-style constraints (`Pair p => ... -> p c a`) into the
489
+ // annotation types once, centrally: when a constraint names a known type
490
+ // constructor rather than a `::constraint` class, the constrained var IS
491
+ // that constructor. Rewriting `p`/`p c a` to `Pair`/`Pair c a` (and
492
+ // dropping the constraint) here keeps instantiation, the rigid check,
493
+ // hover, and completion all consistent.
494
+ for (const [, ann] of engine.annotationMap) {
495
+ (0, constraints_1.bakeCtorConstraintsOnAnnotation)(engine, ann);
496
+ }
497
+ // The skolemizing prototype-method body path reads its `~>` signature from
498
+ // `annotationByOffset` (a SEPARATE set of annotation objects), so the bake
499
+ // must reach those too — otherwise an inner closure parameter typed `p c a`
500
+ // under a `Pair p =>` constructor constraint never resolves to `Pair c a`.
501
+ for (const [, ann] of engine.annotationByOffset) {
502
+ (0, constraints_1.bakeCtorConstraintsOnAnnotation)(engine, ann);
503
+ }
504
+ // Validate variant#method annotations (suggest Type#method instead)
505
+ (0, annotations_1.validateVariantMethodAnnotations)(engine.annotationMap, (msg, loc) => engine.addDiag(msg, loc));
506
+ // Detect sum type variants missing method implementations
507
+ (0, annotations_1.validateVariantMethodImplementations)(engine.annotationMap, source, (msg, loc, related, severity) => engine.addDiag(msg, loc, related, severity));
508
+ // Apply arity-aware HK grouping to annotations that have constraint
509
+ // variables and reference constructors with known arity. This is a
510
+ // structural transform (no re-parse) so TVar IDs are preserved.
511
+ // Must run after sumtype + method registration so arities are known.
512
+ const typeArities = (0, annotations_1.buildTypeArities)(engine.annotationMap);
513
+ if (typeArities.size > 0) {
514
+ (0, annotations_1.applyArityHKGrouping)(engine.annotationMap, engine.annotationByOffset, typeArities);
515
+ }
516
+ // Validate sumtype variant field types now that `::types` directives and
517
+ // imports have been resolved (so imported field types are known). Runs
518
+ // late — the same stage as validateAnnotationTypes — because
519
+ // processDataDirectives runs early (before ::types) only to register.
520
+ (0, annotations_1.validateDataVariantFields)(annCtx, source);
521
+ // Validate type constructors in annotations against known types
522
+ (0, annotations_1.validateAnnotationTypes)(allAnnotations, source, engine.annotationMap, engine.typeAliases, (msg, loc, severity) => engine.addDiag(msg, loc, undefined, severity));
523
+ }
524
+ //# sourceMappingURL=setupPass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupPass.js","sourceRoot":"","sources":["../../src/infer/setupPass.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,oCAAoC;AACpC,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,4EAA4E;AAC5E,yDAAyD;AACzD,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AACtE,uEAAuE;AACvE,kEAAkE;AAClE,+EAA+E;;AA4D/E,gDA2gBC;AApkBD,uCAKqB;AAErB,oDAa0B;AAC1B,iEAA4H;AAC5H,yEAAoE;AACpE,6CAA2D;AAC3D,qEAA4D;AAC5D,+CAoBuB;AACvB,mCAAyC;AACzC,+CAA4G;AAE5G;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,MAAuB,EAAE,MAAc;IACxE,uCAAuC;IACvC,MAAM,CAAC,aAAa,GAAG,IAAA,kCAAkB,EAAC,MAAM,CAAC,CAAC;IAClD,MAAM,CAAC,wBAAwB,GAAG,IAAA,6CAA6B,EAAC,MAAM,CAAC,CAAC;IACxE,MAAM,CAAC,kBAAkB,GAAG,IAAA,uCAAuB,EAAC,MAAM,CAAC,CAAC;IAE5D,yEAAyE;IACzE,yEAAyE;IACzE,0EAA0E;IAC1E,sEAAsE;IACtE,kDAAkD;IAClD,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,IAAA,kCAAkB,EAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC5D,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,UAAU,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpC,4DAA4D;gBAC5D,0DAA0D;gBAC1D,4DAA4D;gBAC5D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CAAC,CAAC;IAC/C,CAAC;IAED,oEAAoE;IACpE,IAAA,8CAAgC,EAAC,MAAM,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAE/F,0DAA0D;IAC1D,IAAA,kDAAoC,EAAC,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjJ,oEAAoE;IACpE,oEAAoE;IACpE,gEAAgE;IAChE,qEAAqE;IACrE,MAAM,WAAW,GAAG,IAAA,8BAAgB,EAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC3D,IAAI,WAAW,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACzB,IAAA,kCAAoB,EAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACrF,CAAC;IAED,yEAAyE;IACzE,wEAAwE;IACxE,6DAA6D;IAC7D,sEAAsE;IACtE,IAAA,uCAAyB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C,gEAAgE;IAChE,IAAA,qCAAuB,EAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,QAAS,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AACpK,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { InferenceEngine } from './index';
2
+ import { Type, AstNode } from '../hm/types';
3
+ import { TypeEnv } from '../hm/env';
4
+ import type * as estree from '../estree';
5
+ export { inferNamedBinding, inferFunctionDeclaration } from './stmt-bindings';
6
+ export { inferObjectDestructuring, inferDestructuringPattern } from './stmt-destructure';
7
+ /**
8
+ * Pre-bind `function` declarations in a statement list: JavaScript hoists
9
+ * them to the top of their scope, so closures defined textually earlier may
10
+ * reference them (e.g. trampoline code where `const onResolve = s => go(s)`
11
+ * precedes `function go(acc) { … onResolve … }`). Annotated declarations use
12
+ * their annotation; unannotated ones get a fresh type variable that the
13
+ * later declaration unifies with.
14
+ */
15
+ export declare function hoistFunctionDeclarations(engine: InferenceEngine, body: AstNode[], env: TypeEnv): TypeEnv;
16
+ export declare function inferProgramWithEnv(engine: InferenceEngine, program: estree.Program, env: TypeEnv): [TypeEnv, Type];
17
+ export declare function inferStatement(engine: InferenceEngine, node: AstNode, env: TypeEnv): [TypeEnv, Type];
18
+ export declare function inferVariableDeclaration(engine: InferenceEngine, node: estree.VariableDeclaration, env: TypeEnv): [TypeEnv, Type];
19
+ export declare function inferWhileStatement(engine: InferenceEngine, node: estree.WhileStatement, env: TypeEnv): [TypeEnv, Type];
20
+ export declare function inferDoWhileStatement(engine: InferenceEngine, node: estree.DoWhileStatement, env: TypeEnv): [TypeEnv, Type];
21
+ export declare function inferForStatement(engine: InferenceEngine, node: estree.ForStatement, env: TypeEnv): [TypeEnv, Type];
22
+ export declare function inferForInStatement(engine: InferenceEngine, node: estree.ForInStatement, env: TypeEnv): [TypeEnv, Type];
23
+ export declare function inferForOfStatement(engine: InferenceEngine, node: estree.ForOfStatement, env: TypeEnv): [TypeEnv, Type];
24
+ export declare function inferSwitchStatement(engine: InferenceEngine, node: estree.SwitchStatement, env: TypeEnv): [TypeEnv, Type];
25
+ export declare function inferTryStatement(engine: InferenceEngine, node: estree.TryStatement, env: TypeEnv): [TypeEnv, Type];
26
+ //# sourceMappingURL=statements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../../src/infer/statements.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK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