8000 MOS-1852: Fix pattern construction to preserve actions after filters by kniazkov · Pull Request #34 · cqfn/astranaut-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MOS-1852: Fix pattern construction to preserve actions after filters #34

New issue 8000

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

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

kniazkov
Copy link
Member
@kniazkov kniazkov commented Dec 2, 2024

Cool Story:
In the core of the project, we use three main entities: the syntax tree (Tree), the differential tree (DiffTree, inherited from Tree), and the pattern (Pattern, inherited from Tree). Essentially, the pattern is a differential tree with holes, and the differential tree is just a regular tree with actions. The expected flow is: first, we obtain a pair of "regular" trees from the parser, then build a differential tree from them, and finally perforate the differential tree to create a pattern.

This setup worked well until we started applying filters to the differential tree before perforation. The filters involve extracting subtrees from the original differential tree, and potentially extracting subtrees from these subtrees multiple times. The problem arises because the subtree node is not technically a node of the differential tree; it's a SubtreeNode object. In other words, the Action object is replaced by a SubtreeNode, which contains an Action object. In some cases, this nesting level increases (a SubtreeNode contains another SubtreeNode, which contains an Action), causing us to lose actions when constructing the pattern. The result is a pattern with holes but no actions. This is a bug.

To fix this, we need to properly build the pattern, taking into account that an Action can, in some cases, be a prototype of a PrototypeBasedNode.

Task:
Correct the pattern construction process to ensure that actions are preserved even after applying filters to the differential tree. Specifically, when building the pattern, we need to account for the possibility that an Action might be a prototype of a PrototypeBasedNode.

Copy link
codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b7e05c8) to head (4c6c981).
Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master       #34   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       719       721    +2     
===========================================
  Files             70        70           
  Lines           2145      2148    +3     
  Branches         321       321           
===========================================
+ Hits            2145      2148    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kniazkov kniazkov merged commit 55332f6 into cqfn:master Dec 2, 2024
3 checks passed
@kniazkov
Copy link
Member Author
kniazkov commented Dec 2, 2024

@rultor release, tag is 1.2.4

@rultor
Copy link
Collaborator
rultor commented Dec 2, 2024

@rultor release, tag is 1.2.4

@kniazkov OK, I will release it now. Please check the progress here.

@rultor
Copy link
Collaborator
rultor commented Dec 2, 2024

@rultor release, tag is 1.2.4

@kniazkov Done! FYI, the full log is here (took me 10min).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0