Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update FCS to 41.0.3 #2122

Merged
merged 16 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Changed
* Always add a space for multiple curried args invocation. [#2087](https://github.com/fsprojects/fantomas/issues/2087)
* Update FCS to 41.0.3

## [4.6.6] - 2022-03-04

### Changed
Expand Down
6 changes: 3 additions & 3 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ source https://api.nuget.org/v3/index.json
framework: netstandard2.0, net6.0, netcoreapp3.1
storage: none

nuget FSharp.Core 6.0.1 content: none
nuget FSharp.Compiler.Service == 41.0.1
nuget FSharp.Core content: none
nuget FSharp.Compiler.Service == 41.0.3
nuget FsUnit
nuget FsCheck
nuget Microsoft.NET.Test.Sdk
Expand Down Expand Up @@ -40,7 +40,7 @@ group tool
storage: none
source https://api.nuget.org/v3/index.json

nuget FSharp.Core 6.0.1 content: none
nuget FSharp.Core content: none
nuget Argu
nuget StreamJsonRpc
nuget Thoth.Json.Net
Expand Down
16 changes: 8 additions & 8 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ NUGET
editorconfig (0.12.2)
FsCheck (2.16.4)
FSharp.Core (>= 4.2.3)
FSharp.Compiler.Service (41.0.1)
FSharp.Core (6.0.1)
Microsoft.Build.Framework (>= 16.11)
Microsoft.Build.Tasks.Core (>= 16.11)
Microsoft.Build.Utilities.Core (>= 16.11)
FSharp.Compiler.Service (41.0.3)
FSharp.Core (6.0.3)
Microsoft.Build.Framework (>= 17.0)
Microsoft.Build.Tasks.Core (>= 17.0)
Microsoft.Build.Utilities.Core (>= 17.0)
System.Buffers (>= 4.5.1)
System.Collections.Immutable (>= 5.0)
System.Diagnostics.Process (>= 4.3)
Expand All @@ -49,7 +49,7 @@ NUGET
System.Reflection.Metadata (>= 5.0)
System.Reflection.TypeExtensions (>= 4.3)
System.Runtime (>= 4.3)
System.Runtime.CompilerServices.Unsafe (>= 5.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Runtime.InteropServices (>= 4.3)
System.Runtime.Loader (>= 4.3)
System.Security.Claims (>= 4.3)
Expand All @@ -58,7 +58,7 @@ NUGET
System.Threading.Tasks.Parallel (>= 4.3)
System.Threading.Thread (>= 4.3)
System.Threading.ThreadPool (>= 4.3)
FSharp.Core (6.0.1) - content: none
FSharp.Core (6.0.3) - content: none
FsUnit (4.2)
FSharp.Core (>= 5.0.2)
NETStandard.Library (>= 2.0.3)
Expand Down Expand Up @@ -372,7 +372,7 @@ NUGET
System.Resources.ResourceManager (>= 4.3)
System.Runtime (>= 4.3)
System.Management (6.0)
Microsoft.Win32.Registry (>= 5.0) - restriction: || (&& (== net6.0) (== netstandard2.0)) (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.Win32.Registry (>= 5.0) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp3.1))
System.CodeDom (>= 6.0)
System.Memory (4.5.4)
System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (&& (== netcoreapp3.1) (>= monotouch)) (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= xamarinios)) (&& (== netcoreapp3.1) (>= xamarinmac)) (&& (== netcoreapp3.1) (>= xamarintvos)) (&& (== netcoreapp3.1) (>= xamarinwatchos)) (== netstandard2.0)
Expand Down
29 changes: 27 additions & 2 deletions src/Fantomas.Tests/ClassTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ let ``member properties with type annotation`` () =
and set (_: int): unit = ()

member this.Z
with get (): int = 1
and set (_: int): unit = ()
with set (_: int): unit = ()
and get (): int = 1
"""

[<Test>]
Expand Down Expand Up @@ -1048,3 +1048,28 @@ type Subject<'a> private () =
/// Each notification is broadcasted to all subscribed observers.
static member broadcast = new System.Reactive.Subjects.Subject<'a>()
"""

[<Test>]
let ``comments after equals sign in read/write property`` () =
formatSourceString
false
"""
type Foo() =
member this.MyReadWriteProperty
with get () = //comment get
myInternalValue
and set (value) = // comment set
myInternalValue <- value
"""
config
|> prepend newline
|> should
equal
"""
type Foo() =
member this.MyReadWriteProperty
with get () = //comment get
myInternalValue
and set (value) = // comment set
myInternalValue <- value
"""
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/CommentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ with
"""

[<Test>]
let ``comment shold not be lost`` () =
let ``comment should not be lost`` () =
formatSourceString
false
"""
Expand Down
5 changes: 2 additions & 3 deletions src/Fantomas.Tests/CompilerDirectivesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2237,10 +2237,9 @@ let getDefaultProxyFor =
#if CUSTOM_WEBPROXY
let result =
{ new IWebProxy with
member __.Credentials = null

member __.Credentials
with set _value = ()
with get () = null
and set _value = ()

member __.GetProxy _ = null
member __.IsBypassed(_host: Uri) = true }
Expand Down
11 changes: 4 additions & 7 deletions src/Fantomas.Tests/FormatAstTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ let formatAst code =
let ``format the ast works correctly with no source code`` () = formatAst "()" |> should equal "()"

