Skip to content

Commit 2249c64

Browse files
committed
Update new type TaskSeq to act as proper static class in C# as well
1 parent b290651 commit 2249c64

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/FSharp.Control.TaskSeq/TaskSeq.fs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ module TaskSeqExtensions =
2323
// Just for convenience
2424
module Internal = TaskSeqInternal
2525

26-
[<Sealed>]
27-
type TaskSeq =
26+
[<Sealed; AbstractClass>]
27+
type TaskSeq private () =
28+
// Rules for static classes, see bug report: https://github.com/dotnet/fsharp/issues/8093
29+
// F# does not need this internally, but C# does
30+
// 'Abstract & Sealed': makes it a static class in C#
31+
// the 'private ()' ensure that a constructor is emitted, which is required by IL
2832

2933
static member singleton(value: 'T) = Internal.singleton value
3034

src/FSharp.Control.TaskSeq/TaskSeq.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module TaskSeqExtensions =
1111
/// Initialize an empty task sequence.
1212
val empty<'T> : taskSeq<'T>
1313

14-
[<Sealed>]
14+
[<Sealed; AbstractClass>]
1515
type TaskSeq =
1616

1717
/// <summary>

0 commit comments

Comments
 (0)