Custom SM-based task builder causes compilation error when used inline
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
Custom cancellable builder (used in VS layer), see example project below causes
```
error FS0073: internal error: The local field ResumptionDynamicInfo was referenced but not declared
```
On simple code (with or without pipe):
```fsharp
open CancellableTasks.CancellableTasks
open System.Threading
open System.Threading.Tasks
let foo () =
cancellableTask {
return cancellableTask { () } |> CancellableTask.start CancellationToken.None
}
[]
let main _ = 1
```
Binding internal `cancellableTask` resolves it, as does using `CancellableTask.singleton`:
```fsharp
open CancellableTasks.CancellableTasks
open System.Threading
open System.Threading.Tasks
let foo () =
cancellableTask { return CancellableTask.singleton () |> CancellableTask.start CancellationToken.None }
let foo1 () =
cancellableTask {
let t = cancellableTask { () }
return t |> CancellableTask.start CancellationToken.None
}
[]
let main _ = 1
```
All three functions compile just fine.
Full project:
[srtp.zip](https://github.com/dotnet/fsharp/files/11801401/srtp.zip)
Contributor guide
Assessment
This issue has not been assessed yet.