Skip to content

Commit 4b94485

Browse files
committed
Add nullable type annotations and improve documentation for Nullness module
1 parent fd8f464 commit 4b94485

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/FsToolkit.ErrorHandling/Nullness.fs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,56 @@ namespace FsToolkit.ErrorHandling
22

33
open System
44

5+
/// Represents errors that occur during application execution. In F# 9.0 and later, this type is marked as nullable.
56
type ExceptionNull =
67
#if NET9_0_OR_GREATER && !FABLE_COMPILER
78
Exception | null
89
#else
910
Exception
1011
#endif
1112

13+
/// Provides a mechanism for releasing unmanaged resources. In F# 9.0 and later, this type is marked as nullable.
1214
type IDisposableNull =
1315
#if NET9_0_OR_GREATER && !FABLE_COMPILER
1416
IDisposable | null
1517
#else
1618
IDisposable
1719
#endif
1820

21+
/// Provides a mechanism for releasing unmanaged resources asynchronously. In F# 9.0 and later, this type is marked as nullable.
1922
type IAsyncDisposableNull =
2023
#if NET9_0_OR_GREATER && !FABLE_COMPILER
2124
IAsyncDisposable | null
2225
#else
2326
IAsyncDisposable
2427
#endif
2528

29+
/// An abbreviation for the CLI type System.Object. In F# 9.0 and later, this type is marked as nullable.
2630
type ObjNull =
2731
#if NET9_0_OR_GREATER && !FABLE_COMPILER
2832
objnull
2933
#else
3034
obj
3135
#endif
3236

37+
38+
/// An abbreviation for the CLI type System.Collections.Generic.IEnumerable. In F# 9.0 and later, this type is marked as nullable.
3339
type SeqNull<'T> =
3440
#if NET9_0_OR_GREATER && !FABLE_COMPILER
3541
seq<'T> | null
3642
#else
3743
seq<'T>
3844
#endif
3945

46+
/// An abbreviation for the CLI type System.String. In F# 9.0 and later, this type is marked as nullable.
4047
type StringNull =
4148
#if NET9_0_OR_GREATER && !FABLE_COMPILER
4249
string | null
4350
#else
4451
string
4552
#endif
4653

54+
/// An abbreviation for the CLI type System.Collections.Generic.List`1 . In F# 9.0 and later, this type is marked as nullable.
4755
type ResizeArrayNull<'T> =
4856
#if NET9_0_OR_GREATER && !FABLE_COMPILER
4957
ResizeArray<'T> | null
@@ -55,8 +63,10 @@ type ResizeArrayNull<'T> =
5563
module internal Nullness =
5664

5765
#if NET9_0_OR_GREATER && !FABLE_COMPILER
66+
/// Throw a System.ArgumentNullException if the given value is null exceptio
5867
let inline nullArgCheck name value = nullArgCheck name value
5968
#else
69+
/// Throw a System.ArgumentNullException if the given value is null exceptio
6070
let inline nullArgCheck (name: string) (value: 'T) : 'T =
6171
if isNull value then
6272
raise (ArgumentNullException(name))

0 commit comments

Comments
 (0)