Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007135OCaml~DO NOT USE (was: OCaml general)public2016-02-04 02:042017-09-24 17:32
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version 
Target VersionFixed in Version4.03.0+dev / +beta1 
Summary0007135: Surprising "This ground coercion is not principal" warning
DescriptionThe following program causes OCaml to issue a warning

   $ cat
   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
   File "", 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.
TagsNo tags attached.
Attached Files

- Relationships
related to 0007199closedgarrigue OCaml 4.03.0+beta1 rejects previously accepted cast 

-  Notes
garrigue (manager)
2016-02-04 06:18

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.)
garrigue (manager)
2016-02-05 02:56

Fixed by disabling the warning when not in -principal mode.
There is no way to provide correct principality warnings without -principal.

- Issue History
Date Modified Username Field Change
2016-02-04 02:04 yallop New Issue
2016-02-04 06:18 garrigue Note Added: 0015314
2016-02-04 06:18 garrigue Assigned To => garrigue
2016-02-04 06:18 garrigue Status new => confirmed
2016-02-05 02:56 garrigue Note Added: 0015317
2016-02-05 02:56 garrigue Status confirmed => resolved
2016-02-05 02:56 garrigue Fixed in Version => 4.03.0+dev / +beta1
2016-02-05 02:56 garrigue Resolution open => fixed
2016-03-30 03:17 garrigue Relationship added related to 0007199
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)
2017-09-24 17:32 xleroy Status resolved => closed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker