Skip to content

Commit

Permalink
Fix issues with multiline generic type parameters (#2852)
Browse files Browse the repository at this point in the history
* Expose TransformAST api. (#2868)

* Expose TransformAST api.

* Add additional unit test.

* Revert changelog entry

* Fix issues with multiline generic type parameters

* Refactor a few things per feedback

* Updates

* Rebase and add new test

* Add one extra space to ensure expr remains an application.

* Only add extra space when in SynExpr.App

* Rebase and add new test

* Add test

* WIP

* Update tests

* Refactor test configs

* Fix issue and update newly broken tests

* Format CodePrinter

* Use more typical unit test template.

* Add additional unit tests.

* Add changelog entry

---------

Co-authored-by: Florian Verdonck <[email protected]>
  • Loading branch information
josh-degraw and nojaf authored Jan 9, 2024
1 parent 79e8355 commit 3a10e88
Show file tree
Hide file tree
Showing 11 changed files with 592 additions and 44 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 6.3.0-alpha-006 - 2024-01-09

### Changed
* Aligned bracket style in anonymous record is not respected. [#2706](https://github.com/fsprojects/fantomas/issues/2706) [style guide](https://github.com/fsharp/fslang-design/issues/756)

## 6.3.0-alpha-005 - 2023-12-22

### Changed
Expand Down
6 changes: 4 additions & 2 deletions src/Fantomas.Core.Tests/ClassTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,10 @@ module rec Xterm
[<AllowNullLiteral>]
type Terminal =
abstract onKey:
IEvent<{| key: string
domEvent: KeyboardEvent |}> with get, set
IEvent<
{| key: string
domEvent: KeyboardEvent |}
> with get, set
abstract onLineFeed: IEvent<unit> with get, set
"""
Expand Down
1 change: 1 addition & 0 deletions src/Fantomas.Core.Tests/CodeFormatterTests.fs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Fantomas.Core.Tests.CodeFormatterTests

open Fantomas.Core.SyntaxOak
open NUnit.Framework
open Fantomas.FCS.Text
open Fantomas.Core
Expand Down
13 changes: 8 additions & 5 deletions src/Fantomas.Core.Tests/DallasTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1515,11 +1515,14 @@ let autoCompleteItems: cmap<DeclName, DeclarationListItem * Position * string<Lo
equal
"""
let autoCompleteItems
: cmap<DeclName, DeclarationListItem *
Position *
string<LocalPath> *
(Position -> option<string>) *
FSharp.Compiler.Syntax.ParsedInput> =
: cmap<
DeclName,
DeclarationListItem *
Position *
string<LocalPath> *
(Position -> option<string>) *
FSharp.Compiler.Syntax.ParsedInput
> =
cmap ()
"""

Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/LetBindingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,7 @@ module PoorlyIndented =
select name
from things
where id = :id
" >
" >
dependency
cmd.AsyncExecute(id = thingId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ let ``multiline abstract member without constraints, 2175`` () =
type FuseSortFunctionItem =
abstract Item:
key: string ->
U2<{| ``$``: string |}, ResizeArray<{| ``$``:
string
idx:
float |}>> with get, set
U2<
{| ``$``: string |},
ResizeArray<{| ``$``: string; idx: float |}>
> with get, set
abstract X: int
"""
11 changes: 8 additions & 3 deletions src/Fantomas.Core.Tests/SignatureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,9 +1554,14 @@ namespace Foo
type Bar =
member Hello :
thing :
XLongLongLongLongLongLongLongLong<bool -> 'a, bool -> 'b, bool -> 'c, bool -> 'd, bool -> ('e -> 'f) -> 'g, ('h
-> 'i)
-> 'j> *
XLongLongLongLongLongLongLongLong<
bool -> 'a,
bool -> 'b,
bool -> 'c,
bool -> 'd,
bool -> ('e -> 'f) -> 'g,
('h -> 'i) -> 'j
> *
item : int list ->
LongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLong
"""
Expand Down
Loading

0 comments on commit 3a10e88

Please sign in to comment.