dbuenzli / fmt

OCaml Format pretty-printer combinators
http://erratique.ch/software/fmt
ISC License
71 stars 26 forks source link

Fmt.kstrf doesn't like partial application #29

Closed samoht closed 6 years ago

samoht commented 7 years ago

The following program gives an assert failure:

let parse fmt = Fmt.kstrf (fun x -> x) fmt

let check f = assert (f "X" = f "X")

let () = check (parse "%s")

This is fixed if you replace Fmt.kstrf by Format.ksprintf. This is fixed if you eta-expand (parse "%s") into (fun x -> parse "%s" x). Not sure exactly what is happening there ...

dbuenzli commented 7 years ago

A Buffer.reset is missing on this line to protect whenever the internal buffer ends up being reused.

dbuenzli commented 7 years ago

Here aswell.