Skip to content

[<TailCall>] attribute gives incorrect warning with simple sequence expression #18780

@Bananas-Are-Yellow

Description

@Bananas-Are-Yellow

This code compiles fine:

    [<TailCall>]
    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.

    [<TailCall>]
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions