Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzer & code fix for ~IDE0047~ FS3583: remove unnecessary parentheses #16079

Merged
merged 93 commits into from
Oct 31, 2023
Merged
Changes from 1 commit
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
f7d4b36
Add analyzer & code fix for IDE0047
brianrourkeboll Oct 4, 2023
aa17921
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 4, 2023
8207085
Consistency
brianrourkeboll Oct 5, 2023
f7403f4
Consolidate lambda branches
brianrourkeboll Oct 5, 2023
9113205
Try-finally tweak
brianrourkeboll Oct 5, 2023
7377e41
Fix
brianrourkeboll Oct 5, 2023
37142b6
Fantomas
brianrourkeboll Oct 5, 2023
f51569a
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 5, 2023
a5aa829
Explain
brianrourkeboll Oct 5, 2023
a31049b
More Fantomas
brianrourkeboll Oct 5, 2023
92bcc2f
Pass in getTextAtRange for № literals
brianrourkeboll Oct 5, 2023
c4528ee
Fantomas
brianrourkeboll Oct 5, 2023
a176f26
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 5, 2023
aa04c18
Structs
brianrourkeboll Oct 6, 2023
f4bcdc7
Don't need that
brianrourkeboll Oct 6, 2023
34f037b
Spaces
brianrourkeboll Oct 6, 2023
5a6c260
getTextAtRange → getSourceLineStr
brianrourkeboll Oct 8, 2023
9a1f313
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 8, 2023
dea8ffc
Singleton
brianrourkeboll Oct 8, 2023
9bd1097
brianrourkeboll Oct 8, 2023
48d172b
Better
brianrourkeboll Oct 8, 2023
919dc4d
Streamline
brianrourkeboll Oct 9, 2023
7f71794
One more
brianrourkeboll Oct 9, 2023
591c5df
Don't need that here
brianrourkeboll Oct 9, 2023
f06cdd5
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 16, 2023
8e493e1
Simplify lambda traversal
brianrourkeboll Oct 16, 2023
5059bf2
Add comment
brianrourkeboll Oct 16, 2023
e5c281d
Make private
brianrourkeboll Oct 16, 2023
fb951ab
Fix infix op tests
brianrourkeboll Oct 16, 2023
a82be7c
Add some more tests
brianrourkeboll Oct 16, 2023
178bdc5
Be (somewhat) more systematic about precedence, &c.
brianrourkeboll Oct 16, 2023
4da7680
Handle dangling nested exprs (`match`, `if`, &c.)
brianrourkeboll Oct 17, 2023
9d10c9d
Consolidate SynPat logic
brianrourkeboll Oct 17, 2023
bf7c62a
Comments
brianrourkeboll Oct 17, 2023
bbf91df
Space after backticks
brianrourkeboll Oct 17, 2023
6decef7
Parens in interp hole
brianrourkeboll Oct 17, 2023
cbdd095
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 17, 2023
b30c503
Submodule
brianrourkeboll Oct 17, 2023
02edd60
Move extension method to common module
brianrourkeboll Oct 19, 2023
ed7aa1e
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 19, 2023
19da092
Expose raverseAll internally for clarity
brianrourkeboll Oct 19, 2023
1271c6e
Remove redundant arrow
brianrourkeboll Oct 19, 2023
e30168b
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 19, 2023
a2c9fe2
Move diagnostic creation logic into its own file
brianrourkeboll Oct 19, 2023
58d08d1
Fantomas
brianrourkeboll Oct 19, 2023
a8e44ca
Remove comment
brianrourkeboll Oct 19, 2023
5a62e22
Apply Fantomas to tests
brianrourkeboll Oct 19, 2023
2181148
Include paren diagnostics in builder capacity
brianrourkeboll Oct 19, 2023
2df60d9
Update surface area
brianrourkeboll Oct 19, 2023
a906b35
Remove unnecessary parens in DocumentDiagnosticAnalyzer tests
brianrourkeboll Oct 19, 2023
e1d8a7b
Add in-memory cache like SimplifyNameDiagnosticAnalyzer's
brianrourkeboll Oct 20, 2023
5f542cb
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 20, 2023
caeceb8
Update misleading comment
brianrourkeboll Oct 21, 2023
8a62a50
Ish
brianrourkeboll Oct 21, 2023
cc2c0fb
Might as well include the other example
brianrourkeboll Oct 21, 2023
daf39fa
The prefix op rules are tricky…
brianrourkeboll Oct 21, 2023
caccbf9
Use existing helper method
brianrourkeboll Oct 23, 2023
a9ec3f1
More correct dangling expr logic
brianrourkeboll Oct 23, 2023
1eeaa5d
A few more tests for dangling exprs
brianrourkeboll Oct 23, 2023
b758378
Fix incomplete exprs
brianrourkeboll Oct 23, 2023
dec772c
Missed that
brianrourkeboll Oct 23, 2023
43605d0
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 23, 2023
d2f1666
Structness is immaterial here
brianrourkeboll Oct 23, 2023
4494ccd
Fantomas
brianrourkeboll Oct 23, 2023
addc8d6
Remove semi-misleading word
brianrourkeboll Oct 24, 2023
a7cca0f
Add example to doc comment
brianrourkeboll Oct 24, 2023
c96ec3a
Move ROS extensions to separate file in FCS
brianrourkeboll Oct 24, 2023
dab4696
Use FS3583 instead of IDE0047
brianrourkeboll Oct 24, 2023
a57de4f
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 24, 2023
9958126
Add example to comment
brianrourkeboll Oct 24, 2023
ba48167
Fix find/replace in comments
brianrourkeboll Oct 25, 2023
73a55b7
Do the faster check first
brianrourkeboll Oct 25, 2023
80067ea
Pretty sure we don't actually need that
brianrourkeboll Oct 25, 2023
a7e969f
Fix (nonfunctional) copy/paste bug
brianrourkeboll Oct 25, 2023
31440be
Add tests for unmatched parens
brianrourkeboll Oct 25, 2023
3710278
Consolidate affixed infix tests for speed
brianrourkeboll Oct 25, 2023
eb15dd0
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 25, 2023
b077e09
Fantomas
brianrourkeboll Oct 25, 2023
1d6db65
Address a few more corner cases
brianrourkeboll Oct 26, 2023
a2b70f9
Add basic ServiceAnalysis tests
brianrourkeboll Oct 26, 2023
3800ee2
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 26, 2023
cc04486
Remove redundant assertions
brianrourkeboll Oct 29, 2023
dfdcab3
Move some framework-y code to the framework file
brianrourkeboll Oct 29, 2023
13c2840
Remove incorrect test
brianrourkeboll Oct 29, 2023
953b580
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 29, 2023
d49b21e
Don't need
brianrourkeboll Oct 30, 2023
53b80ad
A few more tests
brianrourkeboll Oct 30, 2023
e622dd2
Add a few attribute-related tests
brianrourkeboll Oct 30, 2023
deb313f
Add test for new operator introduced in #15923
brianrourkeboll Oct 30, 2023
7b4a347
Vars instead of consts
brianrourkeboll Oct 30, 2023
518af84
Merge branch 'main' of https://github.com/dotnet/fsharp into parens
brianrourkeboll Oct 30, 2023
19637f3
Add a few clarifying comments
brianrourkeboll Oct 30, 2023
4025df7
Update tests/FSharp.Compiler.Service.Tests/UnnecessaryParenthesesTest…
psfinaki Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify lambda traversal
brianrourkeboll committed Oct 16, 2023
commit 8e493e128c1e7337f828d72784e37011429ae0a9
24 changes: 11 additions & 13 deletions src/Compiler/Service/ServiceParseTreeWalk.fs
psfinaki marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -581,19 +581,17 @@ module SyntaxTraversal =

if ok.IsSome then ok else traverseSynExpr synExpr

| SynExpr.Lambda (args = SynSimplePats.SimplePats (pats = pats); body = synExpr; parsedData = parsedData) ->
match traverseSynSimplePats path pats with
| None ->
[
yield dive synExpr synExpr.Range traverseSynExpr
match parsedData with
| Some (pats, _) ->
for pat in pats do
yield dive pat pat.Range traversePat
| None -> ()
]
|> pick expr
| x -> x
| SynExpr.Lambda (parsedData = parsedData) ->
[
match parsedData with
| Some (pats, body) ->
for pat in pats do
yield dive pat pat.Range traversePat

yield dive body body.Range traverseSynExpr
| None -> ()
]
|> pick expr

| SynExpr.MatchLambda (matchClauses = synMatchClauseList) ->
synMatchClauseList