Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NinoFloris committed Aug 15, 2020
1 parent 1cde994 commit 292a3ee
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Ply.fs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ module TplPrimitives =
let cont = AwaitableContinuation(struct(cond,body), next, fun this ->
let struct(cond, body) = this.State
let mutable awaitable = zero
while cond() && awaitable.IsCompletedSuccessfully do
while awaitable.IsCompletedSuccessfully && cond() do
let next = body()
if not next.IsCompletedSuccessfully then
this.SetAwaitable(next)
Expand All @@ -272,12 +272,11 @@ module TplPrimitives =
else zero

let inline using (disposable : #IDisposable) (body : #IDisposable -> Ply<'u>) =
tryFinally (fun () -> body disposable) (fun () -> disposable.Dispose())
tryFinally (fun () -> body disposable) (fun () -> if not(isNull(disposable :> obj)) then disposable.Dispose())

let inline forLoop (sequence : 'a seq) (body : 'a -> Ply<unit>) =
using (sequence.GetEnumerator()) (fun e -> whileLoop e.MoveNext (fun () -> body e.Current))


// These types exist for backwards compatibility until 1.0
// Some types here are supposed to always be instantiated at unit see https://github.com/dotnet/fsharp/issues/9913
type IAwaiterMethods<'awt, 'res when 'awt :> ICriticalNotifyCompletion> =
Expand Down

0 comments on commit 292a3ee

Please sign in to comment.