Skip to content

Commit

Permalink
empty array singleton table
Browse files Browse the repository at this point in the history
  • Loading branch information
vasily-kirichenko committed Jun 2, 2018
1 parent 205f5cf commit c4ef4ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fsharp/FSharp.Core/array.fs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ namespace Microsoft.FSharp.Collections
if array.Length = 0 then invalidArg "array" (SR.GetString(SR.notEnoughElements))
Microsoft.FSharp.Primitives.Basics.Array.subUnchecked 1 (array.Length - 1) array

type EmptyArray<'T>() =
static let empty = ([| |] : 'T [])
static member Empty = empty

[<CompiledName("Empty")>]
let empty<'T> : 'T [] = [| |]
let empty<'T> : 'T [] = EmptyArray.Empty

[<CodeAnalysis.SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly")>]
[<CompiledName("CopyTo")>]
Expand Down

0 comments on commit c4ef4ad

Please sign in to comment.