Skip to content

Commit 4c36a98

Browse files
Handle dangling exprs in sequentials
1 parent f96e9bd commit 4c36a98

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/Compiler/Service/ServiceAnalysis.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,8 @@ module UnnecessaryParentheses =
13191319
->
13201320
ValueNone
13211321

1322+
| SynExpr.Sequential(expr1 = SynExpr.Paren(expr = Is inner)), Dangling.Problematic _ -> ValueNone
1323+
13221324
| SynExpr.Paren _, SynExpr.Typed _
13231325
| SynExpr.Quote _, SynExpr.Typed _
13241326
| SynExpr.AnonRecd _, SynExpr.Typed _

vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ let _ =
156156
"for x in [] do (ignore 3)", "for x in [] do ignore 3"
157157

158158
// ArrayOrListComputed
159+
"[1; 2; (if x then 3 else 4); 5]", "[1; 2; (if x then 3 else 4); 5]"
160+
"[|1; 2; (if x then 3 else 4); 5|]", "[|1; 2; (if x then 3 else 4); 5|]"
161+
159162
// IndexRange
160163
"[(1)..10]", "[1..10]"
161164
"[1..(10)]", "[1..10]"

0 commit comments

Comments
 (0)