Missing parentheses when printing polymorphic variant value in non exhaustivity warning #6680
Original bug ID: 6680
In the following, the counter-example produced by the exhaustivity check is not printed correctly:
let f = function
Comment author: @gasche
The easy way to fix this is to fix the code of the pretty_* functions in typing/parmatch.ml. A simple patch is attached that fixes the reported issue.
The good way to fix this, in my opinion, is to have this code not pretty-print a value extrapolated from a pattern, but to extrapolate this value into a valid AST tree, and then call the Pprintast functions to print expressions and handle the ugly details of pretty-printings. Pprintast is not a bug-free zone, but we could at least centralize our pretty-printing bugs in a single place.