@eagleoutice/flowr 2.14.2 → 2.14.4

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 (58) hide show
  1. package/README.md +30 -42
  2. package/abstract-interpretation/absint-visitor.d.ts +45 -4
  3. package/abstract-interpretation/absint-visitor.js +252 -53
  4. package/config.d.ts +15 -8
  5. package/config.js +4 -1
  6. package/control-flow/semantic-cfg-guided-visitor.d.ts +7 -7
  7. package/control-flow/semantic-cfg-guided-visitor.js +23 -0
  8. package/dataflow/environments/default-builtin-config.d.ts +4 -13
  9. package/dataflow/environments/default-builtin-config.js +59 -23
  10. package/dataflow/environments/group-generics.d.ts +27 -0
  11. package/dataflow/environments/group-generics.js +39 -0
  12. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  13. package/dataflow/eval/resolve/alias-tracking.js +1 -1
  14. package/dataflow/info.d.ts +1 -6
  15. package/dataflow/info.js +0 -17
  16. package/dataflow/internal/control-flow.d.ts +14 -2
  17. package/dataflow/internal/control-flow.js +24 -0
  18. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +10 -1
  19. package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +1 -1
  20. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +11 -10
  21. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +1 -2
  22. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +1 -1
  23. package/dataflow/internal/process/functions/call/built-in/built-in-quote.d.ts +1 -1
  24. package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -0
  25. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +1 -1
  26. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +7 -2
  27. package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +1 -1
  28. package/dataflow/internal/process/functions/call/known-call-handling.js +21 -17
  29. package/documentation/doc-readme.js +0 -12
  30. package/documentation/wiki-absint.js +7 -2
  31. package/documentation/wiki-interface.js +1 -0
  32. package/documentation/wiki-signature-database.js +6 -1
  33. package/linter/rules/deprecated-functions.js +4 -2
  34. package/linter/rules/unused-definition.js +3 -3
  35. package/package.json +1 -1
  36. package/project/dependency-version-space.d.ts +1 -0
  37. package/project/dependency-version-space.js +1 -1
  38. package/project/flowr-analyzer-builder.d.ts +4 -4
  39. package/project/sigdb/reader.d.ts +6 -0
  40. package/project/sigdb/reader.js +2 -2
  41. package/project/sigdb/schema.d.ts +13 -1
  42. package/project/sigdb/schema.js +3 -1
  43. package/project/sigdb/signature-db.d.ts +4 -0
  44. package/project/sigdb/signature-db.js +8 -1
  45. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +1 -1
  46. package/queries/catalog/signature-query/signature-query-executor.d.ts +7 -2
  47. package/queries/catalog/signature-query/signature-query-executor.js +24 -9
  48. package/queries/catalog/signature-query/signature-query-format.d.ts +14 -3
  49. package/queries/catalog/signature-query/signature-query-render.js +6 -0
  50. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +7 -0
  51. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +7 -0
  52. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -1
  53. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +0 -5
  54. package/search/search-executor/search-enrichers.d.ts +4 -0
  55. package/search/search-executor/search-enrichers.js +4 -4
  56. package/util/objects.d.ts +15 -4
  57. package/util/text/name-rank.js +8 -2
  58. package/util/version.js +1 -1
package/README.md CHANGED
@@ -47,7 +47,7 @@ It offers a wide variety of features, for example:
47
47
 
48
48
  ```shell
49
49
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
50
- flowR repl v2.14.1, R grammar v14 (tree-sitter engine)
50
+ flowR repl v2.14.2, R grammar v14 (tree-sitter engine)
51
51
  R> :query @linter "read.csv(\"/root/x.txt\")"
52
52
  ```
53
53
 
@@ -56,7 +56,7 @@ It offers a wide variety of features, for example:
56
56
 
57
57
 
58
58
  ```text
59
- Query: linter (3 ms)
59
+ Query: linter (12 ms)
60
60
  ╰ Deprecated Functions (deprecated-functions): no findings
61
61
  ╰ File Path Validity (file-path-validity): no findings
62
62
  ╰ Seeded Randomness (seeded-randomness): no findings
@@ -73,7 +73,7 @@ It offers a wide variety of features, for example:
73
73
  ╰ Undefined Symbol (undefined-symbol): no findings
74
74
  ╰ Unused Import (unused-import): no findings
75
75
  ╰ Unclosed Connection (unclosed-connection): no findings
76
- All queries together required ≈3 ms (1ms accuracy, total 3 ms)
76
+ All queries together required ≈12 ms (1ms accuracy, total 14 ms)
77
77
  ```
