Source

compiler-libs-hack / ocaml / testsuite / tests / typing-modules / Test.ml.reference

Full commit

#     module type S = sig type t and s = t end
# module type S' = sig type s = int end
#   module type S = sig module rec M : sig  end and N : sig  end end
# module type S' = sig module rec N : sig  end end
#     * * * * * * * * * * * * * * * *         type -'a t
class type c = object method m : [ `A ] t end
#   module M : sig val v : (#c as 'a) -> 'a end
#       val id : 'a -> 'a = <fun>
#       val ko : 'a -> unit = <fun>
#           Characters 64-99:
    struct type +'a t = private int end
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Signature mismatch:
       Modules do not match:
         sig type +'a t = private int end
       is not included in
         sig type -'a t = private int end
       Type declarations do not match:
         type +'a t = private int
       is not included in
         type -'a t = private int
       Their variances do not agree.
#       module type A = sig type t = X of int end
# type u = X of bool
# Characters 23-33:
  module type B = A with type t = u;; (* fail *)
                         ^^^^^^^^^^
Error: This variant or record definition does not match that of type u
       The types for field X are not equal.
#       module type S = sig exception Foo of bool end
#