Skip to content

Commit

Permalink
Run long array sequence test on CI. (fsprojects#1520)
Browse files Browse the repository at this point in the history
* Run `long array sequence` test on CI.

* Call finalContinuation inside last callback.
Run unit test in release mode.
  • Loading branch information
nojaf authored Mar 15, 2021
1 parent ea53b70 commit afed9a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/Fantomas.Tests/ListTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ let ``line comment inside array`` () =
|]
"""

#if RELEASE
[<Test>]
[<Ignore("fails on ci")>]
let ``long array sequence`` () =
formatSourceString
false
Expand Down Expand Up @@ -1482,6 +1482,7 @@ let input =
let sample = [| 0; 3; 0; 1; -3 |]
"""
#endif

[<Test>]
let ``F# 4.7 implicit yield in sequence`` () =
Expand Down
8 changes: 1 addition & 7 deletions src/Fantomas/AstTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,7 @@ module private Ast =
mkNode SynExpr_Lazy range :: nodes
|> finalContinuation)
| SynExpr.Sequential (_, _, expr1, expr2, _) ->
let continuations : ((TriviaNodeAssigner list -> TriviaNodeAssigner list) -> TriviaNodeAssigner list) list =
[ visit expr1; visit expr2 ]

let finalContinuation (nodes: TriviaNodeAssigner list list) : TriviaNodeAssigner list =
(List.collect id nodes) |> finalContinuation

Continuation.sequence continuations finalContinuation
visit expr2 (fun nodes1 -> visit expr1 (fun nodes2 -> nodes1 @ nodes2 |> finalContinuation))
| SynExpr.SequentialOrImplicitYield (_, expr1, expr2, ifNotStmt, range) ->
let continuations : ((TriviaNodeAssigner list -> TriviaNodeAssigner list) -> TriviaNodeAssigner list) list =
[ visit expr1
Expand Down

0 comments on commit afed9a7

Please sign in to comment.