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

Parens: Keep parens in method calls in dot-lambdas #16395

Merged
merged 7 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion docs/release-notes/FSharp.Compiler.Service/8.0.200.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- Parens analysis: miscellaneous fixes - https://github.com/dotnet/fsharp/pull/16262
- Parens: Keep parentheses around non-struct tuples in `&` patterns - https://github.com/dotnet/fsharp/pull/16391
- Parens analysis: keep parentheses around non-struct tuples in `&` patterns - https://github.com/dotnet/fsharp/pull/16391
- Parens analysis: fix some parenthesization corner-cases in record expressions - https://github.com/dotnet/fsharp/pull/16370
- Parens analysis: keep parens in method calls in dot-lambdas - https://github.com/dotnet/fsharp/pull/16395
- Fixes #16359 - correctly handle imports with 0 length public key tokens - https://github.com/dotnet/fsharp/pull/16363
- Raise a new error when interfaces with auto properties are implemented on constructor-less types - https://github.com/dotnet/fsharp/pull/16352
4 changes: 3 additions & 1 deletion src/Compiler/Service/ServiceAnalysis.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,10 +1207,12 @@ module UnnecessaryParentheses =
//
// x.M(y).N z
// x.M(y).[z]
// _.M(x)
// (f x)[z]
// (f(x))[z]
// x.M(y)[z]
| SynExpr.Paren _, SyntaxNode.SynExpr(SynExpr.App _) :: SyntaxNode.SynExpr(SynExpr.DotGet _ | SynExpr.DotIndexedGet _) :: _
| SynExpr.Paren _,
SyntaxNode.SynExpr(SynExpr.App _) :: SyntaxNode.SynExpr(SynExpr.DotGet _ | SynExpr.DotIndexedGet _ | SynExpr.DotLambda _) :: _
| SynExpr.Paren(expr = SynExpr.App _),
SyntaxNode.SynExpr(SynExpr.App(argExpr = SynExpr.ArrayOrListComputed(isArray = false))) :: _
| SynExpr.Paren _,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,8 @@ in x
"([] : int list).Length", "([] : int list).Length"

// DotLambda
"[{| A = x |}] |> List.map (_.A)", "[{| A = x |}] |> List.map _.A"
"""_.ToString("x")""", """_.ToString("x")"""
"""_.ToString(("x"))""", """_.ToString("x")"""

// DotSet
"(ref 3).Value <- (3)", "(ref 3).Value <- 3"
Expand Down Expand Up @@ -1191,6 +1192,8 @@ in x

// DotLambda
"[{| A = x |}] |> List.map (_.A)", "[{| A = x |}] |> List.map _.A"
"""[1..10] |> List.map _.ToString("x")""", """[1..10] |> List.map _.ToString("x")"""
"""[1..10] |> List.map _.ToString(("x"))""", """[1..10] |> List.map _.ToString("x")"""

// DotSet
"id ((ref x).Value <- y)", "id ((ref x).Value <- y)"
Expand Down