[<TailCall>] attribute gives incorrect warning in many examples
Open
Area-Compiler-Optimization
Area-Diagnostics
Bug
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
This code compiles fine:
```fsharp
[]
let rec fib a b = seq {
yield a
yield! fib b (a + b)
}
let fibonacci = fib 0 1
```
But the following minor change produces the message: `The member or function 'fib' has the 'TailCallAttribute' attribute, but is not being used in a tail recursive way.`
```fsharp
[]
let rec fib a b = seq {
yield a
if true then
yield! fib b (a + b)
}
let fibonacci = fib 0 1
```
**Related information**
Provide any related information (optional):
* Pop!_OS 22.04
* VS Code: 1.102.2
* TargetFramework: net9.0
Contributor guide
Assessment
This issue has not been assessed yet.