Skip to content

Commit

Permalink
Cleanup CompletedTask
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Apr 6, 2024
1 parent 57246d6 commit 41b6733
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/FSharp.Control.TaskSeq/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ open System

[<AutoOpen>]
module ValueTaskExtensions =
/// Extensions for ValueTask that are not available in NetStandard 2.1, but are
/// available in .NET 5+. We put them in Extension space to mimic the behavior of NetStandard 2.1
type ValueTask with

/// (Extension member) Gets a task that has already completed successfully.
static member inline CompletedTask =
// This mimics how it is done in .NET itself
// This mimics how it is done in net5.0 and later internally
Unchecked.defaultof<ValueTask>


Expand Down
4 changes: 3 additions & 1 deletion src/FSharp.Control.TaskSeq/Utils.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ open System.Threading.Tasks.Sources

[<AutoOpen>]
module ValueTaskExtensions =

/// Shims back-filling .NET 5+ functionality for use on netstandard2.1
type ValueTask with

/// (Extension member) Gets a task that has already completed successfully.
/// (Extension member) Gets a ValueTask that has already completed successfully.
static member inline CompletedTask: ValueTask

module ValueTask =
Expand Down

0 comments on commit 41b6733

Please sign in to comment.