[<Test>]
let ``let in should not be used`` () =
let ``let in should be used`` () =
formatAst "let x = 1 in ()"
|> should
equal
"""let x = 1
()"""
|> should equal """let x = 1 in ()"""

[<Test>]
let ``elif keyword is present in raw AST`` () =
Expand Down Expand Up @@ -91,7 +88,7 @@ type Foo =
"""[<AbstractClass>]
type Foo =
abstract foo: int
override __.foo = 1"""
default __.foo = 1"""

[<Test>]
let ``default implementations in abstract classes with `default` keyword should be emited as it was before from AST with origin source, 742``
Expand Down Expand Up @@ -133,7 +130,7 @@ let ``object expression should emit override keyword on AST formatting without o
|> should
equal
"""{ new System.IDisposable with
override __.Dispose() = () }"""
member __.Dispose() = () }"""

[<Test>]
let ``object expression should preserve member keyword on AST formatting with origin source, 742`` () =
Expand Down
54 changes: 54 additions & 0 deletions src/Fantomas.Tests/KeepIndentInBranchTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2147,3 +2147,57 @@ module Foo =
leftSet.SymmetricExceptWith(FooBarBaz.keys rightThings)
|> ignore
"""

[<Test>]
let ``comment after match keyword`` () =
formatSourceString
false
"""
match // comment
Stream.peel rest with
| None -> failwith "oh no"
| Some longName ->

longName
|> Map.map (fun _ -> TypedTerm.force<int>)
"""
config
|> prepend newline
|> should
equal
"""
match // comment
Stream.peel rest with
| None -> failwith "oh no"
| Some longName ->

longName
|> Map.map (fun _ -> TypedTerm.force<int>)
"""

[<Test>]
let ``comment after match bang keyword`` () =
formatSourceString
false
"""
match! // comment
Stream.peel rest with
| None -> failwith "oh no"
| Some longName ->

longName
|> Map.map (fun _ -> TypedTerm.force<int>)
"""
config
|> prepend newline
|> should
equal
"""
match! // comment
Stream.peel rest with
| None -> failwith "oh no"
| Some longName ->

longName
|> Map.map (fun _ -> TypedTerm.force<int>)
"""
38 changes: 38 additions & 0 deletions src/Fantomas.Tests/ModuleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -741,3 +741,41 @@ module Input

let modules = [ 109024; 137172; 80445; 80044 ]
"""

[<Test>]
let ``comment after equals sign in named module`` () =
formatSourceString
false
"""
module Foo = // comment
let bar = 9
"""
config
|> prepend newline
|> should
equal
"""
module Foo = // comment
let bar = 9
"""

[<Test>]
let ``comment after equals sign in named module, signature file`` () =
formatSourceString
true
"""
namespace Meh

module Foo = // comment
val bar : int
"""
config
|> prepend newline
|> should
equal
"""
namespace Meh

module Foo = // comment
val bar: int
"""
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ type Element =
equal
"""
module RecordSignature

/// Represents simple XML elements.
type Element =
{
Expand Down Expand Up @@ -1229,3 +1230,41 @@ let x =
Age = 41
|}
"""

[<Test>]
let ``comment after equals in record field`` () =
formatSourceString
false
"""
{ A = //comment
B }
"""
config
|> prepend newline
|> should
equal
"""
{
A = //comment
B
}
"""

[<Test>]
let ``comment after equals in anonymous record field`` () =
formatSourceString
false
"""
{| A = //comment
B |}
"""
config
|> prepend newline
|> should
equal
"""
{|
A = //comment
B
|}
"""
4 changes: 2 additions & 2 deletions src/Fantomas.Tests/NumberOfItemsRecordTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,10 @@ type Element =
equal
"""
module RecordSignature

/// Represents simple XML elements.
type Element =
{
/// The attribute collection.
{ /// The attribute collection.
Attributes: IDictionary<Name, string>

/// The children collection.
Expand Down
56 changes: 56 additions & 0 deletions src/Fantomas.Tests/PatternMatchingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2067,3 +2067,59 @@ let examineData x =
| OnePartData (part1 = p1) -> p1
| TwoPartData (part1 = p1; part2 = p2) -> p1 + p2
"""

[<Test>]
let ``comment after match keyword`` () =
formatSourceString
false
"""
match // foo
a with
| B b -> ()
"""
config
|> prepend newline
|> should
equal
"""
match // foo
a with
| B b -> ()
"""

[<Test>]
let ``comment after match bang keyword`` () =
formatSourceString
false
"""
match! // foo
a with
| B b -> ()
"""
config
|> prepend newline
|> should
equal
"""
match! // foo
a with
| B b -> ()
"""

[<Test>]
let ``comment after with keyword in match bang`` () =
formatSourceString
false
"""
match!
a with // foo
| B b -> ()
"""
config
|> prepend newline
|> should
equal
"""
match! a with // foo
| B b -> ()
"""
Loading