circle-ir 4.19.0 → 4.21.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 (262) hide show
  1. package/dist/analysis/advisories.d.ts +21 -3
  2. package/dist/analysis/advisories.d.ts.map +1 -1
  3. package/dist/analysis/advisories.js +26 -8
  4. package/dist/analysis/advisories.js.map +1 -1
  5. package/dist/analysis/arg-executing-programs.d.ts +16 -0
  6. package/dist/analysis/arg-executing-programs.d.ts.map +1 -0
  7. package/dist/analysis/arg-executing-programs.js +24 -0
  8. package/dist/analysis/arg-executing-programs.js.map +1 -0
  9. package/dist/analysis/config-loader.d.ts.map +1 -1
  10. package/dist/analysis/config-loader.js +27 -3
  11. package/dist/analysis/config-loader.js.map +1 -1
  12. package/dist/analysis/constant-caller-gate.d.ts +3 -1
  13. package/dist/analysis/constant-caller-gate.d.ts.map +1 -1
  14. package/dist/analysis/constant-caller-gate.js +108 -1
  15. package/dist/analysis/constant-caller-gate.js.map +1 -1
  16. package/dist/analysis/constant-propagation/index.d.ts.map +1 -1
  17. package/dist/analysis/constant-propagation/index.js +1 -1
  18. package/dist/analysis/constant-propagation/index.js.map +1 -1
  19. package/dist/analysis/constant-propagation/patterns.d.ts.map +1 -1
  20. package/dist/analysis/constant-propagation/patterns.js +8 -0
  21. package/dist/analysis/constant-propagation/patterns.js.map +1 -1
  22. package/dist/analysis/constant-propagation/propagator.d.ts +47 -2
  23. package/dist/analysis/constant-propagation/propagator.d.ts.map +1 -1
  24. package/dist/analysis/constant-propagation/propagator.js +422 -57
  25. package/dist/analysis/constant-propagation/propagator.js.map +1 -1
  26. package/dist/analysis/constant-propagation/types.d.ts +2 -0
  27. package/dist/analysis/constant-propagation/types.d.ts.map +1 -1
  28. package/dist/analysis/dependency-versions.d.ts +33 -0
  29. package/dist/analysis/dependency-versions.d.ts.map +1 -1
  30. package/dist/analysis/dependency-versions.js +70 -0
  31. package/dist/analysis/dependency-versions.js.map +1 -1
  32. package/dist/analysis/findings.d.ts.map +1 -1
  33. package/dist/analysis/findings.js +7 -5
  34. package/dist/analysis/findings.js.map +1 -1
  35. package/dist/analysis/interprocedural.d.ts +16 -0
  36. package/dist/analysis/interprocedural.d.ts.map +1 -1
  37. package/dist/analysis/interprocedural.js +545 -197
  38. package/dist/analysis/interprocedural.js.map +1 -1
  39. package/dist/analysis/passes/constant-propagation-pass.d.ts.map +1 -1
  40. package/dist/analysis/passes/constant-propagation-pass.js +1 -0
  41. package/dist/analysis/passes/constant-propagation-pass.js.map +1 -1
  42. package/dist/analysis/passes/cross-file-pass.d.ts.map +1 -1
  43. package/dist/analysis/passes/cross-file-pass.js +61 -0
  44. package/dist/analysis/passes/cross-file-pass.js.map +1 -1
  45. package/dist/analysis/passes/csharp-sanitizer-credit.d.ts.map +1 -1
  46. package/dist/analysis/passes/csharp-sanitizer-credit.js +60 -3
  47. package/dist/analysis/passes/csharp-sanitizer-credit.js.map +1 -1
  48. package/dist/analysis/passes/csrf-samesite-none-session-pass.d.ts +58 -0
  49. package/dist/analysis/passes/csrf-samesite-none-session-pass.d.ts.map +1 -0
  50. package/dist/analysis/passes/csrf-samesite-none-session-pass.js +159 -0
  51. package/dist/analysis/passes/csrf-samesite-none-session-pass.js.map +1 -0
  52. package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts +15 -0
  53. package/dist/analysis/passes/deserialization-safety-gate-pass.d.ts.map +1 -1
  54. package/dist/analysis/passes/deserialization-safety-gate-pass.js +60 -1
  55. package/dist/analysis/passes/deserialization-safety-gate-pass.js.map +1 -1
  56. package/dist/analysis/passes/interprocedural-pass.d.ts +23 -1
  57. package/dist/analysis/passes/interprocedural-pass.d.ts.map +1 -1
  58. package/dist/analysis/passes/interprocedural-pass.js +220 -7
  59. package/dist/analysis/passes/interprocedural-pass.js.map +1 -1
  60. package/dist/analysis/passes/language-sources-pass.d.ts +0 -18
  61. package/dist/analysis/passes/language-sources-pass.d.ts.map +1 -1
  62. package/dist/analysis/passes/language-sources-pass.js +549 -22
  63. package/dist/analysis/passes/language-sources-pass.js.map +1 -1
  64. package/dist/analysis/passes/param-source-flow-gate-pass.d.ts.map +1 -1
  65. package/dist/analysis/passes/param-source-flow-gate-pass.js +71 -1
  66. package/dist/analysis/passes/param-source-flow-gate-pass.js.map +1 -1
  67. package/dist/analysis/passes/prompt-injection-safety-gate-pass.js +1 -1
  68. package/dist/analysis/passes/prompt-injection-safety-gate-pass.js.map +1 -1
  69. package/dist/analysis/passes/resource-leak-pass.d.ts.map +1 -1
  70. package/dist/analysis/passes/resource-leak-pass.js +15 -3
  71. package/dist/analysis/passes/resource-leak-pass.js.map +1 -1
  72. package/dist/analysis/passes/scan-secrets-pass.js +2 -2
  73. package/dist/analysis/passes/scan-secrets-pass.js.map +1 -1
  74. package/dist/analysis/passes/sensitive-data-in-log-pass.d.ts +66 -0
  75. package/dist/analysis/passes/sensitive-data-in-log-pass.d.ts.map +1 -0
  76. package/dist/analysis/passes/sensitive-data-in-log-pass.js +462 -0
  77. package/dist/analysis/passes/sensitive-data-in-log-pass.js.map +1 -0
  78. package/dist/analysis/passes/sink-filter-pass.d.ts +7 -1
  79. package/dist/analysis/passes/sink-filter-pass.d.ts.map +1 -1
  80. package/dist/analysis/passes/sink-filter-pass.js +564 -22
  81. package/dist/analysis/passes/sink-filter-pass.js.map +1 -1
  82. package/dist/analysis/passes/taint-propagation-pass.d.ts +7 -3
  83. package/dist/analysis/passes/taint-propagation-pass.d.ts.map +1 -1
  84. package/dist/analysis/passes/taint-propagation-pass.js +464 -27
  85. package/dist/analysis/passes/taint-propagation-pass.js.map +1 -1
  86. package/dist/analysis/passes/xml-entity-expansion-pass.d.ts.map +1 -1
  87. package/dist/analysis/passes/xml-entity-expansion-pass.js +50 -6
  88. package/dist/analysis/passes/xml-entity-expansion-pass.js.map +1 -1
  89. package/dist/analysis/pep440-version.d.ts +40 -0
  90. package/dist/analysis/pep440-version.d.ts.map +1 -0
  91. package/dist/analysis/pep440-version.js +149 -0
  92. package/dist/analysis/pep440-version.js.map +1 -0
  93. package/dist/analysis/project-callee-escape-gate.js +1 -1
  94. package/dist/analysis/project-callee-escape-gate.js.map +1 -1
  95. package/dist/analysis/rules.d.ts.map +1 -1
  96. package/dist/analysis/rules.js +15 -0
  97. package/dist/analysis/rules.js.map +1 -1
  98. package/dist/analysis/sbom.d.ts +92 -4
  99. package/dist/analysis/sbom.d.ts.map +1 -1
  100. package/dist/analysis/sbom.js +390 -33
  101. package/dist/analysis/sbom.js.map +1 -1
  102. package/dist/analysis/taint-matcher.d.ts.map +1 -1
  103. package/dist/analysis/taint-matcher.js +124 -19
  104. package/dist/analysis/taint-matcher.js.map +1 -1
  105. package/dist/analysis/taint-propagation.d.ts +1 -0
  106. package/dist/analysis/taint-propagation.d.ts.map +1 -1
  107. package/dist/analysis/taint-propagation.js +32 -0
  108. package/dist/analysis/taint-propagation.js.map +1 -1
  109. package/dist/analysis/test-to-production-taint-gate.d.ts +13 -0
  110. package/dist/analysis/test-to-production-taint-gate.d.ts.map +1 -0
  111. package/dist/analysis/test-to-production-taint-gate.js +30 -0
  112. package/dist/analysis/test-to-production-taint-gate.js.map +1 -0
  113. package/dist/analyzer.d.ts +21 -3
  114. package/dist/analyzer.d.ts.map +1 -1
  115. package/dist/analyzer.js +83 -3
  116. package/dist/analyzer.js.map +1 -1
  117. package/dist/browser/circle-ir.js +8118 -2526
  118. package/dist/core/circle-ir-core.cjs +3098 -2280
  119. package/dist/core/circle-ir-core.js +3036 -2214
  120. package/dist/core/extractors/calls.d.ts +10 -1
  121. package/dist/core/extractors/calls.d.ts.map +1 -1
  122. package/dist/core/extractors/calls.js +148 -6
  123. package/dist/core/extractors/calls.js.map +1 -1
  124. package/dist/core/extractors/cfg.d.ts.map +1 -1
  125. package/dist/core/extractors/cfg.js +12 -0
  126. package/dist/core/extractors/cfg.js.map +1 -1
  127. package/dist/core/extractors/dfg.d.ts.map +1 -1
  128. package/dist/core/extractors/dfg.js +151 -18
  129. package/dist/core/extractors/dfg.js.map +1 -1
  130. package/dist/core/extractors/ts-declaration-detail.d.ts +8 -0
  131. package/dist/core/extractors/ts-declaration-detail.d.ts.map +1 -1
  132. package/dist/core/extractors/ts-declaration-detail.js +22 -0
  133. package/dist/core/extractors/ts-declaration-detail.js.map +1 -1
  134. package/dist/core/extractors/types.d.ts +5 -0
  135. package/dist/core/extractors/types.d.ts.map +1 -1
  136. package/dist/core/extractors/types.js +149 -4
  137. package/dist/core/extractors/types.js.map +1 -1
  138. package/dist/core/parser.d.ts.map +1 -1
  139. package/dist/core/parser.js +3 -1
  140. package/dist/core/parser.js.map +1 -1
  141. package/dist/core/ts-grammar-workarounds.d.ts +18 -0
  142. package/dist/core/ts-grammar-workarounds.d.ts.map +1 -0
  143. package/dist/core/ts-grammar-workarounds.js +40 -0
  144. package/dist/core/ts-grammar-workarounds.js.map +1 -0
  145. package/dist/facts/arrow.d.ts +106 -0
  146. package/dist/facts/arrow.d.ts.map +1 -0
  147. package/dist/facts/arrow.js +196 -0
  148. package/dist/facts/arrow.js.map +1 -0
  149. package/dist/facts/facts2.d.ts +68 -0
  150. package/dist/facts/facts2.d.ts.map +1 -0
  151. package/dist/facts/facts2.js +379 -0
  152. package/dist/facts/facts2.js.map +1 -0
  153. package/dist/facts/index.d.ts +22 -0
  154. package/dist/facts/index.d.ts.map +1 -0
  155. package/dist/facts/index.js +15 -0
  156. package/dist/facts/index.js.map +1 -0
  157. package/dist/facts/java-facts.d.ts +56 -0
  158. package/dist/facts/java-facts.d.ts.map +1 -0
  159. package/dist/facts/java-facts.js +250 -0
  160. package/dist/facts/java-facts.js.map +1 -0
  161. package/dist/facts/order.d.ts +39 -0
  162. package/dist/facts/order.d.ts.map +1 -0
  163. package/dist/facts/order.js +120 -0
  164. package/dist/facts/order.js.map +1 -0
  165. package/dist/facts/schema.d.ts +60 -0
  166. package/dist/facts/schema.d.ts.map +1 -0
  167. package/dist/facts/schema.js +126 -0
  168. package/dist/facts/schema.js.map +1 -0
  169. package/dist/facts/schema2.d.ts +47 -0
  170. package/dist/facts/schema2.d.ts.map +1 -0
  171. package/dist/facts/schema2.js +194 -0
  172. package/dist/facts/schema2.js.map +1 -0
  173. package/dist/facts/t6.d.ts +84 -0
  174. package/dist/facts/t6.d.ts.map +1 -0
  175. package/dist/facts/t6.js +226 -0
  176. package/dist/facts/t6.js.map +1 -0
  177. package/dist/facts/table.d.ts +80 -0
  178. package/dist/facts/table.d.ts.map +1 -0
  179. package/dist/facts/table.js +548 -0
  180. package/dist/facts/table.js.map +1 -0
  181. package/dist/graph-facts/dead-code.d.ts +2 -0
  182. package/dist/graph-facts/dead-code.d.ts.map +1 -1
  183. package/dist/graph-facts/dead-code.js +4 -3
  184. package/dist/graph-facts/dead-code.js.map +1 -1
  185. package/dist/graph-facts/index.d.ts +1 -1
  186. package/dist/graph-facts/index.d.ts.map +1 -1
  187. package/dist/graph-facts/index.js +1 -1
  188. package/dist/graph-facts/index.js.map +1 -1
  189. package/dist/graph-facts/reach.d.ts +53 -8
  190. package/dist/graph-facts/reach.d.ts.map +1 -1
  191. package/dist/graph-facts/reach.js +172 -16
  192. package/dist/graph-facts/reach.js.map +1 -1
  193. package/dist/graph-facts/removal-reach.d.ts +2 -0
  194. package/dist/graph-facts/removal-reach.d.ts.map +1 -1
  195. package/dist/graph-facts/removal-reach.js +1 -1
  196. package/dist/graph-facts/removal-reach.js.map +1 -1
  197. package/dist/index.d.ts +15 -7
  198. package/dist/index.d.ts.map +1 -1
  199. package/dist/index.js +19 -4
  200. package/dist/index.js.map +1 -1
  201. package/dist/navigation/index.d.ts +1 -0
  202. package/dist/navigation/index.d.ts.map +1 -1
  203. package/dist/navigation/index.js +1 -0
  204. package/dist/navigation/index.js.map +1 -1
  205. package/dist/navigation/java-graph.d.ts +47 -2
  206. package/dist/navigation/java-graph.d.ts.map +1 -1
  207. package/dist/navigation/java-graph.js +395 -18
  208. package/dist/navigation/java-graph.js.map +1 -1
  209. package/dist/navigation/java-registrations.d.ts +93 -0
  210. package/dist/navigation/java-registrations.d.ts.map +1 -0
  211. package/dist/navigation/java-registrations.js +254 -0
  212. package/dist/navigation/java-registrations.js.map +1 -0
  213. package/dist/navigation/navigation-index.d.ts +74 -3
  214. package/dist/navigation/navigation-index.d.ts.map +1 -1
  215. package/dist/navigation/navigation-index.js +206 -11
  216. package/dist/navigation/navigation-index.js.map +1 -1
  217. package/dist/navigation/ts-call-edges.d.ts +15 -0
  218. package/dist/navigation/ts-call-edges.d.ts.map +1 -1
  219. package/dist/navigation/ts-call-edges.js.map +1 -1
  220. package/dist/navigation/ts-entry-tables.d.ts +1 -1
  221. package/dist/navigation/ts-entry-tables.d.ts.map +1 -1
  222. package/dist/navigation/ts-entry-tables.js.map +1 -1
  223. package/dist/navigation/xml-scan.d.ts +40 -0
  224. package/dist/navigation/xml-scan.d.ts.map +1 -0
  225. package/dist/navigation/xml-scan.js +269 -0
  226. package/dist/navigation/xml-scan.js.map +1 -0
  227. package/dist/resolution/cross-file.d.ts +44 -0
  228. package/dist/resolution/cross-file.d.ts.map +1 -1
  229. package/dist/resolution/cross-file.js +259 -13
  230. package/dist/resolution/cross-file.js.map +1 -1
  231. package/dist/stable-ids/files.d.ts +22 -0
  232. package/dist/stable-ids/files.d.ts.map +1 -0
  233. package/dist/stable-ids/files.js +28 -0
  234. package/dist/stable-ids/files.js.map +1 -0
  235. package/dist/stable-ids/hash.d.ts +16 -4
  236. package/dist/stable-ids/hash.d.ts.map +1 -1
  237. package/dist/stable-ids/hash.js +266 -80
  238. package/dist/stable-ids/hash.js.map +1 -1
  239. package/dist/stable-ids/index.d.ts +6 -5
  240. package/dist/stable-ids/index.d.ts.map +1 -1
  241. package/dist/stable-ids/index.js +19 -6
  242. package/dist/stable-ids/index.js.map +1 -1
  243. package/dist/stable-ids/nodes.d.ts +61 -7
  244. package/dist/stable-ids/nodes.d.ts.map +1 -1
  245. package/dist/stable-ids/nodes.js +134 -21
  246. package/dist/stable-ids/nodes.js.map +1 -1
  247. package/dist/stable-ids/ts-parse-errors.d.ts +5 -1
  248. package/dist/stable-ids/ts-parse-errors.d.ts.map +1 -1
  249. package/dist/stable-ids/ts-parse-errors.js +55 -3
  250. package/dist/stable-ids/ts-parse-errors.js.map +1 -1
  251. package/dist/stable-ids/typescript.d.ts +5 -0
  252. package/dist/stable-ids/typescript.d.ts.map +1 -1
  253. package/dist/stable-ids/typescript.js +41 -8
  254. package/dist/stable-ids/typescript.js.map +1 -1
  255. package/dist/types/index.d.ts +21 -3
  256. package/dist/types/index.d.ts.map +1 -1
  257. package/dist/types/index.js +1 -0
  258. package/dist/types/index.js.map +1 -1
  259. package/docs/SPEC.md +9 -0
  260. package/package.json +9 -5
  261. package/schemas/facts@1.json +134 -0
  262. package/schemas/facts@2.json +216 -0