78
78
 
79
79
 
@@ -95,17 +95,17 @@ It offers a wide variety of features, for example:
95
95
 
96
96
  _Results (prettified and summarized):_
97
97
 
98
- Query: **linter** (3 ms)\
98
+ Query: **linter** (542 ms)\
99
99
     ╰ **Deprecated Functions** (deprecated-functions): _no findings_\
100
100
     ╰ **File Path Validity** (file-path-validity):\
101
101
         ╰ certain:\
102
102
             ╰ Path `/root/x.txt` at 1.1-23\
103
-        ╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 0, processTimeMs: 0\
103
+        ╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 5, processTimeMs: 2\
104
104
     ╰ **Seeded Randomness** (seeded-randomness): _no findings_\
105
105
     ╰ **Absolute Paths** (absolute-file-paths):\
106
106
         ╰ certain:\
107
107
             ╰ Path `/root/x.txt` at 1.1-23\
108
-        ╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 0, processTimeMs: 0\
108
+        ╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 1, processTimeMs: 1\
109
109
     ╰ **Unused Definitions** (unused-definitions): _no findings_\
110
110
     ╰ **Network Functions** (network-functions): _no findings_\
111
111
     ╰ **Dataframe Access Validation** (dataframe-access-validation): _no findings_\
@@ -118,11 +118,11 @@ It offers a wide variety of features, for example:
118
118
     ╰ **Undefined Symbol** (undefined-symbol): _no findings_\
119
119
     ╰ **Unused Import** (unused-import): _no findings_\
120
120
     ╰ **Unclosed Connection** (unclosed-connection): _no findings_\
121
- _All queries together required ≈3 ms (1ms accuracy, total 4 ms)_
121
+ _All queries together required ≈542 ms (1ms accuracy, total 548 ms)_
122
122
 
123
123
  <details> <summary style="color:gray">Show Detailed Results as Json</summary>
124
124
 
125
- The analysis required _4.0 ms_ (including parsing and normalization and the query) within the generation environment.
125
+ The analysis required _548.5 ms_ (including parsing and normalization and the query) within the generation environment.
126
126
 
127
127
  In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
128
128
  Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
@@ -139,8 +139,8 @@ It offers a wide variety of features, for example:
139
139
  ".meta": {
140
140
  "builtin": 0,
141
141
  "sigdb": 0,
142
- "searchTimeMs": 0,
143
- "processTimeMs": 1
142
+ "searchTimeMs": 178,
143
+ "processTimeMs": 313
144
144
  }
145
145
  },
146
146
  "file-path-validity": {
@@ -162,8 +162,8 @@ It offers a wide variety of features, for example:
162
162
  "totalUnknown": 0,
163
163
  "totalWritesBeforeAlways": 0,
164
164
  "totalValid": 0,
165
- "searchTimeMs": 0,
166
- "processTimeMs": 0
165
+ "searchTimeMs": 5,
166
+ "processTimeMs": 2
167
167
  }
168
168
  },
169
169
  "seeded-randomness": {
@@ -174,8 +174,8 @@ It offers a wide variety of features, for example:
174
174
  "callsWithAssignmentProducers": 0,
175
175
  "callsWithNonConstantProducers": 0,
176
176
  "callsWithOtherBranchProducers": 0,
177
- "searchTimeMs": 0,
178
- "processTimeMs": 1
177
+ "searchTimeMs": 2,
178
+ "processTimeMs": 0
179
179
  }
180
180
  },
181
181
  "absolute-file-paths": {
@@ -194,8 +194,8 @@ It offers a wide variety of features, for example:
194
194
  ".meta": {
195
195
  "totalConsidered": 1,
196
196
  "totalUnknown": 0,
197
- "searchTimeMs": 0,
198
- "processTimeMs": 0
197
+ "searchTimeMs": 1,
198
+ "processTimeMs": 1
199
199
  }
200
200
  },
