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

"#if" directive around nullness removed fromsrc/Compiler/DependencyManager/DependencyProvider.fs and refactored. #18207

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

progressive-galib
Copy link
Contributor

Description

"#if" directive around nullness removed fromsrc/Compiler/DependencyManager/DependencyProvider.fs and refactored.

Related: #18061 (partially addresses)

Checklist

  • Release notes entry updated: in
    docs/release-notes/.FSharp.Compiler.Service/9.0.200.md,

progressive-galib and others added 2 commits January 7, 2025 08:08
"#if" directive around nullness removed from src
Related: dotnet#18061 (partially addresses)

- [x] Release notes entry updated: in
    `docs/release-notes/.FSharp.Compiler.Service/9.0.200.md`,
@progressive-galib progressive-galib requested a review from a team as a code owner January 7, 2025 08:14
Copy link
Contributor

github-actions bot commented Jan 7, 2025

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.200.md

@@ -122,10 +122,8 @@ type IResolveDependenciesResult =
/// This path is also equivalent to
/// #I @"c:\somepath\to\packages\1.1.1\ResolvedPackage"
abstract Roots: seq<string>

#if NO_CHECKNULLS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The directive is logically negated, i.e. NO_CHECKNULLS.
With SDK 9, we do have null checking support, so the attribute is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason project build fails when i remove this,
#if NO_CHECKNULLS [<AllowNullLiteral>] #endif

also btw my machine is too weak to build it so i am using your ci/cd. hope its okay....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@T-Gro it fails with

Restore was successful. Restored /Users/runner/work/1/s/.packages/microsoft.dotnet.arcade.sdk/9.0.0-beta.24623.3/tools/Tools.proj (in 2.25 sec). /Users/runner/work/1/s/src/FSharp.Build/FSharp.Build.fsproj : error NU1503: Skipping restore for project '/Users/runner/work/1/s/src/FSharp.Build/FSharp.Build.fsproj'. The project file may be invalid or missing targets required for restore. [/Users/runner/work/1/s/FSharp.sln] ##[error]src/FSharp.Build/FSharp.Build.fsproj(0,0): error NU1503: (NETCORE_ENGINEERING_TELEMETRY=Restore) Skipping restore for project '/Users/runner/work/1/s/src/FSharp.Build/FSharp.Build.fsproj'. The project file may be invalid or missing targets required for restore. /Users/runner/work/1/s/tests/service/data/TestTP/TestTP.fsproj : error NU1503: Skipping restore for project '/Users/runner/work/1/s/tests/service/data/TestTP/TestTP.fsproj'. The project file may be invalid or missing targets required for restore. [/Users/runner/work/1/s/FSharp.sln] ##[error]tests/service/data/TestTP/TestTP.fsproj(0,0): error NU1503: (NETCORE_ENGINEERING_TELEMETRY=Restore) Skipping restore for project '/Users/runner/work/1/s/tests/service/data/TestTP/TestTP.fsproj'. The project file may be invalid or missing targets required for restore. /Users/runner/work/1/s/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj : error NU1503: Skipping restore for project '/Users/runner/work/1/s/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj'. The project file may be invalid or missing targets required for restore. [/Users/runner/work/1/s/FSharp.sln] ##[error]tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj(0,0): error NU1503: (NETCORE_ENGINEERING_TELEMETRY=Restore) Skipping restore for project '/Users/runner/work/1/s/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj'. The project file may be invalid or missing targets required for restore. /Users/runner/work/1/s/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj : error NU1503: Skipping restore for project '/Users/runner/work/1/s/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj'. The project file may be invalid or missing targets required for restore. [/Users/runner/work/1/s/FSharp.sln] ##[error]tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj(0,0): error NU1503: (NETCORE_ENGINEERING_TELEMETRY=Restore) Skipping restore for project '/Users/runner/work/1/s/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj'. The project file may be invalid or missing targets required for restore. /Users/runner/work/1/s/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj : error NU1503: Skipping restore for project '/Users/runner/work/1/s/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj'. The project file may be invalid or missing targets required for restore. [/Users/runner/work/1/s/FSharp.sln] ##[error]tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj(0,0): error NU1503: (NETCORE_ENGINEERING_TELEMETRY=Restore) Skipping restore for project '/Users/runner/work/1/s/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj'. The project file may be invalid or missing targets required for restore. Determining projects to restore... /Users/runner/work/1/s/src/FSharp.Core/FSharp.Core.fsproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=netstandard2.0] ##[error]src/FSharp.Core/FSharp.Core.fsproj(0,0): error MSB4057: (NETCORE_ENGINEERING_TELEMETRY=Restore) The target "_GetRestoreSettingsPerFramework" does not exist in the project. /Users/runner/work/1/s/src/fsc/fscProject/fsc.fsproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=net9.0] ##[error]src/fsc/fscProject/fsc.fsproj(0,0): error MSB4057: (NETCORE_ENGINEERING_TELEMETRY=Restore) The target "_GetRestoreSettingsPerFramework" does not exist in the project. /Users/runner/work/1/s/src/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=netstandard2.0] ##[error]src/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj(0,0): error MSB4057: (NETCORE_ENGINEERING_TELEMETRY=Restore) The target "_GetRestoreSettingsPerFramework" does not exist in the project. /Users/runner/work/1/s/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=net9.0] ##[error]tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj(0,0): error MSB4057: (NETCORE_ENGINEERING_TELEMETRY=Restore) The target "_GetRestoreSettingsPerFramework" does not exist in the project. /Users/runner/work/1/s/tests/fsharp/FSharpSuite.Tests.fsproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=net9.0] ##[error]tests/fsharp/FSharpSuite.Tests.fsproj(0,0): error MSB4057: (NETCORE_ENGINEERING_TELEMETRY=Restore) The target "_GetRestoreSettingsPerFramework" does not exist in the project. /Users/runner/work/1/s/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=net9.0] ##[error]tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj(0,0): error MSB4057: (NETCORE_ENGINEERING_TELEMETRY=Restore) The target "_GetRestoreSettingsPerFramework" does not exist in the project. /Users/runner/work/1/s/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj : error MSB4057: The target "_GetRestoreSettingsPerFramework" does not exist in the project. [TargetFramework=net9.0] ##[error]tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj(0,0): error MSB4057: (NETCORE_ENGINEERING_TELEMETRY=Restore) The target "_GetRestoreSettingsPerFramework" does not exist in the project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my guess is it has something to makefiles or buildscripts or whatever f# equivalent there is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git checkout cf575d3

