Skip to content
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

Open
wants to merge 118 commits into
base: master
Choose a base branch
from

Conversation

alxmrs
Copy link
Contributor

@alxmrs alxmrs commented Oct 16, 2020

Here, I introduce a public deduceClaims function to be used in the InformationFlow module. This translates DependencyNodes found in the ExpressionDependencyAnalyzer into Claim statements.

CC: @piotrswigon @cromwellian

alxmrs and others added 30 commits September 9, 2020 14:53
- 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
@alxmrs alxmrs marked this pull request as ready for review October 23, 2020 19:14
@alxmrs alxmrs requested a review from bgogul October 23, 2020 19:16
Copy link
Collaborator

@bgogul bgogul left a 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())
Copy link
Collaborator

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.

@@ -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. */
Copy link
Collaborator

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> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deducePaxelClaims?

Copy link
Contributor Author

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.

java/arcs/core/testutil/Assertions.kt Outdated Show resolved Hide resolved
java/arcs/core/analysis/ClaimDeduction.kt Outdated Show resolved Hide resolved
javatests/arcs/core/analysis/ClaimDeductionTest.kt Outdated Show resolved Hide resolved
java/arcs/core/analysis/ClaimDeduction.kt Outdated Show resolved Hide resolved
java/arcs/core/analysis/ClaimDeduction.kt Outdated Show resolved Hide resolved
java/arcs/core/analysis/ClaimDeduction.kt Outdated Show resolved Hide resolved
java/arcs/core/analysis/ClaimDeduction.kt Show resolved Hide resolved
- 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
@bgogul
Copy link
Collaborator

bgogul commented Oct 29, 2020

@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.

@alxmrs alxmrs requested a review from bgogul March 2, 2021 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants