-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dependencies, III.1]: Types for R Values #1518
[Dependencies, III.1]: Types for R Values #1518
Conversation
…1-types-for-r-values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean we definitely need more tests for this later, but for now this is great :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the handling of R values by introducing a new typesystem based on wrapped value sets, replacing raw primitives with structured constructs (e.g. Top, setFrom, and intervalFrom). The changes affect both test assertions and the resolution logic in various query and dataflow functions.
- Updated test cases to assert results using setFrom and structured R values.
- Modified value resolution functions across queries and dataflow to return wrapped types (ResolveResult) instead of raw or undefined values.
- Adjusted stringification and evaluation functions to integrate with the new R value types.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/functionality/slicing/static-program-slices/alias-tracking.test.ts | Updated test expectations to use setFrom wrappers. |
test/functionality/dataflow/query/resolve-value-query.test.ts | Changed expected values from raw primitives to structured intervals/Top. |
test/functionality/dataflow/environments/resolve.test.ts | Modified assertions to compare against wrapped values. |
src/queries/catalog/resolve-value-query/*.ts | Switched to stringifyValue for printing R values. |
src/queries/catalog/dependencies-query/dependencies-query-executor.ts | Updated resolution logic to use valueSetGuard and convert values to strings. |
src/dataflow/**/*.ts | Revised built-in functions and evaluation to integrate new value conversions and guards. |
src/dataflow/environments/resolve-by-name.ts | Changed return types from unknown[] to ResolveResult and updated fallback returns. |
src/dataflow/eval/values/**/*.ts | Introduced new helper functions for handling strings, scalars, intervals, and sets. |
src/dataflow/eval/values/general.ts | Added conversion from TypeScript values to structured R values. |
Comments suppressed due to low confidence (3)
src/queries/catalog/dependencies-query/dependencies-query-executor.ts:237
- Confirm that converting resolved R values into a string array properly handles cases where values might not conform to the expected types. If non-string values occur, consider adding fallback logic or logging for clarity.
function resolveBasedOnConfig(data: BasicQueryData, vertex: DataflowGraphVertexFunctionCall, argument: RNodeWithParent, environment: REnvironmentInformation | undefined, idMap: Map<NodeId, RNode> | undefined, resolveValue : boolean | 'library' | undefined): string[] | undefined {
src/dataflow/environments/resolve-by-name.ts:182
- Changing the return value from undefined to Top may affect downstream consumers; ensure that all call sites properly handle Top values to avoid unintended behavior.
export function trackAliasInEnvironments(identifier: Identifier | undefined, use: REnvironmentInformation, idMap?: AstIdMap): ResolveResult {
src/queries/catalog/resolve-value-query/resolve-value-query-executor.ts:23
- Removing the fallback (using the nullish coalescing operator) may introduce runtime errors if resolveIdToValue returns Top (or an unexpected value). Consider handling or filtering undefined/Top cases before flatMapping.
.flatMap(ident => resolveIdToValue(ident, { graph, full: true, idMap: ast.idMap }));
No description provided.