Commit 6b395f4
committed
fix paren stripping in let-chain conditions
In `if let PAT = EXPR && (a && b)`, the formatter was emitting
`if let PAT = EXPR && a && b`, which re-parses as a 3-element
let-chain instead of 2-element. This violated round-trip AST
equivalence.
The fix: when emitting a ConditionElement::Expr inside a LetChain,
wrap it in parens if it contains && or || to prevent the expression
from merging with the chain's && separators.
https://claude.ai/code/session_0185DQbZrR8XjistfKkPwAki1 parent 44f70ca commit 6b395f4
2 files changed
+57
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1383 | 1383 | | |
1384 | 1384 | | |
1385 | 1385 | | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
1386 | 1398 | | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1387 | 1402 | | |
1388 | 1403 | | |
1389 | 1404 | | |
| |||
3202 | 3217 | | |
3203 | 3218 | | |
3204 | 3219 | | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
3205 | 3227 | | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
3206 | 3231 | | |
3207 | 3232 | | |
3208 | 3233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1695 | 1695 | | |
1696 | 1696 | | |
1697 | 1697 | | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
1702 | | - | |
1703 | | - | |
1704 | 1698 | | |
1705 | 1699 | | |
1706 | 1700 | | |
| |||
1750 | 1744 | | |
1751 | 1745 | | |
1752 | 1746 | | |
1753 | | - | |
1754 | | - | |
1755 | | - | |
1756 | | - | |
1757 | | - | |
1758 | | - | |
1759 | | - | |
1760 | | - | |
1761 | | - | |
1762 | | - | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
1763 | 1751 | | |
1764 | | - | |
1765 | | - | |
| 1752 | + | |
| 1753 | + | |
1766 | 1754 | | |
1767 | 1755 | | |
1768 | 1756 | | |
| |||
1773 | 1761 | | |
1774 | 1762 | | |
1775 | 1763 | | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
1776 | 1790 | | |
1777 | 1791 | | |
1778 | 1792 | | |
| |||
0 commit comments