File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## [ Unreleased]
4+
5+ ### Fixed
6+
7+ - End of line comments after infix operators are preserved correctly. [ #2287 ] ( https://github.com/fsprojects/fantomas/issues/2287 )
8+
39## [ 8.0.0-alpha-002] - 2025-12-15
410
511### Changed
Original file line number Diff line number Diff line change @@ -2575,3 +2575,39 @@ let EnableHeapTerminationOnCorruption () =
25752575 )
25762576 )
25772577"""
2578+
2579+ [< Test>]
2580+ let ``end of line comments after infix operators are preserved correctly, 2287`` () =
2581+ formatSourceString
2582+ """
2583+ // This function recognises these "infix operator" names.
2584+ let IsMangledInfixOperator mangled = (* where mangled is assumed to be a compiled name *)
2585+ let afterSkipStarts prefixes = Array .exists afterSkipStartsWith prefixes
2586+ s <> mangled &&
2587+ ( s = ":= " || // COLON_ EQUALS
2588+ afterSkipStarts relational || // EQUALS, INFIX_ COMPARE_ OP, LESS, GREATER
2589+ s = "$" || // DOLLAR
2590+ afterSkipStarts concat || // INFIX_ AT_ HAT_ OP
2591+ s = "** ") // INFIX_ STAR_ STAR_ OP
2592+ """
2593+ config
2594+ |> prepend newline
2595+ |> should
2596+ equal
2597+ """
2598+ // This function recognises these "infix operator" names.
2599+ let IsMangledInfixOperator mangled = (* where mangled is assumed to be a compiled name *)
2600+ let afterSkipStarts prefixes =
2601+ Array.exists afterSkipStartsWith prefixes
2602+
2603+ s <> mangled
2604+ && ( s = ":= "
2605+ || // COLON_ EQUALS
2606+ afterSkipStarts relational
2607+ || // EQUALS, INFIX_ COMPARE_ OP, LESS, GREATER
2608+ s = "$"
2609+ || // DOLLAR
2610+ afterSkipStarts concat
2611+ || // INFIX_ AT_ HAT_ OP
2612+ s = "** ") // INFIX_ STAR_ STAR_ OP
2613+ """
You can’t perform that action at this time.
0 commit comments