Skip to content

Commit f78374d

Browse files
authored
Merge branch 'main' into update-fsdocs
2 parents 2322216 + 12638f2 commit f78374d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Multiline `val` body in signature files was not indented correctly. [#3269](https://github.com/fsprojects/fantomas/pull/3269)
1212
- `///` doc comment without associated declaration (e.g. at end of file) was duplicated when formatting. [#2499](https://github.com/fsprojects/fantomas/issues/2499)
1313
- NamedIndexedPropertySet with two SynLongIdent removed space. [#3273](https://github.com/fsprojects/fantomas/issues/3273)
14+
- `%%` (double-percent) infix operator moved to new line, producing invalid F#. [#2107](https://github.com/fsprojects/fantomas/issues/2107)
1415

1516
## [8.0.0-alpha-007] - 2026-03-10
1617

src/Fantomas.Core/CodePrinter.fs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ open Microsoft.FSharp.Core.CompilerServices
88
let noBreakInfixOps = set [| "="; ">"; "<"; "%"; "%%" |]
99
let newLineInfixOps = set [ "|>"; "||>"; "|||>"; ">>"; ">>=" ]
1010

11+
let isFirstCharUppercase (v: string) =
12+
match Seq.tryHead v with
13+
| Some c -> Char.IsUpper c
14+
| None -> false
15+
1116
let rec (|UppercaseType|LowercaseType|) (t: Type) : Choice<unit, unit> =
1217
let upperOrLower (v: string) =
13-
let isUpper = Seq.tryHead v |> Option.map Char.IsUpper |> Option.defaultValue false
14-
if isUpper then UppercaseType else LowercaseType
18+
if isFirstCharUppercase v then
19+
UppercaseType
20+
else
21+
LowercaseType
1522

1623
match t with
1724
| Type.LongIdent node ->
@@ -32,8 +39,10 @@ let rec (|UppercaseType|LowercaseType|) (t: Type) : Choice<unit, unit> =
3239

3340
let rec (|UppercaseExpr|LowercaseExpr|) (expr: Expr) =
3441
let upperOrLower (v: string) =
35-
let isUpper = Seq.tryHead v |> Option.map Char.IsUpper |> Option.defaultValue false
36-
if isUpper then UppercaseExpr else LowercaseExpr
42+
if isFirstCharUppercase v then
43+
UppercaseExpr
44+
else
45+
LowercaseExpr
3746

3847
let lastFragmentInList (identList: IdentListNode) =
3948
match List.tryLast identList.Content with

0 commit comments

Comments
 (0)