@@ -2,7 +2,8 @@ namespace FSharp.Control
22
33open 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
78open System
89open System.Collections .Generic
@@ -12,7 +13,7 @@ open System.Runtime.CompilerServices
1213open System.Threading .Tasks .Sources
1314
1415open FSharp.Core .CompilerServices
15- open FSharp.Core .CompilerServices .StateMachineHelpers
16+ open FSharp.Core .CompilerServices .StateMachineHelpers // raises warning FS0057
1617open 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