diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index f69c033cc2..ea34936377 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,3 +1,7 @@
+### 4.5.0-alpha-016 - 05/2021
+
+* Fix Unexpected newline after inner let binding. [#1709](https://github.com/fsprojects/fantomas/issues/1709)
+
### 4.5.0-alpha-015 - 05/2021
* Fix Currying a pair gets spread over multiple lines. [#1700](https://github.com/fsprojects/fantomas/issues/1700)
diff --git a/src/Fantomas.CoreGlobalTool.Tests/Fantomas.CoreGlobalTool.Tests.fsproj b/src/Fantomas.CoreGlobalTool.Tests/Fantomas.CoreGlobalTool.Tests.fsproj
index 23864d2350..267a3c3499 100644
--- a/src/Fantomas.CoreGlobalTool.Tests/Fantomas.CoreGlobalTool.Tests.fsproj
+++ b/src/Fantomas.CoreGlobalTool.Tests/Fantomas.CoreGlobalTool.Tests.fsproj
@@ -4,7 +4,7 @@
net5.0
false
false
- 4.5.0-alpha-015
+ 4.5.0-alpha-016
FS0988
FS0025
diff --git a/src/Fantomas.CoreGlobalTool/Fantomas.CoreGlobalTool.fsproj b/src/Fantomas.CoreGlobalTool/Fantomas.CoreGlobalTool.fsproj
index 7038f3470d..35da6d230d 100644
--- a/src/Fantomas.CoreGlobalTool/Fantomas.CoreGlobalTool.fsproj
+++ b/src/Fantomas.CoreGlobalTool/Fantomas.CoreGlobalTool.fsproj
@@ -5,7 +5,7 @@
Major
fantomas
True
- 4.5.0-alpha-015
+ 4.5.0-alpha-016
fantomas-tool
FS0025
LICENSE.md
diff --git a/src/Fantomas.Extras/Fantomas.Extras.fsproj b/src/Fantomas.Extras/Fantomas.Extras.fsproj
index b4c69dca4a..7cfebdd379 100644
--- a/src/Fantomas.Extras/Fantomas.Extras.fsproj
+++ b/src/Fantomas.Extras/Fantomas.Extras.fsproj
@@ -2,7 +2,7 @@
netstandard2.0
- 4.5.0-alpha-015
+ 4.5.0-alpha-016
Utility package for Fantomas
FS0025
LICENSE.md
diff --git a/src/Fantomas.Tests/ColMultilineItemTests.fs b/src/Fantomas.Tests/ColMultilineItemTests.fs
index 5f8a54f865..a8a9d2516e 100644
--- a/src/Fantomas.Tests/ColMultilineItemTests.fs
+++ b/src/Fantomas.Tests/ColMultilineItemTests.fs
@@ -406,3 +406,38 @@ let blah<'a> config : Type =
let result = Runner.Run<'a> config
()
"""
+
+[]
+let ``leading newline because of trivia does not item multiline, 1709`` () =
+ formatSourceString
+ false
+ """
+[]
+let ``first lamba`` () =
+ // You can use the `fun` keyword to write lambda's.
+ // Mind the -> instead of C#'s =>
+ // TODO: complete the lambda so that the value is returned in uppercase.
+ let toUpperCase = fun a -> a
+ // ref: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword
+
+ let name = "Joey"
+ let uppercased = toUpperCase name
+ Assert.Equal("JOEY", uppercased)
+"""
+ config
+ |> prepend newline
+ |> should
+ equal
+ """
+[]
+let ``first lamba`` () =
+ // You can use the `fun` keyword to write lambda's.
+ // Mind the -> instead of C#'s =>
+ // TODO: complete the lambda so that the value is returned in uppercase.
+ let toUpperCase = fun a -> a
+ // ref: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/functions/lambda-expressions-the-fun-keyword
+
+ let name = "Joey"
+ let uppercased = toUpperCase name
+ Assert.Equal("JOEY", uppercased)
+"""
diff --git a/src/Fantomas.Tests/Fantomas.Tests.fsproj b/src/Fantomas.Tests/Fantomas.Tests.fsproj
index cf328e44af..f3c6b4c0d9 100644
--- a/src/Fantomas.Tests/Fantomas.Tests.fsproj
+++ b/src/Fantomas.Tests/Fantomas.Tests.fsproj
@@ -1,6 +1,6 @@
- 4.5.0-alpha-015
+ 4.5.0-alpha-016
FS0988
net5.0
FS0025
diff --git a/src/Fantomas/Context.fs b/src/Fantomas/Context.fs
index 13bf2e8c54..60701165b2 100644
--- a/src/Fantomas/Context.fs
+++ b/src/Fantomas/Context.fs
@@ -1448,7 +1448,8 @@ let private isMultilineItem (expr: Context -> Context) (ctx: Context) : bool * C
// filter leading newlines and trivia
match Array.head events with
| CommentOrDefineEvent _
- | WriteLine -> true
+ | WriteLine
+ | WriteLineBecauseOfTrivia -> true
| _ -> false
else
false)
diff --git a/src/Fantomas/Fantomas.fsproj b/src/Fantomas/Fantomas.fsproj
index 2fa2ef80ad..b2d7fcd178 100644
--- a/src/Fantomas/Fantomas.fsproj
+++ b/src/Fantomas/Fantomas.fsproj
@@ -2,7 +2,7 @@
netstandard2.0
- 4.5.0-alpha-015
+ 4.5.0-alpha-016
Source code formatter for F#
FS0025
LICENSE.md