Skip to content

Add uncurry of recursive functions

E. Rivas requested to merge er433/add/uncurry-recursion into dev

This MR introduces the old uncurrification (written by @tomjack?) for ast_typed, adapted to ast_aggregated and applied only on E_recursive.

It allows the following:

let rec foo (n : int) (x : string) : string = if n = 0 then x else foo (n - 1) (String.concat x "toto")

(the actual check of depth doesn't seem to be really needed, as later recursion only allows tail-position only? But anyway, I think it's better to keep the checks)

  • has a changelog entry
Edited by E. Rivas

Merge request reports