@@ -3,7 +3,7 @@ namespace FSharp.Control
33open System.Diagnostics
44
55// note: this is *not* an experimental feature, but they forgot to switch off the flag
6- #nowarn " 57" // Experimental library feature, requires '--languversion :preview'.
6+ #nowarn " 57" // Experimental library feature, requires '--langversion :preview'.
77
88open System
99open System.Collections .Generic
@@ -395,7 +395,7 @@ type TaskSeqBuilder() =
395395
396396 ResumableCode.Combine( task1, task2)
397397
398- /// 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
399399 member inline _.WhileAsync ( [<InlineIfLambda>] condition : unit -> ValueTask < bool >, body : ResumableTSC < 'T >) : ResumableTSC < 'T > =
400400 let mutable condition_res = true
401401
@@ -415,8 +415,11 @@ type TaskSeqBuilder() =
415415
416416 let task = __ stack_ vtask.AsTask()
417417 let mutable awaiter = task.GetAwaiter()
418+
418419 // This will yield with __stack_fin = false
419420 // 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
420423 let __stack_yield_fin = ResumableCode.Yield() .Invoke(& sm)
421424 __ stack_ condition_ fin <- __ stack_ yield_ fin
422425
0 commit comments