Open miniBill opened 9 months ago
We should also handle the opposite, when the case expression is inside the if:
if category == "Rock" then
case category of
"Rock" ->
1
_ ->
2
else
3
-->
if category == "Rock" then
1
else
3
What the rule should do: Infer the value from a simple
case
statement to use it to simplifyif
expressionsWhat problems does it solve: It helps during refactorings, especially when switching from
if
tocase
, and copying the old content inside branchesExample of things the rule would report:
Should this be part of the Simplify rule or should it be a new rule? Part of simplify. It ties into the inference code.
I am looking for: