Skip to content

Commit 10d784b

Browse files
committed
fixup! feat: add EquatableArray<'T>, an immutable array with value equality
1 parent 694685c commit 10d784b

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎src/FSharp.Collections.Immutable/EquatableArray/EquatableArray.fs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ module EquatableArray =
308308

309309
[<CompiledName "OfList">]
310310
let ofList (list : 'T list) : EquatableArray<'T> =
311+
// List.toArray dereferences a null list without a check; a null input throws ArgumentNullException, as in ofArray
312+
checkNotNull (nameof list) list
311313
EquatableArray<'T>(ImmutableCollectionsMarshal.AsImmutableArray (List.toArray list))
312314

313315
[<CompiledName "OfSeq">]

‎src/FSharp.Collections.Immutable/EquatableArray/EquatableArray.fsi‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ module EquatableArray =
226226
/// <summary>Copies the elements of <paramref name="list"/> into a new array.</summary>
227227
/// <param name="list">The elements.</param>
228228
/// <returns>An array with the elements of <paramref name="list"/>, in the same order.</returns>
229+
/// <exception cref="T:System.ArgumentNullException">Thrown when <paramref name="list"/> is <see langword="null"/>.</exception>
229230
/// <remarks>O(n).</remarks>
230231
[<CompiledName "OfList">]
231232
val ofList : list : 'T list -> EquatableArray<'T>

0 commit comments

Comments
 (0)