diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b156b264..a6b2cf54f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Long `&` (AND) patterns now break across multiple lines to respect max line length. [#1780](https://github.com/fsprojects/fantomas/issues/1780) - Empty array with trivia inside now has correct indentation in Stroustrup style. [#3098](https://github.com/fsprojects/fantomas/issues/3098) - Multiline function type inside parentheses gets extra indentation to avoid compiler error. [#3043](https://github.com/fsprojects/fantomas/issues/3043) +- Trivia around paren lambda with conditional compilation no longer causes merge error. [#2844](https://github.com/fsprojects/fantomas/issues/2844) ## [8.0.0-alpha-002] - 2025-12-15 diff --git a/src/Fantomas.Core.Tests/CompilerDirectivesTests.fs b/src/Fantomas.Core.Tests/CompilerDirectivesTests.fs index 34aa3ebb2..b35c44466 100644 --- a/src/Fantomas.Core.Tests/CompilerDirectivesTests.fs +++ b/src/Fantomas.Core.Tests/CompilerDirectivesTests.fs @@ -3240,3 +3240,46 @@ let CombineImportedAssembliesTask () """ + +[] +let ``trivia around paren lambda with conditional compilation, 2844`` () = + formatSourceString + """ +Program.statefulWithCmdMsg +|> (fun program -> + { program with + CanReuseView = ViewHelper.canReuseView + SyncAction = + (fun fn -> + program.SyncAction + ( +#if IOS + // iOS animates by default layout changes, we don't want that + fun () -> UIKit.UIView.PerformWithoutAnimation(fn) +#else + fn +#endif + )) }) +""" + config + |> prepend newline + |> should + equal + """ +Program.statefulWithCmdMsg +|> (fun program -> + { program with + CanReuseView = ViewHelper.canReuseView + SyncAction = + (fun fn -> + program.SyncAction + ( +#if IOS + // iOS animates by default layout changes, we don't want that + fun () -> UIKit.UIView.PerformWithoutAnimation(fn) +#else + fn +#endif + )) + }) +"""