You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normal boolean guards are pushed down to the appropriate branch of the pattern match tree, such that falling through to the next guard does not entail rechecking the pattern. When pattern guards are involved, however, the desugaring duplicates the parent pattern into the continuation, resulting in unnecessarily duplicated tests.
This try PureScript shows a redundant test against Just. The problem seems to be that it's sharing one continuation in both cases, when it could be splitting it into two continuations. In reality, this case is simple enough that no continuation should be necessary at all.
Expected behavior
Ideally, #4496 would solve this issue for backend-optimizer, as we could compile the guards as part of our existing pattern match optimizer, but I think the main compiler should also try to avoid these redundant tests.
The text was updated successfully, but these errors were encountered:
Description
Normal boolean guards are pushed down to the appropriate branch of the pattern match tree, such that falling through to the next guard does not entail rechecking the pattern. When pattern guards are involved, however, the desugaring duplicates the parent pattern into the continuation, resulting in unnecessarily duplicated tests.
To Reproduce
Steps to reproduce the behavior.
This try PureScript shows a redundant test against
Just
. The problem seems to be that it's sharing one continuation in both cases, when it could be splitting it into two continuations. In reality, this case is simple enough that no continuation should be necessary at all.Expected behavior
Ideally, #4496 would solve this issue for
backend-optimizer
, as we could compile the guards as part of our existing pattern match optimizer, but I think the main compiler should also try to avoid these redundant tests.The text was updated successfully, but these errors were encountered: