Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rule: EnsureTailCallDiagnosticsInRecursiveFunctions #651

Closed
knocte opened this issue Dec 25, 2023 · 1 comment · Fixed by #673
Closed

New rule: EnsureTailCallDiagnosticsInRecursiveFunctions #651

knocte opened this issue Dec 25, 2023 · 1 comment · Fixed by #673

Comments

@knocte
Copy link
Collaborator

knocte commented Dec 25, 2023

Description

Context: https://stackoverflow.com/questions/806712/how-do-i-know-if-a-function-is-tail-recursive-in-f/77532717#77532717

Testcases

Should error:

let rec Foo someParam =
    if someParam then
        Foo()
    else
        ()

Should not error:

[<TailCall>]
let rec Foo someParam =
    if someParam then
        Foo()
    else
        ()

Should error (but with different error message):

let rec Foo someParam =
    ()

In the latter testcase, error message should be same as this rule's err msg: #650 (please don't violate DRY). Otherwise, the error message should advise both about adding the TailCall attribute and <WarningsAsErrors>FS3569</WarningsAsErrors> (NOTE: it should also mention that this feature requires .NETv8.0 or newer).

@knocte
Copy link
Collaborator Author

knocte commented Dec 28, 2023

@webwarrior-ws can you pick this one up when you have time. BTW:

error message should be same as this rule's err msg: #650 (please don't violate DRY).

The above should mean that you should start from Mershad's branch because I haven't merged that PR yet.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant