Escaped existential type #7222
Original bug ID: 7222
The following code leads to a toplevel function with existential type within its type:
let undetected: ('a -> 'b -> nil) t -> 'a n -> 'b n -> unit = fun sh i j ->
As far as I understand, the existential type "$'b" should never appear in the type of a toplevel function and this is a typing error.
Moreover, slightly altering the code to
As a supplementary information, calling the full version of this function accross module boundary triggered an internal assertion failure at (File "typing/typecore.ml", line 1903, characters 65-71) within the 4.02.3 compiler.
Comment author: @Octachron
Correction, the second example also exhibits leaked existential type once its type is corrected to