@progressive-galib progressive-galib marked this pull request as draft January 7, 2025 16:02
@progressive-galib progressive-galib marked this pull request as ready for review January 7, 2025 16:32
@progressive-galib progressive-galib force-pushed the 18061-DependencyProvider branch from bfbca20 to cf575d3 Compare January 7, 2025 19:13
@T-Gro
Copy link
Member

T-Gro commented Jan 8, 2025

/run fantomas

@T-Gro
Copy link
Member

T-Gro commented Jan 8, 2025

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

github-actions bot commented Jan 8, 2025

@@ -160,15 +160,15 @@ type ReflectionDependencyManagerProvider

let instance =
if not (isNull (theType.GetConstructor([| typeof<string option>; typeof<bool> |]))) then
Activator.CreateInstance(theType, [| outputDir :> objnull; useResultsCache :> objnull |])
Activator.CreateInstance(theType, [| outputDir :> obj | null; useResultsCache :> obj | null |])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objnull is an alias which became part of the public API of FSharp.Core -> that one can remain.
It is just an alias to obj|null, both are fine.

@T-Gro
Copy link
Member

T-Gro commented Jan 8, 2025

Does "dotnet fantomas ." fail for you locally as well?
What if you manually try updating to a newer Fantomas version?
(if it is because of |null, it might need a tool update)

@Martin521
Copy link
Contributor

I guess the changed files must temporarily be put into the nullness section of .fantomasignore until fantomas 7 is out.

@psfinaki
Copy link
Member

psfinaki commented Jan 9, 2025

So I took a look:

  • dotnet fantomas . indeed fails locally here
  • the fantomas version we have is the latest available in our feeds
  • we could update the feeds and the fantomas version but the newest fantomas (6.3.16) just throws StackOverflow on our repo (even main)

(fyi @nojaf)

So I think @progressive-galib the best we can do here is to revert formatting changes (and also the ones which are deemed not necessary by @T-Gro) and put the DependencyProvider to the .fantomasignore.

Sorry for the inconvenience here, nulls shook the F# ecosystem a bit. Other files might cause less problems :)

@nojaf
Copy link
Contributor

nojaf commented Jan 9, 2025

Hi,

Could you try the latest beta maybe? That has initial support for all the nullness stuff: https://www.nuget.org/packages/fantomas/7.0.0-beta-001

You PR here will need to be ignored (via .fantomasignore) as it seems to have nullness syntax.

@psfinaki
Copy link
Member

psfinaki commented Jan 9, 2025

I think it behaves differently and does some changes, but eventually the beta also throws SO :/

@nojaf
Copy link
Contributor

nojaf commented Jan 10, 2025

@psfinaki could you share some more details? Latest beta worked for me on this branch.

image

@progressive-galib
Copy link
Contributor Author

progressive-galib commented Jan 11, 2025

@psfinaki could you share some more details? Latest beta worked for me on this branch.

image

could you push cause it fails on my machine.

@nojaf
Copy link
Contributor

nojaf commented Jan 11, 2025

You need to ignore the file for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

5 participants