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
2 changes: 1 addition & 1 deletion docs/release-notes/.FSharp.Compiler.Service/9.0.200.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Fix lowering of computed array expressions when the expression consists of a simple mapping from a `uint64` or `unativeint` array. [PR #18081](https://github.com/dotnet/fsharp/pull/18081)
* Add missing nullable-metadata for C# consumers of records,exceptions and DU subtypes generated from F# code. [PR #18079](https://github.com/dotnet/fsharp/pull/18079)
* Fix a race condition in file book keeping in the compiler service ([#18008](https://github.com/dotnet/fsharp/pull/18008))

* Fix trimming '%' characters when lowering interpolated string to a concat call [PR #18123](https://github.com/dotnet/fsharp/pull/18123)

### Added

Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ let (|WithTrailingStringSpecifierRemoved|) (s: string) =
let i = s.AsSpan(0, s.Length - 2).LastIndexOfAnyExcept '%'
let diff = s.Length - 2 - i
if diff &&& 1 <> 0 then
s[..i]
s[..s.Length - 3]
else
s
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ type Foo () =
|> compile
|> shouldSucceed

[<Fact>]
let ``Percent signs and format specifiers with string expression`` () =
Fsx """
let x = "abc"
let s = $"%%%s{x}%%"
printfn "%s" s
"""
|> compileExeAndRun
|> shouldSucceed
|> withStdOutContains "%abc%"

[<Theory>]
// Test different number of interpolated string parts
[<InlineData("$\"\"\"abc{\"d\"}e\"\"\"")>]
Expand Down
Loading