You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7135 Reporter:@yallop Assigned to:@garrigue Status: closed (set by @xavierleroy on 2017-09-24T15:32:09Z) Resolution: fixed Priority: normal Severity: minor Fixed in version: 4.03.0+dev / +beta1 Category: ~DO NOT USE (was: OCaml general) Related to:#7199 Monitored by:@hcarty
Bug description
The following program causes OCaml to issue a warning
$ cat princ.ml
module M : sig type t = private int end =
struct type t = int end
include M
let lift2 (f : int -> int -> int) (x : t) (y : t) =
f (x :> int) (y :> int)
$ ocamlc princ.ml
File "princ.ml", line 6, characters 15-25:
Warning 18: this ground coercion is not principal.
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.
The text was updated successfully, but these errors were encountered:
Note that with -principal, the warning goes away.
The problem is that this warning tries to do the same thing as -principal, but with less work, and this is not correct.
I suppose the solution is to disable it when -principal is off.
(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.)
Original bug ID: 7135
Reporter: @yallop
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-09-24T15:32:09Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Related to: #7199
Monitored by: @hcarty
Bug description
The following program causes OCaml to issue a warning
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.
The text was updated successfully, but these errors were encountered: