Skip to content

Commit 3d2c998

Browse files
authored
Merge pull request #238 from fsprojects/cleanup-nowarn-declarations
Cleanup or clarify unnecessary `#nowarn` statements
2 parents 2fc7d94 + cffe832 commit 3d2c998

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

src/FSharp.Control.TaskSeq/TaskExtensions.fs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ open System.Threading.Tasks
77
open Microsoft.FSharp.Core.CompilerServices
88
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
99

10-
#nowarn "57"
11-
#nowarn "1204"
12-
#nowarn "3513"
10+
// note: these are *not* experimental features anymore, but they forgot to switch off the flag
11+
#nowarn "57" // Experimental library feature, requires '--langversion:preview'.
12+
#nowarn "1204" // This construct is for use by compiled F# code and should not be used directly.
1313

1414
[<AutoOpen>]
1515
module TaskExtensions =
@@ -42,6 +42,8 @@ module TaskExtensions =
4242

4343
// This will yield with __stack_fin = false
4444
// This will resume with __stack_fin = true
45+
46+
// NOTE (AB): if this extra let-binding isn't here, we get NRE exceptions, infinite loops (end of seq not signaled) and warning FS3513
4547
let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm)
4648
__stack_condition_fin <- __stack_yield_fin
4749

src/FSharp.Control.TaskSeq/TaskExtensions.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace FSharp.Control
22

3-
#nowarn "1204"
3+
#nowarn "1204" // This construct is for use by compiled F# code and should not be used directly.
44

55
[<AutoOpen>]
66
module TaskExtensions =

src/FSharp.Control.TaskSeq/TaskSeq.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ open System.Collections.Generic
44
open System.Threading
55
open System.Threading.Tasks
66

7-
#nowarn "57"
8-
97
// Just for convenience
108
module Internal = TaskSeqInternal
119

src/FSharp.Control.TaskSeq/TaskSeq.fsi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ namespace FSharp.Control
33
open System.Collections.Generic
44
open System.Threading.Tasks
55

6-
#nowarn "1204"
7-
86
[<AutoOpen>]
97
module TaskSeqExtensions =
108
module TaskSeq =

src/FSharp.Control.TaskSeq/TaskSeqBuilder.fs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ namespace FSharp.Control
22

33
open System.Diagnostics
44

5-
#nowarn "57" // note: this is *not* an experimental feature, but they forgot to switch off the flag
5+
// note: this is *not* an experimental feature, but they forgot to switch off the flag
6+
#nowarn "57" // Experimental library feature, requires '--langversion:preview'.
67

78
open System
89
open System.Collections.Generic
@@ -12,7 +13,7 @@ open System.Runtime.CompilerServices
1213
open System.Threading.Tasks.Sources
1314

1415
open FSharp.Core.CompilerServices
15-
open FSharp.Core.CompilerServices.StateMachineHelpers
16+
open FSharp.Core.CompilerServices.StateMachineHelpers // raises warning FS0057
1617
open FSharp.Control
1718

1819

@@ -394,7 +395,7 @@ type TaskSeqBuilder() =
394395

395396
ResumableCode.Combine(task1, task2)
396397

397-
/// Used by `For`. F# currently doesn't support `while!`, so this cannot be called directly from the CE
398+
/// Used by `For`. Unclear if the new `while!` (from F# 8.0) hits this
398399
member inline _.WhileAsync([<InlineIfLambda>] condition: unit -> ValueTask<bool>, body: ResumableTSC<'T>) : ResumableTSC<'T> =
399400
let mutable condition_res = true
400401

@@ -414,8 +415,11 @@ type TaskSeqBuilder() =
414415

415416
let task = __stack_vtask.AsTask()
416417
let mutable awaiter = task.GetAwaiter()
418+
417419
// This will yield with __stack_fin = false
418420
// This will resume with __stack_fin = true
421+
422+
// NOTE (AB): if this extra let-binding isn't here, we get NRE exceptions, infinite loops (end of seq not signaled) and warning FS3513
419423
let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm)
420424
__stack_condition_fin <- __stack_yield_fin
421425

0 commit comments

Comments
 (0)