When using the TailCall attribute, warning FS3569 is not shown when the recursive call is inside a list comprehension
Repro steps
- Create a new f# console project.
- Add the following code to Program.fs
[<TailCall>]
let rec reverse (input: list<'t>) =
match input with
| head :: tail -> [ yield! reverse tail; head ]
| [] -> []
- run
dotnet build
Example project with a case where the bug occurs , and a slightly different version where the bug does not occur
Expected behavior
The compiler displays warning FS3569
Actual behavior
The compiler does not show the warning
Known workarounds
Do not use list comprehensions when trying to use the tail call compiler attribute
Related information
- Operating system: Windows 11 enterprise
- .NET Core
- Editing Tools: VSCode