201
201
  "unused-definitions": {
@@ -211,8 +211,8 @@ It offers a wide variety of features, for example:
211
211
  ".meta": {
212
212
  "totalCalls": 0,
213
213
  "totalFunctionDefinitions": 0,
214
- "searchTimeMs": 0,
215
- "processTimeMs": 0
214
+ "searchTimeMs": 1,
215
+ "processTimeMs": 1
216
216
  }
217
217
  },
218
218
  "dataframe-access-validation": {
@@ -222,13 +222,13 @@ It offers a wide variety of features, for example:
222
222
  "numAccesses": 0,
223
223
  "totalAccessed": 0,
224
224
  "searchTimeMs": 0,
225
- "processTimeMs": 0
225
+ "processTimeMs": 4
226
226
  }
227
227
  },
228
228
  "dead-code": {
229
229
  "results": [],
230
230
  ".meta": {
231
- "searchTimeMs": 0,
231
+ "searchTimeMs": 1,
232
232
  "processTimeMs": 0
233
233
  }
234
234
  },
@@ -283,7 +283,7 @@ It offers a wide variety of features, for example:
283
283
  "subscript": 0
284
284
  },
285
285
  "searchTimeMs": 0,
286
- "processTimeMs": 1
286
+ "processTimeMs": 29
287
287
  }
288
288
  },
289
289
  "unused-import": {
@@ -293,8 +293,8 @@ It offers a wide variety of features, for example:
293
293
  "totalUnresolved": 0,
294
294
  "totalMultiPackage": 0,
295
295
  "totalUnused": 0,
296
- "searchTimeMs": 0,
297
- "processTimeMs": 0
296
+ "searchTimeMs": 1,
297
+ "processTimeMs": 1
298
298
  }
299
299
  },
300
300
  "unclosed-connection": {
@@ -308,11 +308,11 @@ It offers a wide variety of features, for example:
308
308
  }
309
309
  },
310
310
  ".meta": {
311
- "timing": 3
311
+ "timing": 542
312
312
  }
313
313
  },
314
314
  ".meta": {
315
- "timing": 3
315
+ "timing": 542
316
316
  }
317
317
  }
318
318
  ```
@@ -378,7 +378,7 @@ It offers a wide variety of features, for example:
378
378
 
379
379
  ```shell
380
380
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
381
- flowR repl v2.14.1, R grammar v14 (tree-sitter engine)
381
+ flowR repl v2.14.2, R grammar v14 (tree-sitter engine)
382
382
  R> :query @static-slice (11@sum) file://test/testfiles/example.R
383
383
  ```
384
384
 
@@ -392,7 +392,7 @@ It offers a wide variety of features, for example:
392
392
  N <- 10
393
393
  for(i in 1:(N-1)) sum <- sum + i + w
394
394
  sum
395
- All queries together required ≈3 ms (1ms accuracy, total 3 ms)
395
+ All queries together required ≈15 ms (1ms accuracy, total 16 ms)
396
396
  ```
397
397
 
398
398
 
@@ -407,7 +407,7 @@ It offers a wide variety of features, for example:
407
407
  </details>
408
408
 
409
409
  * 🚀 **fast call-graph, data-, and control-flow graphs**\
410
- Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">106.1 ms</span></i> (as of Aug 19, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
410
+ Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">109.2 ms</span></i> (as of Aug 21, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
411
411
  _flowR_ can analyze the data- and control-flow of the average real-world R&nbsp;script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
412
412
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#perspectives-cg).
413
413
  (&nbsp;[▶&nbsp;Explore in Browser](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zDYSwRgTghhCeAUATADsWECUAoLBnAxlMAKYD6ALgPakC2UAHgAQA8AtIwGYCuAdvuSEo949DIyYB6RnXojsWaAHdGKlW0aIo5KADoO0GsXghEjALyMAjAC4AbABpGANyJdi5xvngBmRwA5HAHZHACZHAE5HABYMbHwSKB5VdQ4QYHJiCHglRxdgN0YAPkYQuISeABICImJTdWqSCmoZeHjiRIq8t3lcLho6OFJcbXJcFnZe-pgQXCM2xMdDRI8l4Qba2KxeLlnEJu1gNQm%2B7KhFTtdieUUIEAydfFwneEmB2CGR3EcAIleYWAeT2%2B2FQlHIrXKVUIJEQIMoIB4owh7UqJgwQA&p=13:1 "run this script in flowR's playground, no setup")&nbsp;)
