-
Notifications
You must be signed in to change notification settings - Fork 35
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
Translate Paxel expression analysis into Claims. #6406
base: master
Are you sure you want to change the base?
Conversation
- Visitor creates a map representing claim derivations - After visiting is done, map is folded into a list of Claims.
- Supports field access and `new` / object creation - Implemented using a stack (defined by extension functions).
- Removed fragile stack approach - Added another visitor to accumulate paths - Updated old visitor to delegate to new visitor; updated tests accordingly.
- Simplified logic by substituting a fold with an associateBy.
- Now, `Path` type alias (and all aliases built on this) refer to an AccessPath.Selector.
- a line is now < 100 columns.
- Suggestions for more ergonomic Kotlin. Co-authored-by: Gogul Balakrishnan <bgogul@google.com>
- Moving path acc into its own file - map + reduce --> flatMap
- Fixed a few syntax errors - Fixed whitespace / formatting. - Removed redundant toList().
- Using `DerivationResult` to get derivations and contexts (path lists). - Removed the path acc visitor. - Updated visitor to take Unit for a Context arg. - Renamed file in analysis.
- Analysis is an inner class of Deduction - Added Equal and Derive claims; using Derive right now. - Updated tests, all passing.
- Updating Documentation - Improving whitespace
Added copyright
Replaces List<String>.asFields().
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.
This PR has some code that should be moved off to separate PRs. Other than that, the PR looks OK except for style issues.
I haven't looked thoroughly at the tests. Will do so in the next review.
@@ -61,7 +61,9 @@ class InformationFlow private constructor( | |||
private val particleClaims = graph.particleNodes.associateBy( | |||
keySelector = { it.particle }, | |||
valueTransform = { | |||
it.instantiatedClaims() + (typeVariableSemantics[it.particle]?.claims ?: emptyList()) |
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.
Let us not include this change in this PR. We should do this in a separate PR so that we test the data flow analysis as well.
java/arcs/core/data/AccessPath.kt
Outdated
@@ -42,6 +42,12 @@ data class AccessPath(val root: Root, val selectors: List<Selector> = emptyList( | |||
selectors: List<Selector> = emptyList() | |||
) : this(Root.Handle(handle), selectors) | |||
|
|||
/** Constructs a new [AccessPath] from another, appending new [Selector]s. */ |
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 this off to a separate PR and add some tests.
* | ||
* See [DependencyNode] for more information. | ||
*/ | ||
fun RecipeGraph.Node.Particle.deduceClaims(): List<Claim> { |
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.
deducePaxelClaims
?
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.
Piotr had a comment in the previous PR that one should avoid using names of features in the codebase, because they can change. According to him, nothing with the name "paxel" (besides comments) is checked in.
- AssociationNode.flatten less complex and more efficient - Several private 1-liners in ClaimDeduction.kt have been rolled into a single function - Unlinking the claim deducer to InformationFlow.kt, not ready for prime time yet - Using a built-in exception assert instead of rolling my own - cleanliness + better asserts for ClaimDeductionTest.kt
@alxrsngrtn Let us hold off on this PR until we resolve the where expressions. It is possible that the underlying data structures change slightly to take care of where expressions. |
Here, I introduce a public
deduceClaims
function to be used in theInformationFlow
module. This translatesDependencyNodes
found in theExpressionDependencyAnalyzer
intoClaim
statements.CC: @piotrswigon @cromwellian