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
Surprising "This ground coercion is not principal" warning #7135
Original bug ID: 7135
The following program causes OCaml to issue a warning
$ cat princ.ml
let lift2 (f : int -> int -> int) (x : t) (y : t) =
This is surprising for several reasons. First, in what sense is the coercion not principal? Both the source and the target type are known. Second, only one of the apparently-identical coercions is flagged as non-principal. Third, changing 'include' to 'open' causes the warning to disappear.
Comment author: @garrigue
Note that with -principal, the warning goes away.
(Technically the reason is probably that, when -principal is off, type constructors without arguments can be physically shared, so that they may look like they are not "fresh" enough to be principal.)