@@ -18,7 +18,10 @@
18
18
  * the receiver as an expression string. The chain is walked left to right,
19
19
  * typing each step from the previous step's declared return type.
20
20
  * - **A constructor.** `new Widget()` arrives as a call named `Widget` with
21
- * no receiver. It is bound to `app.Widget.<init>`.
21
+ * no receiver. It is bound to `app.Widget.<init>`. An explicit
22
+ * `super(…)` or `this(…)` arrives as a constructor call named `super` or
23
+ * `this`, naming the superclass or the enclosing type, and binds the same
24
+ * way.
22
25
  * - **A nested type's static import.** `import static app.Outer.Inner.make`
23
26
  * names `app.Outer.Inner.make`, which only matches a symbol table that
24
27
  * kept the nesting — hence `TypeInfo.enclosing_type`.
@@ -159,6 +162,15 @@ export declare class NavigationIndex {
159
162
  * has one). Anything else is `unresolved` with the same reason a query
160
163
  * would give.
161
164
  */
165
+ /**
166
+ * Every type in the tree that extends or implements `fqn`, directly or through other
167
+ * types in the tree (cognium-dev#1092: the bound of a reflective load). `fqn` may be
168
+ * outside the tree (`java.security.Provider`); a supertype the declaring file could not
169
+ * resolve is keyed by its simple name, so that is tried too.
170
+ */
171
+ subtypesOf(fqn: string): string[];
172
+ /** Whether `fqn` is a type declared in the tree. */
173
+ hasType(fqn: string): boolean;
162
174
  callSites(): IndexedCallSite[];
