dotnet / dotnet/fsharp

Strange order dependency of members with cancellable tasks

Open
#15,940 7 comments 0 reactions 0 assignees View on GitHub
Area-Compiler-StateMachines Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

This code:
```fsharp
namespace Microsoft.VisualStudio.FSharp.Editor

open CancellableTasks

type MyType() = class end

[]
module MyTypeExtensions =

type MyType with

member this.MemberX() =
cancellableTask {
return 42
}

member this.MemberY() =
cancellableTask {
let! result = this.MemberX()
return result
}
```

... compiles just fine:
![image](https://github.com/dotnet/fsharp/assets/5451366/7c8c9495-5914-4742-925e-5b39903abc8e)

But rearranging the members produces an error:
![image](https://github.com/dotnet/fsharp/assets/5451366/8620fef1-e364-4b4d-a897-8a5e4225ee69)

The error being something hard stuff about CE:
![image](https://github.com/dotnet/fsharp/assets/5451366/d12d4250-38c8-4e14-82ea-fe7896f7a608)

---

But this shouldn't be, right? Take vanilla `async` for example:
![image](https://github.com/dotnet/fsharp/assets/5451366/af17a009-f1e7-4b64-bb48-43b88f61df75)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.