1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
module type S = sig end
type t = (module S)
module type S = sig
val x : int
end
module M = struct
let x = 0
end
let m = (module M : S)
let () =
let (module M : S) = m in
(* error here *)
()
module type S = sig
val x : int
end
module M = struct
let x = 0
end
let m = (module M : S)
let f ((module M : S) as u) = ignore u ; M.x
let f (T {m= (module M)}) = ignore u ; M.x
let f (T {m= (module M : S)}) = ignore u ; M.x
let v = f (module M : S with type t = t)
module type S = sig
type a
val va : a
type b
val vb : b
end
let f (module M : S with type a = int and type b = int) = M.va + M.vb
let f (module M : S with type a = int and type b = int)
(module N : SSSS
with type a = int
and type b = int
and type c = int
and type d = int
and type e = int )
(module N : SSSS
with type a = int
and type b = int
and type c = int
and type d = int )
(module O : S with type a = int and type b = int and type c = int) =
M.va + N.vb
module type M = sig
val storage : (module S with type t = t)
end
let _ =
let module M = (val m : M) in
()
let _ =
( module Ephemeron (HHHHHHHHHHHHHHHHHHHHHHHHHH) (HHHHHHHHHHHHHHHHHHHHHHHHHH)
: Ephemeron.S )
let _ =
( module Ephemeron (HHHHHHHHHHHHHHHHHHHHHHHHHH) (HHHHHHHHHHHHHHHHHH)
: Ephemeron.S )
let _ = (module Ephemeron (HHHHHHHHHHHHHHH) (HHHHHHHHHHHHH) : Ephemeron.S)
let _ = (module Ephemeron (HHH) : Ephemeron.S)
let _ =
( module Ephemeron (struct
type t = t
end) : Ephemeron.S )
let _ =
( module struct
let a = b
end )
(* Tests for dropped comment *)
module M = (val x : S (* a *))
module M = (val x (* b *))
[@@@ocamlformat "break-struct=natural"]
let _ =
( module struct
let x = 0
let y = 1
end )
(* Three form that had an equivalent AST at some point: *)
let x : (module S) = (module M)
let x = ((module M) : (module S))
let x = (module M : S)
(* Unpack containing a [pexp_constraint]. *)
module T = (val (x : (module S)))
let _ = (module Int : T[@foo])
|