Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007869OCamltypingpublic2018-11-04 12:592018-11-09 11:40
Reporterpaurkedal 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version4.07.1 
Target VersionFixed in Version 
Summary0007869: Destructive type substitution drops constraint when argument is variant
DescriptionThe program

  module type S = sig
    type +'a t
    val f : ([< `A] as 'a) t -> 'a t
  end
  module M : S with type 'a t := 'a = struct
    let f x = x
  end

fails with

  File "test.ml", line 5, characters 36-60:
  Error: Signature mismatch:
       Modules do not match:
         sig val f : 'a -> 'a end
       is not included in
         sig val f : [< `A ] -> [< `A ] end
       Values do not match:
         val f : 'a -> 'a
       is not included in
         val f : [< `A ] -> [< `A ]
       File "test.ml", line 3, characters 2-34: Expected declaration
       File "test.ml", line 6, characters 6-7: Actual declaration

for OCaml 4.06.1, 4.07.1, and current master (fd5c692). As seen, the constraint between the argument and result type of f is lost. This does not happen if the argument is not constrained to a polymorphic variant, including when constrained to and object type like < >.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0019433)
paurkedal (reporter)
2018-11-04 13:17

Correction: I should have filed this under "typing". (And maybe the severity should be higher.)

- Issue History
Date Modified Username Field Change
2018-11-04 12:59 paurkedal New Issue
2018-11-04 13:17 paurkedal Note Added: 0019433
2018-11-09 11:40 frisch Category language features => typing


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker