Skip to content

Commit b2f2065

Browse files
"#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 <[email protected]>
1 parent 9f360ed commit b2f2065

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

.fantomasignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ src/Compiler/Checking/SignatureConformance.fs
4040
src/Compiler/Checking/TypeHierarchy.fs
4141
src/Compiler/Checking/TypeRelations.fs
4242

43+
# nullness-related problems
44+
src/Compiler/DependencyManager/DependencyProvider.fs
45+
4346
# Incorrectly formatted: https://github.com/dotnet/fsharp/pull/14645/commits/49443a67ea8a17670c8a7c80c8bdf91f82231e91 or https://github.com/fsprojects/fantomas/issues/2733
4447
# This CompilerImports.fs behavior is not fixed yet, following up in https://github.com/fsprojects/fantomas/issues/2733
4548
src/Compiler/Driver/CompilerImports.fs

docs/release-notes/.FSharp.Compiler.Service/9.0.200.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
* 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))
5656
* CheckAndThrow can be invoked only from within Cancellable context ([PR #18037](https://github.com/dotnet/fsharp/pull/18037))
5757
* Make ILTypeDef base type calculation lazy. ([PR #18005](https://github.com/dotnet/fsharp/pull/18005))
58-
* "#if" directive around nullness removed from src/Compiler/TypedTree/TypedTreePickle.fs and refactored. ([PR #18203](https://github.com/dotnet/fsharp/pull/18203))
58+
* 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))
5959

6060
### Breaking Changes
6161

62-
* 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))
62+
* 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))

src/Compiler/DependencyManager/DependencyProvider.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ open System.Collections.Concurrent
1515
module Option =
1616

1717
/// Convert string into Option string where null and String.Empty result in None
18-
let ofString (s: string MaybeNull) =
18+
let ofString (s: string | null) =
1919
match s with
2020
| null -> None
2121
| "" -> None
@@ -607,7 +607,7 @@ type DependencyProvider
607607
outputDir: string,
608608
reportError: ResolvingErrorReport,
609609
path: string
610-
) : string MaybeNull * IDependencyManagerProvider MaybeNull =
610+
) : string | null * IDependencyManagerProvider | null =
611611
try
612612
if path.Contains ":" && not (Path.IsPathRooted path) then
613613
let managers =
@@ -637,7 +637,7 @@ type DependencyProvider
637637
outputDir: string,
638638
reportError: ResolvingErrorReport,
639639
key: string
640-
) : IDependencyManagerProvider MaybeNull =
640+
) : IDependencyManagerProvider | null =
641641
try
642642
RegisteredDependencyManagers compilerTools (Option.ofString outputDir) reportError
643643
|> Map.tryFind key
@@ -657,7 +657,7 @@ type DependencyProvider
657657
packageManagerTextLines: (string * string) seq,
658658
reportError: ResolvingErrorReport,
659659
executionTfm: string,
660-
[<Optional; DefaultParameterValue(null: string MaybeNull)>] executionRid: string MaybeNull,
660+
[<Optional; DefaultParameterValue(null: string | null)>] executionRid: string | null,
661661
[<Optional; DefaultParameterValue("")>] implicitIncludeDir: string,
662662
[<Optional; DefaultParameterValue("")>] mainScriptName: string,
663663
[<Optional; DefaultParameterValue("")>] fileName: string,
@@ -681,8 +681,8 @@ type DependencyProvider
681681
try
682682
let executionRid =
683683
match executionRid with
684-
| Null -> RidHelpers.platformRid
685-
| NonNull executionRid -> executionRid
684+
| null -> RidHelpers.platformRid
685+
| executionRid -> executionRid
686686

687687
Ok(
688688
packageManager.ResolveDependencies(

src/Compiler/DependencyManager/DependencyProvider.fsi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ type DependencyProvider =
123123
packageManagerTextLines: (string * string) seq *
124124
reportError: ResolvingErrorReport *
125125
executionTfm: string *
126-
[<Optional; DefaultParameterValue(null: string MaybeNull)>] executionRid: string *
126+
[<Optional; DefaultParameterValue(null: string | null)>] executionRid: string *
127127
[<Optional; DefaultParameterValue("")>] implicitIncludeDir: string *
128128
[<Optional; DefaultParameterValue("")>] mainScriptName: string *
129129
[<Optional; DefaultParameterValue("")>] fileName: string *
@@ -133,9 +133,9 @@ type DependencyProvider =
133133
/// Fetch a dependencymanager that supports a specific key
134134
member TryFindDependencyManagerByKey:
135135
compilerTools: string seq * outputDir: string * reportError: ResolvingErrorReport * key: string ->
136-
IDependencyManagerProvider MaybeNull
136+
IDependencyManagerProvider | null
137137

138138
/// TryFindDependencyManagerInPath - given a #r "key:sometext" go and find a DependencyManager that satisfies the key
139139
member TryFindDependencyManagerInPath:
140140
compilerTools: string seq * outputDir: string * reportError: ResolvingErrorReport * path: string ->
141-
string MaybeNull * IDependencyManagerProvider MaybeNull
141+
string | null * IDependencyManagerProvider | null

0 commit comments

Comments
 (0)