[patch] fix an extraction anomaly on under-applied special syntaxes
Before this patch, the following definitions fail at extraction.
let test1 () = (+) 0 use array.Array let test2 () = length
anomaly: Invalid_argument("index out of bounds")
The reason is that those identifiers are specialized in the driver to
"%1 + %2" and
"Array.length %1"; the driver does not currently check
the arity of the application before doing the textual replacement,
leading to a failure at argument-replacement time.
This patch checks the arity of the complex syntax, and performs an eta-expansion in case the argument list is too short.
let test1 () (* extracted *) = (fun x1 x2 -> x1 + x2) 0 let test2 () (* extracted *) = (fun x1 -> Array.length x1)