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 FSharp.Compiler.Service and FSharp.Core to the '9' versions #222

Merged
merged 6 commits into from
Nov 19, 2024
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: 0 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
"version": 1,
"isRoot": true,
"tools": {
"fantomas": {
"version": "6.3.4",
"commands": [
"fantomas"
]
},
"fsdocs-tool": {
"version": "20.0.0",
"commands": [
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<MsBuildPackageVersion>17.2.0</MsBuildPackageVersion>
<NuGetAuditMode>direct</NuGetAuditMode>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="CliWrap" Version="3.6.4" />
<PackageVersion Include="FSharp.Core" Version="[8.0.400]" />
<PackageVersion Include="FSharp.Compiler.Service" Version="[43.8.400]" />
<PackageVersion Include="FSharp.Core" Version="[9.0.100]" />
<PackageVersion Include="FSharp.Compiler.Service" Version="[43.9.100]" />
<PackageVersion Include="Ionide.KeepAChangelog.Tasks" Version="0.1.8" PrivateAssets="all" />
<PackageVersion Include="McMaster.NETCore.Plugins" Version="1.4.0" />
<PackageVersion Include="Argu" Version="6.1.1" />
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="Ionide.ProjInfo.ProjectSystem" Version="0.65.0" />
<PackageVersion Include="Ionide.ProjInfo.ProjectSystem" Version="0.68.0" />
<PackageVersion Include="Microsoft.Build" Version="$(MsBuildPackageVersion)" ExcludeAssets="runtime" />
<PackageVersion Include="Microsoft.Build.Framework" Version="$(MsBuildPackageVersion)" ExcludeAssets="runtime" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="$(MsBuildPackageVersion)" ExcludeAssets="runtime" />
Expand Down
3 changes: 2 additions & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,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 ()
Expand Down
21 changes: 9 additions & 12 deletions docs/content/Unit Testing.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
(** *)
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.200",
"version": "9.0.100",
"rollForward": "latestMinor"
}
}
2 changes: 1 addition & 1 deletion samples/OptionAnalyzer.Test/OptionAnalyzer.Test.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RollForward>LatestMajor</RollForward>

<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion samples/OptionAnalyzer/OptionAnalyzer.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Analyzers.Cli/FSharp.Analyzers.Cli.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RollForward>LatestMajor</RollForward>
<OutputType>Exe</OutputType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net8.0; net9.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPackable>true</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
3 changes: 3 additions & 0 deletions src/FSharp.Analyzers.SDK/ASTCollecting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _)
Expand Down Expand Up @@ -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) ->
Expand Down
4 changes: 2 additions & 2 deletions src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPackable>true</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down