This fixes two issues with the term printer when printing infix operator application.
Actual bug: Printer would re-associate expression to the left when the expression on the right has the same precedence as the expression on the left. For example 1 - (2 - 3) would get printed as 1 - 2 - 3 which is wrong.
Formatting regression: The old term printer would lay out infix operator applications in a table. This was somewhat nicer in some cases, but bad for readability in some others. This PR reverts the printer to the old version only in the case when several applications of the same operator are chained together in a left-associated expression. This renders e.g.
[1,2,3]
|> foo
|> bar
|> baz
...when space is limited, instead of e.g.
[1,2,3] |> foo |> bar
|> baz
If the operators are associated to the right, or if multiple operators are mixed together, the printer reverts to the normal way of printing.
This fixes two issues with the term printer when printing infix operator application.
Actual bug: Printer would re-associate expression to the left when the expression on the right has the same precedence as the expression on the left. For example
1 - (2 - 3)
would get printed as1 - 2 - 3
which is wrong.Formatting regression: The old term printer would lay out infix operator applications in a table. This was somewhat nicer in some cases, but bad for readability in some others. This PR reverts the printer to the old version only in the case when several applications of the same operator are chained together in a left-associated expression. This renders e.g.
...when space is limited, instead of e.g.
If the operators are associated to the right, or if multiple operators are mixed together, the printer reverts to the normal way of printing.