Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005927OCamlOCaml typingpublic2013-02-19 19:582014-05-25 20:20
Reporterlpw25 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target Version4.02.0+devFixed in Version 
Summary0005927: Type equality broken for conjunctive polymorphic variant tags
DescriptionI think that the following behaviour is a bug:

  # type 'a foo = 'a constraint 'a = [< `Tag of & int];;
  Error: Type declarations do not match:
           type 'a foo = 'a constraint 'a = [< `Tag of & int ]
         is not included in
           type 'a foo = 'a constraint 'a = [< `Tag of & int ]

I've attached a patch that seems to fix it.
Tagspatch
Attached Filesdiff file icon fix-amp-equal.diff [^] (684 bytes) 2013-02-19 19:58 [Show Content]
diff file icon fix-amp-equal2.diff [^] (708 bytes) 2013-02-19 20:27 [Show Content]

- Relationships

-  Notes
(0008878)
lpw25 (developer)
2013-02-19 20:28

I've attached a new fix that is probably more consistent with other behaviour.
(0008880)
garrigue (manager)
2013-02-20 07:40

Actually, the failure in this case is intentional, as this conjunction is clearly impossible.
On the other hand, it could be accepted in a more general way: & t1 is probably equivalent to & t2 for any t1 and t2...
(Oops, there is also the problem of free variables)
(0008882)
lpw25 (developer)
2013-02-20 12:51

Even if the conjunction is impossible, the type itself is valid and should at least be considered equivalent to itself.

Also, the current error is unclear and only occurs during module inclusion checks. For example:

  # module type S = sig type 'a foo constraint 'a = [< `Tag of & int ] end;;
  Error: Module type declarations do not match:
           module type S =
             sig type 'a foo constraint 'a = [< `Tag of & int ] end
         does not match
           module type S =
             sig type 'a foo constraint 'a = [< `Tag of & int ] end
         At position module type S = <here>
         Modules do not match:
           sig type 'a foo constraint 'a = [< `Tag of & int ] end
         is not included in
           sig type 'a foo constraint 'a = [< `Tag of & int ] end
         At position module type S = <here>
         Type declarations do not match:
           type 'a foo constraint 'a = [< `Tag of & int ]
         is not included in
           type 'a foo constraint 'a = [< `Tag of & int ]
         Their constraints differ.

- Issue History
Date Modified Username Field Change
2013-02-19 19:58 lpw25 New Issue
2013-02-19 19:58 lpw25 File Added: fix-amp-equal.diff
2013-02-19 20:27 lpw25 File Added: fix-amp-equal2.diff
2013-02-19 20:28 lpw25 Note Added: 0008878
2013-02-20 07:40 garrigue Note Added: 0008880
2013-02-20 07:40 garrigue Assigned To => garrigue
2013-02-20 07:40 garrigue Status new => acknowledged
2013-02-20 12:51 lpw25 Note Added: 0008882
2013-07-12 09:33 doligez Target Version => 4.02.0+dev
2013-07-12 18:15 doligez Target Version 4.02.0+dev => 4.01.1+dev
2013-12-16 14:17 doligez Tag Attached: patch
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker