Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006786OCamltypingpublic2015-02-17 16:342016-08-30 10:30
Reporterceastlund 
Assigned Tolpw25 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version4.03.1+devFixed in Version4.04.0 +dev / +beta1 / +beta2 
Summary0006786: type error involving 'include' and applicative functors
DescriptionA specific pattern of using 'include' does not type check. It seems like the type checker can do better just by updating some module paths more aggressively.

The behavior I see is that Make_ok1 and Make_ok2 compile fine, but the very similar functor Make_bad does not. The code is in the box below; here is the compile error:

========================================

      Error: Signature mismatch:
             Modules do not match:
               sig
                 module C : sig module T : sig end type t = Make(T).t end
                 module T = C.T
                 type t = Make(T).t
               end
             is not included in
               sig type t module C : sig type t = t end end
             In module C:
             Modules do not match:
               sig module T : sig end type t = Make(T).t end
             is not included in
               sig type t = C.t end
             In module C:
             Type declarations do not match:
               type t = Make(T).t
             is not included in
               type t = t
Steps To Reproducemodule type S = sig type t end
module Make (M : sig end) : S = struct type t end

module Make_ok1 (M : sig end) : sig

  type t
  module A : S with type t = t

end = struct

  module A = struct
    include Make (struct end)
  end
  include A

end

module Make_ok2 (M : sig end) : sig

  type t
  module B : S with type t = t

end = struct

  module T = struct end
  module B = struct
    include Make (T)
  end
  include B

end

module Make_bad (M : sig end) : sig

  type t
  module C : S with type t = t

end = struct

  module C = struct
    module T = struct end
    include Make (T)
  end
  include C

end
TagsNo tags attached.
Attached Files

- Relationships
has duplicate 0006788closedyallop seemingly inconsistent type checker behavior 

-  Notes
(0016244)
gasche (administrator)
2016-08-30 08:37

The example code above type-checks in my 4.04 branch with the following inferred signature:

module type S = sig type t end
module Make : functor (M : sig end) -> S
module Make_ok1 :
  functor (M : sig end) -> sig type t module A : sig type t = t end end
module Make_ok2 :
  functor (M : sig end) -> sig type t module B : sig type t = t end end
module Make_bad :
  functor (M : sig end) -> sig type t module C : sig type t = t end end

Can this issue be closed or does the problem still occur in more complex scenarios?
(0016248)
lpw25 (developer)
2016-08-30 10:27

I think it can probably be closed. I'm pretty sure it is an instance of what

  https://github.com/ocaml/ocaml/pull/708 [^]

fixes.

- Issue History
Date Modified Username Field Change
2015-02-17 16:34 ceastlund New Issue
2015-02-19 19:44 yallop Relationship added has duplicate 0006788
2015-02-24 22:14 doligez Status new => acknowledged
2015-02-24 22:14 doligez Target Version => 4.02.2+dev / +rc1
2015-02-24 22:14 doligez Steps to Reproduce Updated View Revisions
2015-04-29 18:48 doligez Target Version 4.02.2+dev / +rc1 => 4.02.3+dev
2015-07-10 16:54 doligez Target Version 4.02.3+dev => 4.03.0+dev / +beta1
2016-04-18 14:05 doligez Status acknowledged => confirmed
2016-04-18 14:05 doligez Target Version 4.03.0+dev / +beta1 => 4.03.1+dev
2016-08-30 08:37 gasche Note Added: 0016244
2016-08-30 10:27 lpw25 Note Added: 0016248
2016-08-30 10:30 gasche Status confirmed => resolved
2016-08-30 10:30 gasche Fixed in Version => 4.04.0 +dev / +beta1 / +beta2
2016-08-30 10:30 gasche Resolution open => fixed
2016-08-30 10:30 gasche Assigned To => lpw25
2017-02-23 16:45 doligez Category OCaml typing => typing


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker