Skip to content
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
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.300.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Code generated files with > 64K methods and generated symbols crash when loaded. Use infered sequence points for debugging. ([Issue #16399](https://github.com/dotnet/fsharp/issues/16399), [#PR 16514](https://github.com/dotnet/fsharp/pull/16514))
* `nameof Module` expressions and patterns are processed to link files in `--test:GraphBasedChecking`. ([PR #16550](https://github.com/dotnet/fsharp/pull/16550))
* Graph Based Checking doesn't throw on invalid parsed input so it can be used for IDE scenarios ([PR #16575](https://github.com/dotnet/fsharp/pull/16575))
* Keep parens for problematic exprs (`if`, `match`, etc.) in `$"{(…):N0}"`, `$"{(…),-3}"`, etc. ([PR #16578](https://github.com/dotnet/fsharp/pull/16578))

### Added

Expand Down
10 changes: 9 additions & 1 deletion src/Compiler/Service/SynExpr.fs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,9 @@ module SynExpr =
| SynExpr.MatchLambda(matchClauses = Last(SynMatchClause(resultExpr = expr)))
| SynExpr.MatchBang(clauses = Last(SynMatchClause(resultExpr = expr)))
| SynExpr.TryWith(withCases = Last(SynMatchClause(resultExpr = expr)))
| SynExpr.TryFinally(finallyExpr = expr) -> loop expr
| SynExpr.TryFinally(finallyExpr = expr)
| SynExpr.Do(expr = expr)
| SynExpr.DoBang(expr = expr) -> loop expr
| _ -> ValueNone

loop
Expand Down Expand Up @@ -810,6 +812,12 @@ module SynExpr =
->
true

| SynExpr.InterpolatedString(contents = contents), (SynExpr.Tuple(isStruct = false) | Dangling.Problematic _) ->
contents
|> List.exists (function
| SynInterpolatedStringPart.FillExpr(qualifiers = Some _) -> true
| _ -> false)

| SynExpr.Record(copyInfo = Some(SynExpr.Paren(expr = Is inner), _)), Dangling.Problematic _
| SynExpr.AnonRecd(copyInfo = Some(SynExpr.Paren(expr = Is inner), _)), Dangling.Problematic _ -> true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,24 @@ in x
"$\"{(id 3)}\"", "$\"{id 3}\""
"$\"{(x)}\"", "$\"{x}\""

"$\"{(if true then 1 else 0)}\"", "$\"{if true then 1 else 0}\""
"$\"{(if true then 1 else 0):N0}\"", "$\"{(if true then 1 else 0):N0}\""
"$\"{(if true then 1 else 0),-3}\"", "$\"{(if true then 1 else 0),-3}\""
"$\"{(match () with () -> 1):N0}\"", "$\"{(match () with () -> 1):N0}\""
"$\"{(match () with () -> 1),-3}\"", "$\"{(match () with () -> 1),-3}\""
"$\"{(try () with _ -> 1):N0}\"", "$\"{(try () with _ -> 1):N0}\""
"$\"{(try () with _ -> 1),-3}\"", "$\"{(try () with _ -> 1),-3}\""
"$\"{(try 1 finally ()):N0}\"", "$\"{(try 1 finally ()):N0}\""
"$\"{(try 1 finally ()),-3}\"", "$\"{(try 1 finally ()),-3}\""
"$\"{(let x = 3 in x):N0}\"", "$\"{(let x = 3 in x):N0}\""
"$\"{(let x = 3 in x),-3}\"", "$\"{(let x = 3 in x),-3}\""
"$\"{(do (); 3):N0}\"", "$\"{(do (); 3):N0}\""
"$\"{(do (); 3),-3}\"", "$\"{(do (); 3),-3}\""
"$\"{(x <- 3):N0}\"", "$\"{(x <- 3):N0}\""
"$\"{(x <- 3),-3}\"", "$\"{(x <- 3),-3}\""
"$\"{(1, 2):N0}\"", "$\"{(1, 2):N0}\""
"$\"{(1, 2),-3}\"", "$\"{(1, 2),-3}\""

"""
$"{(3 + LanguagePrimitives.GenericZero<int>):N0}"
""",
Expand Down