Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
-principal is broken with polymorphic variants. #7668
Original bug ID: 7668
The following code is wrongly type-checked by ocamlc -principal. I have checked it with 4.05.0 and 4.06.0. I guess something wrong with the polymorphic variant typing when -principal is given.
let partition_map f xs =
let f xs : (int list * int list) = partition_map (fun x -> if x then
Steps to reproduce
$ ocamlc -c -i bug.ml
Comment author: furuse
BTW, what is the purpose of -principal in the OCaml compiler build? It bootstraps even without it.
I have added some code using polymorphic variants to the compiler and want to avoid this issue by removing -principal. Is it safe?
Comment author: @garrigue
Fixed in trunk at commit 43d77ff.
The problem stems from the way -principal detects non-principal typing information when typing patterns.
As to whether -principal is needed to bootstrap the compiler, clearly no.