@@ -445,7 +445,7 @@ It offers a wide variety of features, for example:
445
445
 
446
446
  ```shell
447
447
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
448
- flowR repl v2.14.1, R grammar v14 (tree-sitter engine)
448
+ flowR repl v2.14.2, R grammar v14 (tree-sitter engine)
449
449
  R> :dataflow* test/testfiles/example.R
450
450
  ```
451
451
 
@@ -752,7 +752,7 @@ It offers a wide variety of features, for example:
752
752
  ```
753
753
 
754
754
 
755
- (The analysis required _1.3 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
755
+ (The analysis required _7.4 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
756
756
 
757
757
 
758
758
 
@@ -764,18 +764,6 @@ It offers a wide variety of features, for example:
764
764
 
765
765
  </details>
766
766
 
767
- Every ▶&nbsp;_Explore in Browser_ link above opens [flowR's playground](https://flowr-analysis.github.io/flowr/wiki/playground/#c=zDYSwRgTghhCeAUATADsWECUAoLBnAxlMAKYD6ALgPakC2UAHgAQA8AtIwGYCuAdvuSEo949DIyYB6RnXojsWaAHdGKlW0aIo5KADoO0GsXghEjALyMAjAC4AbABpGANyJdi5xvngBmRwA5HAHZHACZHAE5HABYMbHwSKB5VdQ4QYHJiCHglRxdgN0YAPkYQuISeABICImJTdWqSCmoZeHjiRIq8t3lcLho6OFJcbXJcFnZe-pgQXCM2xMdDRI8l4Qba2KxeLlnEJu1gNQm%2B7KhFTtdieUUIEAydfFwneEmB2CGR3EcAIleYWAeT2%2B2FQlHIrXKVUIJEQIMoIB4owh7UqJgwQA),
768
- which runs the whole analysis locally in your browser, with no setup at all. Once it is open:
769
-
770
- | in the playground | what it does |
771
- | ----------------- | ------------ |
772
- | hover a name | what flowR knows about it: its value, its shape, its signature, and what the linter said |
773
- | ctrl-click a name | jump to where it is defined |
774
- | click a dependency | slice the script for it |
775
- | alt-click anything (or <kbd>alt</kbd>+<kbd>m</kbd>) | highlight it, so a link points at it; hold <kbd>shift</kbd> to highlight more than one |
776
- | _Copy link_ | hand the script, the highlights, and the layout to someone else as one url |
777
- | the _flowR repl_ drawer | every command the [repl](https://github.com/flowr-analysis/flowr/wiki/Interface#using-the-repl) carries, over the script above |
778
-
779
767
  If you want to use flowR and the features it provides, feel free to check out the:
780
768
 
781
769
  - [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr)/[Positron](https://open-vsx.org/extension/code-inspect/vscode-flowr): provides access to flowR directly in VS Code and Positron (or [vscode.dev](https://vscode.dev/))
@@ -55,14 +55,33 @@ export declare abstract class AbstractInterpretationVisitor<StateDomain extends
55
55
  * @see {@link AbstractInterpretationVisitor#isWideningPoint|isWideningPoint()}
56
56
  */
57
57
  private wideningPoints;
58
+ /**
59
+ * What leads to a vertex, without the call a body was entered from.
60
+ * {@link AbstractInterpretationVisitor#shouldSkipVertex|shouldSkipVertex()} is asked once per vertex, so
61
+ * an override of it has to say the same thing every time.
62
+ */
63
+ private readonly predecessorsOf;
64
+ /** What the control flow may reach from a vertex, asked only by a read with several definitions. */
65
+ private readonly reachableFrom;
66
+ /**
67
+ * The state each vertex was left in when it was last visited, so a re-visit can tell whether anything moved.
68
+ * The trace cannot say that: entering a call seeds it before the parameters and the call are visited.
69
+ */
70
+ private readonly lastState;
58
71
  /**
59
72
  * A set of nodes representing variable definitions that have already been visited but whose assignment has not yet been processed.
60
73
  */
61
74
  private readonly unassigned;
62
75
  /** The call a function body is currently being interpreted for, mapping the body's entry to it. */
63
76
  private readonly enteredFrom;
64
- /** The function definitions currently being interpreted, which is what stops a recursive call from running forever. */
77
+ /** The function definitions currently being interpreted, which is what makes a call back into one recursive. */
65
78
  private readonly running;
79
+ /** The definitions that turned out to call themselves, which are the ones run more than once. */
80
+ private readonly recursive;
81
+ /** What a definition being interpreted was last seen to leave behind, which is what its own calls are worth. */
82
+ private readonly returns;
83
+ /** The calls that lead back into a definition still being interpreted, and the definition they reach. */
84
+ private readonly recursiveCalls;
66
85
  constructor(config: Config, stateDomain: StateDomain);
67
86
  /**
68
87
  * Resolves the inferred abstract value of an AST node.
@@ -120,6 +139,8 @@ export declare abstract class AbstractInterpretationVisitor<StateDomain extends
120
139
  * Skipped vertices hold no state of their own, so what led into them is reported instead.
121
140
  */
122
141
  protected getPredecessors(vertexId: NodeId): readonly AbsintPredecessor[];
142
+ /** What the control flow graph itself says leads here, which is the same however often it is asked. */
143
+ private collectPredecessors;
123
144
  /**
124
145
  * The abstract state one predecessor contributes, joined into the state at the current vertex.
125
146
  *
@@ -129,8 +150,9 @@ export declare abstract class AbstractInterpretationVisitor<StateDomain extends
129
150
  protected getPredecessorState({ id }: AbsintPredecessor): StateDomain | undefined;
130
151
  protected visitFunctionCall(call: DataflowGraphVertexFunctionCall): void;
131
152
  /**
132
- * Whether the traversal should step into what the given call dispatches to.
133
- * Returning `true` runs the bodies and continues with the state at their exit points.
153
+ * Whether to step into what the given call dispatches to, which is what makes the analysis interprocedural.
154
+ * Defaults to `abstractInterpretation.followCalls`; override it to decide per call. A call that reaches no
155
+ * definition is left alone either way.
134
156
  */
135
157
  protected shouldEnterCall(_call: DataflowGraphVertexFunctionCall): boolean;
136
158
  /**
@@ -149,13 +171,32 @@ export declare abstract class AbstractInterpretationVisitor<StateDomain extends
149
171
  * @returns the state at the exit points, or `undefined` if the call reaches nothing to step into
150
172
  */
151
173
  protected enterCall(callId: NodeId): StateDomain | undefined;
174
+ /**
175
+ * Runs one definition for one call until what it leaves behind stops moving.
176
+ *
177
+ * One that does not call itself is run once. One that does is a fixpoint in two halves: what it leaves
178
+ * behind, which its own calls read, and what its parameters are worth, which those calls decide, since
179
+ * `shrink(head(x, nrow(x) - 1))` hands over fewer rows than it was given. Both are widened so they stop.
180
+ * @returns the states at the exit points, and what the definition leaves behind if every way out says
181
+ */
182
+ private runFunction;
183
+ /** What the parameters of a definition are worth in the state they were just bound in. */
184
+ private parameterValues;
185
+ /** How often each vertex of a function has been visited, so one call does not widen the next one early. */
186
+ private regionVisits;
187
+ /** Puts the visit counts back as they were before a function was run for one call. */
188
+ private restoreVisits;
152
189
  /**
153
190
  * Hand the arguments of the call to the parameters of the function it enters, so the body can read them.
154
191
  * Only the arguments of this very call are used, whichever other calls the function has.
155
192
  */
156
- protected bindParameters(callId: NodeId, defId: NodeId): void;
193
+ protected bindParameters(callId: NodeId, defId: NodeId, add?: 'join' | 'widen'): void;
157
194
  /** Gets each variable origin that has already been visited and whose assignment has already been processed */
158
195
  protected getVariableOrigins(nodeId: NodeId): NodeId[];
196
+ /** Whether the control flow may get from one vertex to another, answered from one traversal per source. */
197
+ private reaches;
198
+ /** Everything the control flow may reach from a vertex, walked once per source and kept. */
199
+ private reachableSet;
159
200
  /** Checks whether a node represents a unsupported (environment-changing) function call (e.g. `eval`, `load`, `attach`, `rm`, ...) */
160
201
  protected isUnsupportedFunctionCall(nodeId: NodeId): boolean;
161
202
  /**