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

* /Compiler/TypedTree/TypedTreePickle.fs refactored.
"#if" directive around nullness removed from src
Related: #18061 (partially addresses)

- [x] Release notes entry updated: in
    `docs/release-notes/.FSharp.Compiler.Service/9.0.200.md`,

* try 2

* refactoring

* .

* .

* lets hope this works

* .

* fantomas tried with a bit of tricks DependencyProvider.fs

* fantomas ignore

* unformat

---------

Co-authored-by: Petr <psfinaki@users.noreply.github.com>
This commit is contained in:
progressive-galib 2025-01-14 18:01:10 +06:00 коммит произвёл GitHub
Родитель 9f360ed6f8
Коммит b2f2065a99
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -40,6 +40,9 @@ src/Compiler/Checking/SignatureConformance.fs
src/Compiler/Checking/TypeHierarchy.fs
src/Compiler/Checking/TypeRelations.fs
# nullness-related problems
src/Compiler/DependencyManager/DependencyProvider.fs
# Incorrectly formatted: https://github.com/dotnet/fsharp/pull/14645/commits/49443a67ea8a17670c8a7c80c8bdf91f82231e91 or https://github.com/fsprojects/fantomas/issues/2733
# This CompilerImports.fs behavior is not fixed yet, following up in https://github.com/fsprojects/fantomas/issues/2733
src/Compiler/Driver/CompilerImports.fs

Просмотреть файл

@ -55,8 +55,8 @@
* Better ranges for #nowarn error reporting; bring back #nowarn warnings for --langVersion:80; add warnings under feature flag ([PR #17871](https://github.com/dotnet/fsharp/pull/17871))
* CheckAndThrow can be invoked only from within Cancellable context ([PR #18037](https://github.com/dotnet/fsharp/pull/18037))
* Make ILTypeDef base type calculation lazy. ([PR #18005](https://github.com/dotnet/fsharp/pull/18005))
* "#if" directive around nullness removed from src/Compiler/TypedTree/TypedTreePickle.fs and refactored. ([PR #18203](https://github.com/dotnet/fsharp/pull/18203))
* Removed redundant hash directives around nullness syntax ([Issue #18601](https://github.com/dotnet/fsharp/issues/18061), [PR #18203](https://github.com/dotnet/fsharp/pull/18203), [PR #18207](https://github.com/dotnet/fsharp/pull/18207))
### Breaking Changes
* Aliasing `StructAttribute` will now produce a warning (part of [Language suggestion #1136](https://github.com/fsharp/fslang-suggestions/issues/1136), [PR #18098](https://github.com/dotnet/fsharp/pull/18098))
* Aliasing `StructAttribute` will now produce a warning (part of [Language suggestion #1136](https://github.com/fsharp/fslang-suggestions/issues/1136), [PR #18098](https://github.com/dotnet/fsharp/pull/18098))

Просмотреть файл

@ -15,7 +15,7 @@ open System.Collections.Concurrent
module Option =
/// Convert string into Option string where null and String.Empty result in None
let ofString (s: string MaybeNull) =
let ofString (s: string | null) =
match s with
| null -> None
| "" -> None
@ -607,7 +607,7 @@ type DependencyProvider
outputDir: string,
reportError: ResolvingErrorReport,
path: string
) : string MaybeNull * IDependencyManagerProvider MaybeNull =
) : string | null * IDependencyManagerProvider | null =
try
if path.Contains ":" && not (Path.IsPathRooted path) then
let managers =
@ -637,7 +637,7 @@ type DependencyProvider
outputDir: string,
reportError: ResolvingErrorReport,
key: string
) : IDependencyManagerProvider MaybeNull =
) : IDependencyManagerProvider | null =
try
RegisteredDependencyManagers compilerTools (Option.ofString outputDir) reportError
|> Map.tryFind key
@ -657,7 +657,7 @@ type DependencyProvider
packageManagerTextLines: (string * string) seq,
reportError: ResolvingErrorReport,
executionTfm: string,
[<Optional; DefaultParameterValue(null: string MaybeNull)>] executionRid: string MaybeNull,
[<Optional; DefaultParameterValue(null: string | null)>] executionRid: string | null,
[<Optional; DefaultParameterValue("")>] implicitIncludeDir: string,
[<Optional; DefaultParameterValue("")>] mainScriptName: string,
[<Optional; DefaultParameterValue("")>] fileName: string,
@ -681,8 +681,8 @@ type DependencyProvider
try
let executionRid =
match executionRid with
| Null -> RidHelpers.platformRid
| NonNull executionRid -> executionRid
| null -> RidHelpers.platformRid
| executionRid -> executionRid
Ok(
packageManager.ResolveDependencies(

Просмотреть файл

@ -123,7 +123,7 @@ type DependencyProvider =
packageManagerTextLines: (string * string) seq *
reportError: ResolvingErrorReport *
executionTfm: string *
[<Optional; DefaultParameterValue(null: string MaybeNull)>] executionRid: string *
[<Optional; DefaultParameterValue(null: string | null)>] executionRid: string *
[<Optional; DefaultParameterValue("")>] implicitIncludeDir: string *
[<Optional; DefaultParameterValue("")>] mainScriptName: string *
[<Optional; DefaultParameterValue("")>] fileName: string *
@ -133,9 +133,9 @@ type DependencyProvider =
/// Fetch a dependencymanager that supports a specific key
member TryFindDependencyManagerByKey:
compilerTools: string seq * outputDir: string * reportError: ResolvingErrorReport * key: string ->
IDependencyManagerProvider MaybeNull
IDependencyManagerProvider | null
/// TryFindDependencyManagerInPath - given a #r "key:sometext" go and find a DependencyManager that satisfies the key
member TryFindDependencyManagerInPath:
compilerTools: string seq * outputDir: string * reportError: ResolvingErrorReport * path: string ->
string MaybeNull * IDependencyManagerProvider MaybeNull
string | null * IDependencyManagerProvider | null