Better logic to simplify and/or.#7134
Conversation
Current logic for code generated by untagged unions pattern matching only focuses on certain cases of x == b where b is a boolean. There are more cases, and there are other constants than booleans: nil, undefined.
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Syntax Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.
| Benchmark suite | Current: dfc207b | Previous: e1b7fb7 | Ratio |
|---|---|---|---|
Print RedBlackTree.res - time/run |
2.42937178 ms |
2.3104395133333333 ms |
1.05 |
This comment was automatically generated by workflow using github-action-benchmark.
|
@cknitt this is ready for a first review. This already changes the way the logic is handled, and fixed a bug where a simplification was applied before, which was incorrect. |
zth
left a comment
There was a problem hiding this comment.
This is great! 😍
A minor thing to follow up with could be to simplify x === undefined || x === null to x == null, as they're equivalent. Would that fit into a similar mechanism?
Where is that generated? |
cknitt
left a comment
There was a problem hiding this comment.
Sorry, too late! This is awesome! 👍
Current logic for code generated by untagged unions pattern matching only focuses on certain cases of x == b where b is a boolean. There are more cases, and there are other constants than booleans: nil, undefined.