163
175
  /** The type outside the tree an `external` site lands on: its receiver, the constructed type, or a static import's owner. */
164
176
  private foreignTypeOf;
@@ -211,7 +223,11 @@ export declare class NavigationIndex {
211
223
  * overrides it below.
212
224
  */
213
225
  private tierFor;
214
- /** `new Widget()` → `app.Widget.<init>`, with the constructor chosen like any overload. */
226
+ /**
227
+ * `new Widget()` → `app.Widget.<init>`, with the constructor chosen like any
228
+ * overload. An explicit constructor invocation (`super(…)` / `this(…)`)
229
+ * binds the same way, to the class the extractor names for it.
230
+ */
215
231
  private bindConstructor;
216
232
  /**
217
233
  * The overloads of `name` a receiver of type `fqn` can see: its own, then
@@ -235,7 +251,18 @@ export declare class NavigationIndex {
235
251
  private selectOverload;
236
252
  /** Whether `c` applies to arguments of these types in compiler phase 1, 2 or 3. */
237
253
  private applicable;
238
- /** `m` is more specific than `o`: each of its parameter types fits the other's. */
254
+ /**
255
+ * `m` is more specific than `o`: each of its parameter types fits the other's.
256
+ *
257
+ * A reference parameter type of `m` that is the argument's own type also
258
+ * counts where it only possibly fits `o`'s: whenever `o` applies, the
259
+ * argument's type, which is `m`'s, is a subtype of `o`'s there, so in every
260
+ * case where `o` competes `m` is the more specific. That settles
261
+ * `this(ctx, copy, (String) null)` against a `ResultSet` overload when
262
+ * `copy`'s class has a supertype outside the tree. An argument of a
263
+ * narrower type than `m`'s parameter is not the same question and stays
264
+ * undecided.
265
+ */
239
266
  private moreSpecific;
240
267
  /**
241
268
  * Whether a value of type `a` can be passed as `p` — certainly, possibly,
@@ -392,6 +419,50 @@ export declare class NavigationIndex {
392
419
  private uniqueByName;
393
420
  /** A simple or qualified type name, resolved from one file's point of view. */
394
421
  private resolveTypeRecord;
422
+ /**
423
+ * The class an explicit constructor invocation constructs.
424
+ *
425
+ * `this(…)`: the enclosing type, which the extractor names exactly.
426
+ *
427
+ * `super(…)`: the superclass as written, resolved the way Java resolves a
428
+ * name in the class's `extends` clause.
429
+ *
430
+ * 1. A member type of an enclosing type, innermost first: declared there or
431
+ * inherited from a supertype in the tree. The class's own members are
432
+ * not in scope in its own `extends` clause. A member type hides an
433
+ * imported or same-package type with the same name.
434
+ * 2. An exact name, an import, the same package.
435
+ * 3. The extractor's qualified name. For an implicitly imported `java.lang`
436
+ * type it is outside the tree, so `extends Exception` stays
437
+ * `java.lang.Exception` even when some package in the tree declares an
438
+ * `Exception`.
439
+ * 4. A type one of the file's wildcard imports names (`import a.b.*`, or
440
+ * `import a.Outer.*` for its member types), when exactly one does.
441
+ *
442
+ * Anything else is left unbound. A type nested somewhere else in the file
443
+ * is not in scope. A type of the same simple name elsewhere in the tree
444
+ * that no import names may not be the one meant: the name can come from a
445
+ * wildcard package outside the tree, from `java.lang`, or from a supertype
446
+ * outside the tree.
447
+ */
448
+ private invokedConstructorType;
449
+ /**
450
+ * `name` (`Node`, or `Node.Leaf`) as a member type in scope inside the type
451
+ * at nesting path `inType` (`Tree.Leaf`) of this file. The types enclosing
452
+ * it are searched innermost first, the type itself excluded. Each is
453
+ * searched with its supertypes in the tree, so an inherited member type
454
+ * counts. Present when the first part of `name` is such a member;
455
+ * `type` is then the declaration, or undefined when the rest of `name` is
456
+ * not in the tree. Absent when no enclosing type has that member.
457
+ */
458
+ private memberTypeInScope;
459
+ /** `fqn`, or the nearest of its supertypes in the tree, that has a member type `name`. */
460
+ private memberTypeOwner;
461
+ /**
462
+ * `anywhere`: also a type nested in a type of this file, then a simple name
463
+ * declared once in the whole tree. Off, only an exact name, an import and
464
+ * the same package.
465
+ */
395
466
  private resolveTypeName;
396
467
  /**
397
468
  * Why a site in range produced no answer.
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-index.d.ts","sourceRoot":"","sources":["../../src/navigation/navigation-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAoC,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,KAAK,EAGV,gBAAgB,EAChB,KAAK,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O,CAAC,QAAQ;IAahB,uEAAuE;IACvE,OAAO,CAAC,sBAAsB;IAoB9B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,UAAU;IASlB;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB;IAkBxB,iFAAiF;IACjF,OAAO,CAAC,YAAY;IASpB,+EAA+E;IAC/E,OAAO,CAAC,iBAAiB;IAKzB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;;;;;;;OAQG;IACH,OAAO,CAAC,iBAAiB;IAczB,0FAA0F;IAC1F,OAAO,CAAC,eAAe;IAkBvB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAuBvB;;;;;;;OAOG;IACH,OAAO,CAAC,SAAS;IAuCjB,oEAAoE;IACpE,OAAO,CAAC,gBAAgB;IA+BxB,2EAA2E;IAC3E,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,MAAM;IAMd,2DAA2D;IAC3D,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,WAAW;IAqBnB,OAAO,CAAC,MAAM;IAYd,OAAO,CAAC,MAAM;CA6Cf"}
@@ -18,7 +18,10 @@
18
18
  * the receiver as an expression string. The chain is walked left to right,
19
19
  * typing each step from the previous step's declared return type.
20
20
  * - **A constructor.** `new Widget()` arrives as a call named `Widget` with
21
- * no receiver. It is bound to `app.Widget.<init>`.
21
+ * no receiver. It is bound to `app.Widget.<init>`. An explicit
22
+ * `super(…)` or `this(…)` arrives as a constructor call named `super` or
23
+ * `this`, naming the superclass or the enclosing type, and binds the same
24
+ * way.
22
25
  * - **A nested type's static import.** `import static app.Outer.Inner.make`
23
26
  * names `app.Outer.Inner.make`, which only matches a symbol table that
24
27
  * kept the nesting — hence `TypeInfo.enclosing_type`.
@@ -394,6 +397,31 @@ export class NavigationIndex {
394
397
  * has one). Anything else is `unresolved` with the same reason a query
395
398
  * would give.
396
399
  */
400
+ /**
401
+ * Every type in the tree that extends or implements `fqn`, directly or through other
402
+ * types in the tree (cognium-dev#1092: the bound of a reflective load). `fqn` may be
403
+ * outside the tree (`java.security.Provider`); a supertype the declaring file could not
404
+ * resolve is keyed by its simple name, so that is tried too.
405
+ */
406
+ subtypesOf(fqn) {
407
+ const out = new Set();
408
+ const simple = fqn.slice(fqn.lastIndexOf('.') + 1);
409
+ const frontier = [fqn, simple];
410
+ while (frontier.length > 0) {
411
+ const cur = frontier.pop();
412
+ for (const sub of this.subtypes.get(cur) ?? []) {
413
+ if (out.has(sub))
414
+ continue;
415
+ out.add(sub);
416
+ frontier.push(sub);
417
+ }
418
+ }
419
+ return [...out].sort();
420
+ }
421
+ /** Whether `fqn` is a type declared in the tree. */
422
+ hasType(fqn) {
423
+ return this.typesByFqn.has(fqn);
424
+ }
397
425
  callSites() {
398
426
  const out = [];
399
427
  const files = [...this.files.values()].sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
@@ -443,7 +471,16 @@ export class NavigationIndex {
443
471
  const bare = name?.replace(/<.*>$/, '').replace(/\[\]$/, '').trim();
444
472
  if (!bare)
445
473
  return undefined;
446
- return bare.includes('.') ? bare : rec.imports.get(bare) ?? bare;
474
+ if (bare.includes('.'))
475
+ return bare;
476
+ const imported = rec.imports.get(bare);
477
+ if (imported)
478
+ return imported;
479
+ const ownsSimple = (rec.pkg ? this.typesByFqn.has(`${rec.pkg}.${bare}`) : false) ||
480
+ [...this.typesBySimpleName.get(bare) ?? []].some((t) => t.file === rec.path);
481
+ if (!ownsSimple && (JAVA_LANG.has(bare) || bare in JDK_SUPERS))
482
+ return `java.lang.${bare}`;
483
+ return bare;
447
484
  }
448
485
  targetOf(owner, name, overload) {
449
486
  if (overload)
@@ -643,8 +680,13 @@ export class NavigationIndex {
643
680
  : `${evidence}; ${method} is the unique method of that name on ${owner.fqn}, and it has a body`,
644
681
  };
645
682
  }
646
- /** `new Widget()` → `app.Widget.<init>`, with the constructor chosen like any overload. */
683
+ /**
684
+ * `new Widget()` → `app.Widget.<init>`, with the constructor chosen like any
685
+ * overload. An explicit constructor invocation (`super(…)` / `this(…)`)
686
+ * binds the same way, to the class the extractor names for it.
687
+ */
647
688
  bindConstructor(call, rec, depth) {
689
+ const explicit = isExplicitConstructorInvocation(call);
648
690
  const looksCtor = call.is_constructor === true ||
649
691
  (call.receiver === null &&
650
692
  !!call.receiver_type &&
@@ -652,13 +694,41 @@ export class NavigationIndex {
652
694
  /^[A-Z]/.test(call.method_name));
653
695
  if (!looksCtor)
654
696
  return undefined;
655
- const t = this.resolveTypeRecord(call.receiver_type ?? call.method_name, rec);
697
+ const rawType = call.receiver_type ?? call.method_name;
698
+ const simpleCtorName = rawType?.replace(/<.*>$/, '').trim();
699
+ let t;
700
+ if (explicit) {
701
+ t = this.invokedConstructorType(call, rec);
702
+ }
703
+ else if (simpleCtorName) {
704
+ const member = this.memberTypeInScope(simpleCtorName, call.in_type, rec);
705
+ if (member?.type) {
706
+ t = member.type;
707
+ }
708
+ else {
709
+ const enclFqn = call.in_type != null && call.in_type !== ''
710
+ ? [rec.pkg, ...call.in_type.split('.')].filter(Boolean).join('.')
711
+ : this.enclosingTypeOf(call, rec)?.fqn;
712
+ if (enclFqn) {
713
+ const owner = this.memberTypeOwner(enclFqn, simpleCtorName);
714
+ if (owner)
715
+ t = this.typesByFqn.get(`${owner}.${simpleCtorName}`);
716
+ }
717
+ }
718
+ if (!t)
719
+ t = this.resolveTypeRecord(rawType, rec);
720
+ }
721
+ else {
722
+ t = this.resolveTypeRecord(rawType, rec);
723
+ }
656
724
  if (!t)
657
725
  return undefined;
658
726
  const result = {
659
727
  target: `${t.fqn}.<init>`,
660
728
  tier: 'exact',
661
- evidence: `object creation of ${t.fqn}, declared at ${t.file}:${t.startLine}`,
729
+ evidence: explicit
730
+ ? `${call.method_name}(…) runs a constructor of ${t.fqn}, declared at ${t.file}:${t.startLine}`
731
+ : `object creation of ${t.fqn}, declared at ${t.file}:${t.startLine}`,
662
732
  };
663
733
  const ctors = this.declaredOverloads(t, '<init>').map(overload => ({ owner: t, overload }));
664
734
  // A type with no declared constructor has the implicit one; a call that
@@ -777,7 +847,7 @@ export class NavigationIndex {
777
847
  const C = P.filter(c => fit.get(c)[phase - 1] === 'yes');
778
848
  if (C.length === 0)
779
849
  return { kind: 'ambiguous', candidates: possible };
780
- const best = C.find(m => P.every(o => o === m || this.moreSpecific(m, o, phase, self)));
850
+ const best = C.find(m => P.every(o => o === m || this.moreSpecific(m, o, phase, self, args)));
781
851
  if (best) {
782
852
  return {
783
853
  kind: 'one',
@@ -812,15 +882,32 @@ export class NavigationIndex {
812
882
  args.forEach((a, i) => meet(this.fits(a, i < params.length - 1 ? params[i] : elem, 2)));
813
883
  return worst;
814
884
  }
815
- /** `m` is more specific than `o`: each of its parameter types fits the other's. */
816
- moreSpecific(m, o, phase, self) {
885
+ /**
886
+ * `m` is more specific than `o`: each of its parameter types fits the other's.
887
+ *
888
+ * A reference parameter type of `m` that is the argument's own type also
889
+ * counts where it only possibly fits `o`'s: whenever `o` applies, the
890
+ * argument's type, which is `m`'s, is a subtype of `o`'s there, so in every
891
+ * case where `o` competes `m` is the more specific. That settles
892
+ * `this(ctx, copy, (String) null)` against a `ResultSet` overload when
893
+ * `copy`'s class has a supertype outside the tree. An argument of a
894
+ * narrower type than `m`'s parameter is not the same question and stays
895
+ * undecided.
896
+ */
897
+ moreSpecific(m, o, phase, self, args) {
817
898
  if (phase === 3)
818
899
  return false;
819
900
  const mp = this.paramRefsFrom(m, self);
820
901
  const op = this.paramRefsFrom(o, self);
821
902
  if (mp.length !== op.length)
822
903
  return false;
823
- return mp.every((t, i) => this.fits(t, op[i], 1) === 'yes');
904
+ return mp.every((t, i) => {
905
+ const f = this.fits(t, op[i], 1);
906
+ if (f === 'yes')
907
+ return true;
908
+ const a = args?.[i];
909
+ return f === 'maybe' && !!a && isArgumentsOwnType(a, t);
910
+ });
824
911
  }
825
912
  /**
826
913
  * Whether a value of type `a` can be passed as `p` — certainly, possibly,
@@ -1716,7 +1803,101 @@ export class NavigationIndex {
1716
1803
  const fqn = this.resolveTypeName(name, rec);
1717
1804
  return fqn ? this.typesByFqn.get(fqn) : undefined;
1718
1805
  }
1719
- resolveTypeName(name, rec) {
1806
+ /**
1807
+ * The class an explicit constructor invocation constructs.
1808
+ *
1809
+ * `this(…)`: the enclosing type, which the extractor names exactly.
1810
+ *
1811
+ * `super(…)`: the superclass as written, resolved the way Java resolves a
1812
+ * name in the class's `extends` clause.
1813
+ *
1814
+ * 1. A member type of an enclosing type, innermost first: declared there or
1815
+ * inherited from a supertype in the tree. The class's own members are
1816
+ * not in scope in its own `extends` clause. A member type hides an
1817
+ * imported or same-package type with the same name.
1818
+ * 2. An exact name, an import, the same package.
1819
+ * 3. The extractor's qualified name. For an implicitly imported `java.lang`
1820
+ * type it is outside the tree, so `extends Exception` stays
1821
+ * `java.lang.Exception` even when some package in the tree declares an
1822
+ * `Exception`.
1823
+ * 4. A type one of the file's wildcard imports names (`import a.b.*`, or
1824
+ * `import a.Outer.*` for its member types), when exactly one does.
1825
+ *
1826
+ * Anything else is left unbound. A type nested somewhere else in the file
1827
+ * is not in scope. A type of the same simple name elsewhere in the tree
1828
+ * that no import names may not be the one meant: the name can come from a
1829
+ * wildcard package outside the tree, from `java.lang`, or from a supertype
1830
+ * outside the tree.
1831
+ */
1832
+ invokedConstructorType(call, rec) {
1833
+ const name = call.receiver_type?.replace(/<.*>$/, '').trim();
1834
+ if (!name)
1835
+ return undefined;
1836
+ if (call.method_name === 'this') {
1837
+ return call.receiver_type_fqn ? this.typesByFqn.get(call.receiver_type_fqn) : this.resolveTypeRecord(name, rec);
1838
+ }
1839
+ const member = this.memberTypeInScope(name, call.in_type, rec);
1840
+ if (member)
1841
+ return member.type;
1842
+ const scoped = this.resolveTypeName(name, rec, false);
1843
+ if (scoped)
1844
+ return this.typesByFqn.get(scoped);
1845
+ if (call.receiver_type_fqn)
1846
+ return this.typesByFqn.get(call.receiver_type_fqn);
1847
+ const viaWildcard = [...new Set(rec.staticWildcards)].map(w => this.typesByFqn.get(`${w}.${name}`)).filter((t) => t !== undefined);
1848
+ return viaWildcard.length === 1 ? viaWildcard[0] : undefined;
1849
+ }
1850
+ /**
1851
+ * `name` (`Node`, or `Node.Leaf`) as a member type in scope inside the type
1852
+ * at nesting path `inType` (`Tree.Leaf`) of this file. The types enclosing
1853
+ * it are searched innermost first, the type itself excluded. Each is
1854
+ * searched with its supertypes in the tree, so an inherited member type
1855
+ * counts. Present when the first part of `name` is such a member;
1856
+ * `type` is then the declaration, or undefined when the rest of `name` is
1857
+ * not in the tree. Absent when no enclosing type has that member.
1858
+ */
1859
+ memberTypeInScope(name, inType, rec) {
1860
+ if (!inType)
1861
+ return undefined;
1862
+ const dot = name.indexOf('.');
1863
+ const head = dot < 0 ? name : name.slice(0, dot);
1864
+ const rest = dot < 0 ? '' : name.slice(dot);
1865
+ const path = inType.split('.');
1866
+ for (let k = path.length - 1; k >= 1; k--) {
1867
+ const enclosing = [rec.pkg, ...path.slice(0, k)].filter(Boolean).join('.');
1868
+ const owner = this.memberTypeOwner(enclosing, head);
1869
+ if (owner)
1870
+ return { type: this.typesByFqn.get(`${owner}.${head}${rest}`) };
1871
+ }
1872
+ return undefined;
1873
+ }
1874
+ /** `fqn`, or the nearest of its supertypes in the tree, that has a member type `name`. */
1875
+ memberTypeOwner(fqn, name) {
1876
+ const seen = new Set();
1877
+ const queue = [fqn];
1878
+ while (queue.length > 0) {
1879
+ const f = queue.shift();
1880
+ if (seen.has(f))
1881
+ continue;
1882
+ seen.add(f);
1883
+ if (this.typesByFqn.has(`${f}.${name}`))
1884
+ return f;
1885
+ const t = this.typesByFqn.get(f);
1886
+ const frec = t ? this.files.get(t.file) : undefined;
1887
+ for (const sup of t?.superNames ?? []) {
1888
+ const supFqn = frec ? this.resolveTypeName(sup, frec) : undefined;
1889
+ if (supFqn)
1890
+ queue.push(supFqn);
1891
+ }
1892
+ }
1893
+ return undefined;
1894
+ }
1895
+ /**
1896
+ * `anywhere`: also a type nested in a type of this file, then a simple name
1897
+ * declared once in the whole tree. Off, only an exact name, an import and
1898
+ * the same package.
1899
+ */
1900
+ resolveTypeName(name, rec, anywhere = true) {
1720
1901
  const bare = name.replace(/<.*>$/, '').replace(/\[\]$/, '').trim();
1721
1902
  if (!bare)
1722
1903
  return undefined;
@@ -1725,10 +1906,12 @@ export class NavigationIndex {
1725
1906
  const imported = rec.imports.get(bare);
1726
1907
  if (imported && this.typesByFqn.has(imported))
1727
1908
  return imported;
1728
- // Same package, including a nested type of a type in this file.
1909
+ // Same package (a qualified `Outer.Inner` of the package included).
1729
1910
  const samePkg = rec.pkg ? `${rec.pkg}.${bare}` : bare;
1730
1911
  if (this.typesByFqn.has(samePkg))
1731
1912
  return samePkg;
1913
+ if (!anywhere)
1914
+ return undefined;
1732
1915
  for (const t of rec.types) {
1733
1916
  const nested = `${t.fqn}.${bare}`;
1734
1917
  if (this.typesByFqn.has(nested))
@@ -1929,6 +2112,18 @@ export class NavigationIndex {
1929
2112
  }
1930
2113
  }
1931
2114
  // ------------------------------------------------------------------ helpers
2115
+ /**
2116
+ * `p` is exactly the argument's type `a`: the same resolved reference type,
2117
+ * array depth included, with no type variable on either side.
2118
+ */
2119
+ function isArgumentsOwnType(a, p) {
2120
+ return !a.prim && !p.prim && !a.typeVar && !p.typeVar && !p.opaque && !a.inferred
2121
+ && a.fqn !== null && a.fqn === p.fqn && a.dims === p.dims;
2122
+ }
2123
+ /** `super(…)` / `this(…)` as the extractor writes it: a constructor call named by the keyword. */
2124
+ function isExplicitConstructorInvocation(call) {
2125
+ return call.is_constructor === true && (call.method_name === 'super' || call.method_name === 'this');
2126
+ }
1932
2127
  function buildFileRecord(f) {
1933
2128
  const pkg = f.ir.meta?.package ?? '';
1934
2129
  const imports = new Map();