Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006634OCamltypingpublic2014-10-27 23:192017-03-14 08:27
Reporteryallop 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionlaterFixed in Version 
Summary0006634: Type $t is not included in type $t
DescriptionThis may be subsumed by another report, but I thought it worth noting:

   # type t = int;;
   type t = int
   # module M : sig type t end with type t = [`T of t] = struct type t = [`T of t] end;;
   Characters 52-81:
     module M : sig type t end with type t = [`T of t] = struct type t = [`T of t] end;;
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   Error: Signature mismatch:
          Modules do not match:
            sig type t = [ `T of t ] end
          is not included in
            sig type t = [ `T of t ] end
          Type declarations do not match:
            type t = [ `T of t ]
          is not included in
            type t = [ `T of t ]
Tagspatch
Attached Filesdiff file icon pr6634.diff [^] (6,301 bytes) 2015-09-09 12:25 [Show Content]

- Relationships
related to 0004791acknowledged ocamlc -i produces incorrect result 
related to 0007458assignedgarrigue Printing of type aliases in signatures could be improved (with nonrec) 

-  Notes
(0012451)
garrigue (manager)
2014-10-28 02:05

I'm not sure what the issue is.
In [sig type t end with type t = [`T of t]], the last t refers to int, so clearly they do not match.
So I suppose the problem is in the error message ?
For unification errors, we detect name conflicts and print internal ids in that case. This could be helpful here too.
Note that the error message you get with -short-paths is slightly better:
Error: Signature mismatch:
       Modules do not match:
         sig type t = [ `T of t ] end
       is not included in
         sig type t = [ `T of int ] end
       Type declarations do not match:
         type t = [ `T of t ]
       is not included in
         type t = [ `T of t ]

Note that in the signature, t is expanded as int, but not in the type itself.
I think this is due to the fact the definition is not added to the reference environment in the last case; this could be improved.
(0012453)
yallop (developer)
2014-10-28 10:00

Sorry, yes: the problem is in the error message.
(0014431)
garrigue (manager)
2015-09-09 12:29

pr6634.diff is a first attempt at fixing the problem, using the new "type nonrec" keyword.
The current version only works if the original definition is the first one in its recursive group, and gives the following error message:

Error: Signature mismatch:
       Modules do not match:
         sig type t = [ `T of t ] end
       is not included in
         sig type nonrec t = [ `T of t ] end
       Type declarations do not match:
         type t = [ `T of t ]
       is not included in
         type nonrec t = [ `T of t ]

A full(?) solution would put all the changed definitions at the top of the signatures, merging them in a single type nonrec.
Of course, one could be concerned about the noise involved in doing so.

- Issue History
Date Modified Username Field Change
2014-10-27 23:19 yallop New Issue
2014-10-28 02:05 garrigue Note Added: 0012451
2014-10-28 10:00 yallop Note Added: 0012453
2014-12-22 22:08 doligez Status new => acknowledged
2015-01-13 21:19 doligez Target Version => 4.02.3+dev
2015-07-10 17:50 doligez Target Version 4.02.3+dev => 4.03.0+dev / +beta1
2015-09-09 12:25 garrigue File Added: pr6634.diff
2015-09-09 12:29 garrigue Note Added: 0014431
2016-04-12 16:15 doligez Tag Attached: patch
2016-04-12 16:16 doligez Target Version 4.03.0+dev / +beta1 => 4.03.1+dev
2017-02-16 14:01 doligez Target Version 4.03.1+dev => undecided
2017-02-23 16:45 doligez Category OCaml typing => typing
2017-03-14 08:26 garrigue Relationship added related to 0004791
2017-03-14 08:26 garrigue Relationship added related to 0007458
2017-03-14 08:27 garrigue Severity minor => feature
2017-03-14 08:27 garrigue Target Version undecided => later


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker