Skip to content

Commit

Permalink
Fake.Core.Process: stop using old ref-cell operators
Browse files Browse the repository at this point in the history
The new version of the F# compiler now flags these occurrences as
deprecated.

The messages are of two kinds:

1) info FS3370: The use of ':=' from the F# library is deprecated.
See https://aka.ms/fsharp-refcell-ops.
For example, please change 'cell := expr' to 'cell.Value <- expr'.

2) info FS3370: The use of '!' from the F# library is deprecated.
See https://aka.ms/fsharp-refcell-ops.
For example, please change '!cell' to 'cell.Value'.
  • Loading branch information
knocte committed Jul 16, 2022
1 parent 07f41df commit b5f484e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/app/Fake.Core.Process/InternalStreams.fs
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ module internal InternalStreams =
let asyncResult = ref null
Async.FromBeginEnd(
(fun (callback, state) ->
asyncResult := beginAction(callback, state)
!asyncResult),
asyncResult.Value <- beginAction(callback, state)
asyncResult.Value),
(fun res ->
endAction res),
cancelAction = (fun () ->
while !asyncResult = null do Thread.Sleep 20
cancelAction(!asyncResult)))
while asyncResult.Value = null do Thread.Sleep 20
cancelAction(asyncResult.Value)))
open AsyncHelper

type ConcurrentQueueMessage<'a> =
Expand Down Expand Up @@ -232,12 +232,12 @@ module internal InternalStreams =
while not cts.IsCancellationRequested do
let! data = innerStream.Read()
let finished = ref false
while not !finished do
while not finished.Value do
let! (asyncResult:MyIAsyncReadResult<'a>) = queue.DequeAsync()
if not asyncResult.IsCanceled then
try
asyncResult.End(data)
finished := true
finished.Value <- true
with ReadCanceledException -> () // find next
return ()
}, cancellationToken = workerCts.Token)
Expand Down Expand Up @@ -466,7 +466,7 @@ module internal InternalStreams =
//let raw = infiniteStream()
let readFinished = ref false
let read () =
if !readFinished then
if readFinished.Value then
async.Return None
else
async {
Expand All @@ -477,16 +477,16 @@ module internal InternalStreams =
match s with
| Some d -> Some d
| None ->
readFinished := true
readFinished.Value <- true
None
| None ->
failwith "stream should not be limited as we are using an infiniteStream!" }
let isFinished = ref false
let finish () = async {
do! raw.Write None
isFinished := true }
isFinished.Value <- true }
let write item =
if !isFinished then
if isFinished.Value then
failwith "stream is in finished state so it should not be written to!"
raw.Write (Some item)
finish,
Expand Down

0 comments on commit b5f484e

Please sign in to comment.