`VisitorPartialEvaluator` should remove cancelling operations
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
For example, the expression `a + b - b` could be simplified to `a`. Similarily one could do this with `a * b + c / b` -> `a + c/b`.
I think the main challenge would be detecting this with parens:
`a + b + c - b` -> `((a + b) + c) - b`
Operators this could be implemented for and their counterparts:
| Operator | Counterpart | Result |
|----------------|---------------|--------|
| PLUS: `A + B` | MINUS: `- B` | `A` |
| MUL: `A * B` | DIV: `/ B` | `A` |
| AND: `A && B` | OR: `\|\| A` | `A` |
| OR: `A \|\| B` | AND: `&& A` | `A` |
Contributor guide
Research direction
Start by locating the VisitorPartialEvaluator entry point and reading how it evaluates binary operators. Use the cancelling-operation examples and the parenthesized expression as cases to define the intended behavior. Done means equivalent operations simplify safely for the listed operator pairs without changing expression meaning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100