From a84e8fa1fb532ddcd65fcf45af11cd8aac4c841a Mon Sep 17 00:00:00 2001 From: Richard Webb Date: Wed, 13 Nov 2024 17:26:56 +0000 Subject: [PATCH 1/6] Update FSharp.Compiler.Service and FSharp.Core to the '9' versions --- Directory.Packages.props | 4 ++-- src/FSharp.Analyzers.SDK/ASTCollecting.fs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 15e3fa8..1d84a5c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,8 +5,8 @@ - - + + diff --git a/src/FSharp.Analyzers.SDK/ASTCollecting.fs b/src/FSharp.Analyzers.SDK/ASTCollecting.fs index d93f396..18d9cef 100644 --- a/src/FSharp.Analyzers.SDK/ASTCollecting.fs +++ b/src/FSharp.Analyzers.SDK/ASTCollecting.fs @@ -136,6 +136,7 @@ module ASTCollecting = | SynTypeConstraint.WhereTyparIsReferenceType(t, _) | SynTypeConstraint.WhereTyparIsUnmanaged(t, _) | SynTypeConstraint.WhereTyparSupportsNull(t, _) + | SynTypeConstraint.WhereTyparNotSupportsNull(t, _, _) | SynTypeConstraint.WhereTyparIsComparable(t, _) | SynTypeConstraint.WhereTyparIsEquatable(t, _) -> walkTypar path t | SynTypeConstraint.WhereTyparDefaultsToType(t, ty, _) @@ -245,6 +246,8 @@ module ASTCollecting = | SynType.StaticConstant _ -> () | SynType.StaticConstantExpr _ -> () | SynType.StaticConstantNamed _ -> () + | SynType.StaticConstantNull _ -> () + | SynType.WithNull(innerType, _, _, _) -> walkType nextPath innerType | SynType.Paren(innerType, _) -> walkType nextPath innerType | SynType.SignatureParameter(usedType = t; range = _) -> walkType nextPath t | SynType.Or(lhsType = lhs; rhsType = rhs) -> From 726f6de5849fb2abcb0d391348dd0228e8649227 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sat, 16 Nov 2024 15:21:33 -0500 Subject: [PATCH 2/6] Bump TFM to net8 and net9 --- .github/workflows/ci.yml | 5 +++++ .github/workflows/release.yml | 6 ++++++ Directory.Packages.props | 3 ++- global.json | 2 +- samples/OptionAnalyzer.Test/OptionAnalyzer.Test.fsproj | 2 +- samples/OptionAnalyzer/OptionAnalyzer.fsproj | 2 +- src/FSharp.Analyzers.Cli/FSharp.Analyzers.Cli.fsproj | 2 +- .../FSharp.Analyzers.SDK.Testing.fsproj | 2 +- src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.fsproj | 4 ++-- 9 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bd086c..912ec1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,11 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 + with: + global-json-file: 'global.json' + dotnet-version: | + 8.x + 9.x - name: Build run: dotnet fsi build.fsx diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c6637a1..14865e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,12 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 + with: + global-json-file: 'global.json' + dotnet-version: | + 8.x + 9.x + - name: Run Release Build run: dotnet fsi build.fsx -p ReleaseBuild diff --git a/Directory.Packages.props b/Directory.Packages.props index 1d84a5c..0a6ee19 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,6 +2,7 @@ true 17.2.0 + direct @@ -11,7 +12,7 @@ - + diff --git a/global.json b/global.json index 39c53b8..2bc13e8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.200", + "version": "9.0.100", "rollForward": "latestMinor" } } diff --git a/samples/OptionAnalyzer.Test/OptionAnalyzer.Test.fsproj b/samples/OptionAnalyzer.Test/OptionAnalyzer.Test.fsproj index d9d4147..aa5302e 100644 --- a/samples/OptionAnalyzer.Test/OptionAnalyzer.Test.fsproj +++ b/samples/OptionAnalyzer.Test/OptionAnalyzer.Test.fsproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 LatestMajor false diff --git a/samples/OptionAnalyzer/OptionAnalyzer.fsproj b/samples/OptionAnalyzer/OptionAnalyzer.fsproj index dde246d..4e29e74 100644 --- a/samples/OptionAnalyzer/OptionAnalyzer.fsproj +++ b/samples/OptionAnalyzer/OptionAnalyzer.fsproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 diff --git a/src/FSharp.Analyzers.Cli/FSharp.Analyzers.Cli.fsproj b/src/FSharp.Analyzers.Cli/FSharp.Analyzers.Cli.fsproj index 9fd4150..07958de 100644 --- a/src/FSharp.Analyzers.Cli/FSharp.Analyzers.Cli.fsproj +++ b/src/FSharp.Analyzers.Cli/FSharp.Analyzers.Cli.fsproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 LatestMajor Exe true diff --git a/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj b/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj index e86d313..b2173c0 100644 --- a/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj +++ b/src/FSharp.Analyzers.SDK.Testing/FSharp.Analyzers.SDK.Testing.fsproj @@ -1,7 +1,7 @@  - net7.0 + net8.0; net9.0 true true true diff --git a/src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.fsproj b/src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.fsproj index 0c2f432..c03f91c 100644 --- a/src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.fsproj +++ b/src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.fsproj @@ -1,6 +1,6 @@ - + - net6.0 + net8.0 true true true From b1f296006a87f156c30a1fa1fd71e74073ffd0c9 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 19 Nov 2024 09:49:49 -0600 Subject: [PATCH 3/6] bump Ionide.ProjInfo version to get support for the new FCS and related runtime changes --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 0a6ee19..21a3ade 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -12,7 +12,7 @@ - + From 729646c93248ba776b4579aaa37235298c92d15e Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 19 Nov 2024 09:51:47 -0600 Subject: [PATCH 4/6] skip fantomas formatting because of NuGet bug that will be fixed in .NET SDK 9.0.101 --- build.fsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.fsx b/build.fsx index a5390de..05b3fe8 100644 --- a/build.fsx +++ b/build.fsx @@ -11,7 +11,8 @@ let purgeBinLogCache () = let restoreStage = stage "restore" { - run "dotnet tool restore" + // TODO: can uncomment this after .NET SDK 9.0.101 releases + // run "dotnet tool restore" run "dotnet restore --locked-mode" } @@ -20,7 +21,8 @@ let buildStage = pipeline "Build" { restoreStage - stage "lint" { run "dotnet fantomas . --check" } + // TODO: can uncomment this after .NET SDK 9.0.101 releases + // stage "lint" { run "dotnet fantomas . --check" } stage "build" { run "dotnet build -c Release --no-restore -maxCpuCount" } stage "test" { purgeBinLogCache () From 6c59f5cb65c58df21b4881a3220c8de4f278b9a5 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 19 Nov 2024 09:56:03 -0600 Subject: [PATCH 5/6] specifically only remove fantomas because the rest of the pipeline needs fsdocs --- .config/dotnet-tools.json | 6 ------ build.fsx | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 016a82c..8de306d 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -2,12 +2,6 @@ "version": 1, "isRoot": true, "tools": { - "fantomas": { - "version": "6.3.4", - "commands": [ - "fantomas" - ] - }, "fsdocs-tool": { "version": "20.0.0", "commands": [ diff --git a/build.fsx b/build.fsx index 05b3fe8..ff7bab4 100644 --- a/build.fsx +++ b/build.fsx @@ -11,8 +11,7 @@ let purgeBinLogCache () = let restoreStage = stage "restore" { - // TODO: can uncomment this after .NET SDK 9.0.101 releases - // run "dotnet tool restore" + run "dotnet tool restore" run "dotnet restore --locked-mode" } From d9a1b198e5c7ba7876a7dda7c93566b85eed82b8 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 19 Nov 2024 10:03:58 -0600 Subject: [PATCH 6/6] fix path to net8.0 testing dll now that this project multi-targets --- docs/content/Unit Testing.fsx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/docs/content/Unit Testing.fsx b/docs/content/Unit Testing.fsx index 5a3d63a..4e14c30 100644 --- a/docs/content/Unit Testing.fsx +++ b/docs/content/Unit Testing.fsx @@ -8,18 +8,18 @@ index: 5 # Unit testing an analyzer To help analyzer authors testing their analyzers, there's a dedicated [testing package](https://www.nuget.org/packages/FSharp.Analyzers.SDK.Testing). -It contains easy to use utility functions to create a context for the analyzer and assertion helpers. +It contains easy to use utility functions to create a context for the analyzer and assertion helpers. -[`FSharp.Analyzers.SDK.Testing.mkOptionsFromProject`](../reference/fsharp-analyzers-sdk-testing.html#mkOptionsFromProject) creates the [`FSharpProjectOptions`](https://fsharp.github.io/fsharp-compiler-docs/reference/fsharp-compiler-codeanalysis-fsharpprojectoptions.html) for the given framework (e.g. `net7.0`) and the given list of packages to reference. -[`FSharp.Analyzers.SDK.Testing.getContext`](../reference/fsharp-analyzers-sdk-testing.html#getContext) then takes the `FSharpProjectOptions` and the source code to test and creates a [`CliContext`](../reference/fsharp-analyzers-sdk-clicontext.html) you can pass along to your analyzer function. -The module [`FSharp.Analyzers.SDK.Testing.Assert`](../reference/fsharp-analyzers-sdk-testing-assert.html) offers various functions to help with assertion statements from your favorite unit testing framework. +[`FSharp.Analyzers.SDK.Testing.mkOptionsFromProject`](../reference/fsharp-analyzers-sdk-testing.html#mkOptionsFromProject) creates the [`FSharpProjectOptions`](https://fsharp.github.io/fsharp-compiler-docs/reference/fsharp-compiler-codeanalysis-fsharpprojectoptions.html) for the given framework (e.g. `net7.0`) and the given list of packages to reference. +[`FSharp.Analyzers.SDK.Testing.getContext`](../reference/fsharp-analyzers-sdk-testing.html#getContext) then takes the `FSharpProjectOptions` and the source code to test and creates a [`CliContext`](../reference/fsharp-analyzers-sdk-clicontext.html) you can pass along to your analyzer function. +The module [`FSharp.Analyzers.SDK.Testing.Assert`](../reference/fsharp-analyzers-sdk-testing-assert.html) offers various functions to help with assertion statements from your favorite unit testing framework. For a complete example of an unit testing project, take a look at [`OptionAnalyzer.Test`](https://github.com/ionide/FSharp.Analyzers.SDK/tree/7b7ec530c507d765ab18d93ebb7aa45ab59accc2/samples/OptionAnalyzer.Test) in the `samples` folder of the SDK repository. *) (*** hide ***) #r "../../artifacts/bin/FSharp.Analyzers.Cli/release/FSharp.Compiler.Service.dll" #r "../../artifacts/bin/FSharp.Analyzers.SDK/release/FSharp.Analyzers.SDK.dll" -#r "../../artifacts/bin/FSharp.Analyzers.SDK.Testing/release/FSharp.Analyzers.SDK.Testing.dll" +#r "../../artifacts/bin/FSharp.Analyzers.SDK.Testing/release_net8.0/FSharp.Analyzers.SDK.Testing.dll" #r "../../artifacts/bin/OptionAnalyzer.Test/release/nunit.framework.dll" #r "../../artifacts/bin/OptionAnalyzer.Test/release/OptionAnalyzer.dll" (** *) @@ -38,13 +38,10 @@ let Setup () = mkOptionsFromProject "net7.0" [ - // The SDK uses this in a "dotnet add package x --version y" command - // to generate the needed FSharpProjectOptions - { - Name = "Newtonsoft.Json" - Version = "13.0.3" - } - ] + // The SDK uses this in a "dotnet add package x --version y" command + // to generate the needed FSharpProjectOptions + { Name = "Newtonsoft.Json" + Version = "13.0.3" } ] projectOptions <- opts }