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 to FCS 38 #1240

Merged
merged 10 commits into from
Nov 12, 2020
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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"isRoot": true,
"tools": {
"paket": {
"version": "5.245.1",
"version": "5.252.0",
"commands": [
"paket"
]
},
"fake-cli": {
"version": "5.20.0",
"version": "5.20.4-alpha.1642",
"commands": [
"fake"
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
dotnet: [3.1.100]
dotnet: [5.0.100]
runs-on: ${{ matrix.os }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/myget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
dotnet: [3.1.100]
dotnet: [5.0.100]
runs-on: ${{ matrix.os }}

steps:
Expand Down
4 changes: 2 additions & 2 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ let fantomasExecutableForExternalTests projectdir =
| DotNet.BuildConfiguration.Release -> "Release"
| DotNet.BuildConfiguration.Custom s -> s

{ ProcessName = "dotnet"; Arguments = [ sprintf "%s/src/Fantomas.CoreGlobalTool/bin/%s/netcoreapp3.0/fantomas-tool.dll" projectdir configuration ] }
{ ProcessName = "dotnet"; Arguments = [ sprintf "%s/src/Fantomas.CoreGlobalTool/bin/%s/net5.0/fantomas-tool.dll" projectdir configuration ] }

let externalProjectsToTest = [
// { GitUrl = @"https://github.com/fsprojects/Argu"
Expand Down Expand Up @@ -364,7 +364,7 @@ open Microsoft.Azure.Cosmos.Table
open Microsoft.Azure.Documents

Target.create "Benchmark" (fun _ ->
DotNet.exec id ("src" </> "Fantomas.Benchmarks" </> "bin" </> "Release" </> "netcoreapp3.1" </> "Fantomas.Benchmarks.dll") ""
DotNet.exec id ("src" </> "Fantomas.Benchmarks" </> "bin" </> "Release" </> "net5.0" </> "Fantomas.Benchmarks.dll") ""
|> ignore

match Environment.environVarOrNone "TABLE_STORAGE_CONNECTION_STRING" with
Expand Down
7 changes: 4 additions & 3 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
source https://api.nuget.org/v3/index.json
framework: netstandard2.0, netcoreapp3.1

framework: netstandard2.0, net5.0
storage: none

nuget FSharp.Core
nuget FSharp.Compiler.Service ~> 37.0
nuget FSharp.Compiler.Service ~> 38.0
nuget FsUnit
nuget FsCheck
nuget Microsoft.NET.Test.Sdk 16.7.0
Expand All @@ -15,4 +16,4 @@ nuget BenchmarkDotNet
nuget editorconfig
nuget MAB.DotIgnore 3.0.1

github: fsprojects/fantomas:829faa6ba834f99afed9b4434b3a1680536474b2 src/Fantomas/CodePrinter.fs
github: fsprojects/fantomas:829faa6ba834f99afed9b4434b3a1680536474b2 src/Fantomas/CodePrinter.fs
226 changes: 95 additions & 131 deletions paket.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Fantomas.Benchmarks/Fantomas.Benchmarks.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<WarningsAsErrors>FS0025</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateProgramFile>false</GenerateProgramFile>
<Version>4.3.0-alpha-003</Version>
Expand Down
11 changes: 1 addition & 10 deletions src/Fantomas.CoreGlobalTool.Tests/TestHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,7 @@ let runFantomasTool arguments =

let fantomasDll =
Path.Combine
(pwd,
"..",
"..",
"..",
"..",
"Fantomas.CoreGlobalTool",
"bin",
configuration,
"netcoreapp3.1",
"fantomas-tool.dll")
(pwd, "..", "..", "..", "..", "Fantomas.CoreGlobalTool", "bin", configuration, "net5.0", "fantomas-tool.dll")

use p = new Process()
p.StartInfo.UseShellExecute <- false
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.CoreGlobalTool/Fantomas.CoreGlobalTool.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<ToolCommandName>fantomas</ToolCommandName>
<PackAsTool>True</PackAsTool>
<Version>4.3.0-alpha-003</Version>
Expand Down
96 changes: 94 additions & 2 deletions src/Fantomas.Tests/CompilerDirectivesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -379,14 +379,17 @@ let ``some spacing is still lost in and around #if blocks, 303`` () =
"""
({ config with
MaxInfixOperatorExpression = 75 })
|> should equal """let internal UpdateStrongNaming (assembly: AssemblyDefinition) (key: StrongNameKeyPair option) =
|> prepend newline
|> should equal """
let internal UpdateStrongNaming (assembly: AssemblyDefinition) (key: StrongNameKeyPair option) =
let assemblyName = assembly.Name
#if NETCOREAPP2_0
do
#else
match key with
| None ->
#endif
do assembly.MainModule.Attributes <- assembly.MainModule.Attributes &&& (~~~ModuleAttributes.StrongNameSigned)
assembly.MainModule.Attributes <- assembly.MainModule.Attributes &&& (~~~ModuleAttributes.StrongNameSigned)
assemblyName.HasPublicKey <- false
assemblyName.PublicKey <- null
assemblyName.PublicKeyToken <- null
Expand All @@ -398,6 +401,95 @@ let ``some spacing is still lost in and around #if blocks, 303`` () =
#endif
"""

[<Test>]
let ``some spacing is still lost in and around #if blocks, no defines`` () =
formatSourceStringWithDefines [] """
let internal UpdateStrongNaming (assembly : AssemblyDefinition) (key : StrongNameKeyPair option) =
let assemblyName = assembly.Name
#if NETCOREAPP2_0
do
#else
match key with
| None ->
#endif
assembly.MainModule.Attributes <- assembly.MainModule.Attributes &&& (~~~ModuleAttributes.StrongNameSigned)
assemblyName.HasPublicKey <- false
assemblyName.PublicKey <- null
assemblyName.PublicKeyToken <- null
#if NETCOREAPP2_0
#else
| Some key' -> assemblyName.HasPublicKey <- true
assemblyName.PublicKey <- key'.PublicKey // sets token implicitly
#endif
"""
({ config with
MaxInfixOperatorExpression = 75 })
|> prepend newline
|> should equal """
let internal UpdateStrongNaming (assembly: AssemblyDefinition) (key: StrongNameKeyPair option) =
let assemblyName = assembly.Name
#if NETCOREAPP2_0

#else
match key with
| None ->
#endif
assembly.MainModule.Attributes <- assembly.MainModule.Attributes &&& (~~~ModuleAttributes.StrongNameSigned)
assemblyName.HasPublicKey <- false
assemblyName.PublicKey <- null
assemblyName.PublicKeyToken <- null
#if NETCOREAPP2_0
#else
| Some key' ->
assemblyName.HasPublicKey <- true
assemblyName.PublicKey <- key'.PublicKey // sets token implicitly
#endif
"""

[<Test>]
let ``some spacing is still lost in and around #if blocks, NETCOREAPP2_0`` () =
formatSourceStringWithDefines [ "NETCOREAPP2_0" ] """
let internal UpdateStrongNaming (assembly : AssemblyDefinition) (key : StrongNameKeyPair option) =
let assemblyName = assembly.Name
#if NETCOREAPP2_0
do
#else
match key with
| None ->
#endif
assembly.MainModule.Attributes <- assembly.MainModule.Attributes &&& (~~~ModuleAttributes.StrongNameSigned)
assemblyName.HasPublicKey <- false
assemblyName.PublicKey <- null
assemblyName.PublicKeyToken <- null
#if NETCOREAPP2_0
#else
| Some key' -> assemblyName.HasPublicKey <- true
assemblyName.PublicKey <- key'.PublicKey // sets token implicitly
#endif
"""
({ config with
MaxInfixOperatorExpression = 75 })
|> prepend newline
|> should equal """
let internal UpdateStrongNaming (assembly: AssemblyDefinition) (key: StrongNameKeyPair option) =
let assemblyName = assembly.Name
#if NETCOREAPP2_0
do
#else


#endif
assembly.MainModule.Attributes <- assembly.MainModule.Attributes &&& (~~~ModuleAttributes.StrongNameSigned)
assemblyName.HasPublicKey <- false
assemblyName.PublicKey <- null
assemblyName.PublicKeyToken <- null
#if NETCOREAPP2_0
#else


#endif
"""

[<Test>]
let ``nested directives, FABLE_COMPILER`` () =
formatSourceStringWithDefines [ "FABLE_COMPILER" ] """namespace Fable.React
Expand Down
Loading