FCSWatch icon indicating copy to clipboard operation
FCSWatch copied to clipboard

Compiler directives in files don't seem to be used

Open baronfel opened this issue 6 years ago • 0 comments

at work I have the following code to bridge between Tasks and Hopac Jobs seamlessly:

// TaskBuilder marks a particular module as obsolete because it's not intended to be used normally. we're extending it to work better with Jobs, so that should be disregarded
#nowarn "44"


module TPLHopac =
  open Chessie.Hopac
  open FSharp.Control.Tasks.TaskBuilder

  type TaskBuilderV2 with
    member inline __.Bind (job : #Job<'a>, continuation : 'a -> 'b Step) : 'b Step = bindTaskConfigureFalse (Hopac.startAsTask job) continuation
    member inline __.Bind (job : JobResult<'a, 'err>, continuation : Chessie.ErrorHandling.Result<'a, 'err> -> 'b Step) : 'b Step = bindTaskConfigureFalse (Hopac.startAsTask (JobTrial.toJobOfResult job)) continuation
    member inline __.ReturnFrom(job : #Job<'a>) = bindTaskConfigureFalse (Hopac.startAsTask job) ret
    member inline __.ReturnFrom(job : JobResult<'a, 'err>) = bindTaskConfigureFalse (Hopac.startAsTask (JobTrial.toJobOfResult job)) ret

we have 'warnings as errorsset for warning 44 across the project file, but for this particular use it's unavoidable: the TaskBuilder.fs library marks theTaskBuilder` module obsolete to prevent casual use.

This code compiles via the compiler correctly, but either FCS or portacode don't recognize the inline #nowarn directive.

baronfel avatar Apr 30 '19 17:04 baronfel