flips icon indicating copy to clipboard operation
flips copied to clipboard

Add tests that ensure recursion uses tail calls

Open TysonMN opened this issue 4 years ago • 5 comments

TysonMN avatar Jan 06 '21 12:01 TysonMN

I feel the pain, not too far ago, hitting those crashes...

On the language side, https://github.com/fsharp/fslang-suggestions/issues/721 would come very handy for this kind of stuff (if you haven't upvoted), also, given how F# lean on that, it would definitely be nice feature to have.

Is there a plan to put those asserts in place in terms of implementing such tests? Or is it having tests that exercise code with models that are large enough as to produce such issues?

smoothdeveloper avatar Jan 06 '21 13:01 smoothdeveloper

I knew that such an F# language suggestion existed, but I hadn't upvoted it. Thanks for the link.

Since that attribute or language feature doesn't exist yet, I was planning on creating tests that exercise the code using sufficiently large instances of the relevant types. It is certainly more work than using that attribute but also not hard.

TysonMN avatar Jan 06 '21 15:01 TysonMN

@TysonMN, the suggestion for [<TailRecursive>] has been implemented; on next release of FSharp.Core, it can be adorned in the library, and next release of compiler will have it as static check, maybe only in preview version initially.

smoothdeveloper avatar Jul 27 '23 11:07 smoothdeveloper

Nice. Can you share a link to that?

TysonMN avatar Jul 27 '23 12:07 TysonMN