Commit c7fcbf6
authored
Parens: more fixes (#16901)
* Fix a few more paren corner cases
* Match-like exprs in `if` exprs, `while` exprs, and `for` exprs. Also
`let` exprs.
* Nested, dangling `as` patterns.
* Outlaw `match` exprs (where the first `|` is leftward of the `m` in
`match)
* Single-line comments (`//`, `///`). Multiline comments (`(*…*)`)
would be… rather more difficult to handle.
* Double-parenthesized tuples in method applications, since we can't
tell purely syntactically whether the tuple might be the first
parameter of a method whose next parameter is an implied outref
parameter:
`x.TryGetValue ((y, z))`
i.e.,
`x.TryGetValue ((y, z), &value)`
* Multiline tuple patterns in `let`-bindings. These need parens if the
bound expression starts on the same column.
* Handle typed pats in getters & setters
* Double parens oddities
* Sometimes we can't tell just by looking at the untyped AST whether we
need parens, since their necessity may be dictated by type information
located elsewhere. Compare, e.g., #16254,
which probably has a similar underlying cause.
* Keep parens for parenzed app preceded by prefix op
* Keep parens around tuple in interp string
* More nested match fun
* No space when expr would reparse as prefix op
* No space when expr would reparse as prefix op
* No space when expr would reparse as prefix op
* Update release notes
* Remove unfinished multiline comment stuff
* Keep parens around dot-get that would be adjacent
* E.g., removing parens in place from
```fsharp
Debug.Assert((xT.DeclaringType :?> ProvidedTypeDefinition).BelongsToTargetModel)
```
would result in the the argument to `Assert` becoming
`(xT.DeclaringType :?> ProvidedTypeDefinition)`. The
`.BelongsToTargetModel` would then be parsed as a get on the return
value of _that_ call.
* Fantomas1 parent 1be52aa commit c7fcbf6
File tree
6 files changed
+486
-46
lines changed- docs/release-notes
- .FSharp.Compiler.Service
- .VisualStudio
- src/Compiler/Service
- vsintegration
- src/FSharp.Editor/CodeFixes
- tests/FSharp.Editor.Tests/CodeFixes
6 files changed
+486
-46
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
347 | 348 | | |
348 | 349 | | |
349 | 350 | | |
| |||
437 | 438 | | |
438 | 439 | | |
439 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
440 | 449 | | |
441 | 450 | | |
442 | 451 | | |
| |||
610 | 619 | | |
611 | 620 | | |
612 | 621 | | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
613 | 629 | | |
614 | | - | |
| 630 | + | |
615 | 631 | | |
616 | | - | |
| 632 | + | |
| 633 | + | |
617 | 634 | | |
618 | 635 | | |
619 | | - | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
620 | 642 | | |
621 | 643 | | |
622 | 644 | | |
| |||
676 | 698 | | |
677 | 699 | | |
678 | 700 | | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
679 | 710 | | |
680 | 711 | | |
681 | 712 | | |
| |||
794 | 825 | | |
795 | 826 | | |
796 | 827 | | |
797 | | - | |
| 828 | + | |
| 829 | + | |
798 | 830 | | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
804 | 839 | | |
805 | 840 | | |
806 | 841 | | |
| |||
824 | 859 | | |
825 | 860 | | |
826 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
827 | 881 | | |
828 | 882 | | |
829 | 883 | | |
| |||
842 | 896 | | |
843 | 897 | | |
844 | 898 | | |
845 | | - | |
| 899 | + | |
| 900 | + | |
846 | 901 | | |
847 | | - | |
| 902 | + | |
848 | 903 | | |
849 | 904 | | |
850 | 905 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
58 | 76 | | |
59 | 77 | | |
60 | 78 | | |
| |||
88 | 106 | | |
89 | 107 | | |
90 | 108 | | |
| 109 | + | |
91 | 110 | | |
92 | 111 | | |
93 | 112 | | |
| |||
98 | 117 | | |
99 | 118 | | |
100 | 119 | | |
101 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
102 | 129 | | |
103 | 130 | | |
104 | 131 | | |
105 | 132 | | |
106 | 133 | | |
107 | | - | |
| 134 | + | |
108 | 135 | | |
109 | 136 | | |
110 | 137 | | |
111 | | - | |
| 138 | + | |
| 139 | + | |
112 | 140 | | |
113 | 141 | | |
114 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
115 | 146 | | |
116 | 147 | | |
117 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
118 | 176 | | |
119 | 177 | | |
120 | 178 | | |
| |||
204 | 262 | | |
205 | 263 | | |
206 | 264 | | |
207 | | - | |
208 | | - | |
209 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
210 | 268 | | |
211 | 269 | | |
212 | 270 | | |
| |||
0 commit comments