Skip to content

TailCall attribute does not lead to errors when recursive call is in a list comprehension #16649

@Larocceau

Description

@Larocceau

When using the TailCall attribute, warning FS3569 is not shown when the recursive call is inside a list comprehension

Repro steps

  1. Create a new f# console project.
  2. Add the following code to Program.fs
[<TailCall>]
let rec reverse (input: list<'t>) =
    match input with
    | head :: tail -> [ yield! reverse tail; head ]
    | [] -> []
  1. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions