diff --git a/test/html/cases/ocamlary.mli b/test/html/cases/ocamlary.mli index a668f82737..4b2bb49628 100644 --- a/test/html/cases/ocamlary.mli +++ b/test/html/cases/ocamlary.mli @@ -15,7 +15,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *) - (** This is an {i interface} with {b all} of the {e module system} features. {C This text is centered. } {L This text is left-aligned. } @@ -81,13 +80,16 @@ A numbered list: (** Here is some {e emphasis} [followed by code]. *) - (** An unassociated comment *) + (******************************************************************************) (** {1 Level 1 } *) + (** {2 Level 2 } *) + (** {3 Level 3 } *) + (** {4 Level 4 } *) (** {3 Basic module stuff} *) @@ -97,10 +99,14 @@ module Empty : sig end (** This module has a signature without any members. *) (** An ambiguous, misnamed module type *) -module type Empty = sig type t end +module type Empty = sig + type t +end (** An ambiguous, misnamed module type *) -module type MissingComment = sig type t end +module type MissingComment = sig + type t +end (** {9000:s9000 Level 9000 } *) @@ -123,7 +129,9 @@ module ModuleWithSignature : EmptySig *) module ModuleWithSignatureAlias : EmptySigAlias -module One : sig type one end +module One : sig + type one +end (** There's a signature in a module in this signature. *) module type SigForMod = sig @@ -142,15 +150,21 @@ module type SuperSig = sig type sub_sig_a_mod end end + module type SubSigB = sig (** {3:subSig Another Labeled Section Header Inside of a Signature} *) type t end + module type EmptySig = sig type not_actually_empty end - module type One = sig type two end + + module type One = sig + type two + end + module type SuperSig = sig end end @@ -175,7 +189,7 @@ exception Kaboom of unit exception Kablam of unit * unit (** Unary exception constructor over binary tuple *) -exception Kapow of (unit * unit) +exception Kapow of (unit * unit) (** {!EmptySig} is general but {!modtype:EmptySig} is a module and {!exception:EmptySig} is this exception. *) @@ -188,49 +202,49 @@ exception EmptySigAlias (** {!a_function} is general but {!type:a_function} is this type and {!val:a_function} is the value below. *) -type ('a,'b) a_function = 'a -> 'b +type ('a, 'b) a_function = 'a -> 'b +val a_function : x:int -> int (** This is [a_function] with param and return type. @param x the [x] coordinate @return the [y] coordinate *) -val a_function : x:int -> int val fun_fun_fun : ((int, int) a_function, (unit, unit) a_function) a_function val fun_maybe : ?yes:unit -> unit -> int -(** @raise Not_found That's all it does *) val not_found : unit -> unit +(** @raise Not_found That's all it does *) -(** @see The OCaml Web site *) val ocaml_org : string +(** @see The OCaml Web site *) -(** @see 'some_file' The file called [some_file] *) val some_file : string +(** @see 'some_file' The file called [some_file] *) -(** @see "some_doc" The document called [some_doc] *) val some_doc : string +(** @see "some_doc" The document called [some_doc] *) +val since_mesozoic : unit (** This value was introduced in the Mesozoic era. @since mesozoic *) -val since_mesozoic : unit +val changing : unit (** This value has had changes in 1.0.0, 1.1.0, and 1.2.0. @before 1.0.0 before 1.0.0 @before 1.1.0 before 1.1.0 @version 1.2.0 *) -val changing : unit +val with_foo : unit (** This value has a custom tag [foo]. @foo the body of the custom [foo] tag *) -val with_foo : unit (** {3 Some Operators } *) @@ -271,7 +285,9 @@ val ( = ) : unit val ( land ) : unit (**/**) + (** I'm hidden *) + (**/**) (** {3 Advanced Module Stuff} *) @@ -280,6 +296,7 @@ val ( land ) : unit module CollectionModule : sig (** This comment is for [collection]. *) type collection + type element (** This comment is for [InnerModuleA]. *) @@ -290,7 +307,7 @@ module CollectionModule : sig (** This comment is for [InnerModuleA']. *) module InnerModuleA' : sig (** This comment is for [t]. *) - type t = (unit,unit) a_function + type t = (unit, unit) a_function end (** This comment is for [InnerModuleTypeA']. *) @@ -307,25 +324,30 @@ end (** module type of *) module type COLLECTION = module type of CollectionModule -module Recollection : - functor (C : COLLECTION) -> - COLLECTION with type collection = C.element list and type element = C.collection +module Recollection : functor (C : COLLECTION) -> + COLLECTION + with type collection = C.element list + and type element = C.collection -module type MMM = sig module C : COLLECTION end +module type MMM = sig + module C : COLLECTION +end module type RECOLLECTION = MMM with module C = Recollection(CollectionModule) module type RecollectionModule = sig - include module type of Recollection(CollectionModule) + include module type of Recollection (CollectionModule) end module type A = sig type t + module Q : COLLECTION end module type B = sig type t + module Q : COLLECTION end @@ -335,6 +357,7 @@ end {- it includes {!B} with some substitution}} *) module type C = sig include A + include B with type t := t and module Q := Q end @@ -348,7 +371,7 @@ end *) (** This comment is for [FunctorTypeOf]. *) -module FunctorTypeOf(Collection : module type of CollectionModule) : sig +module FunctorTypeOf (Collection : module type of CollectionModule) : sig (** This comment is for [t]. *) type t = Collection.collection end @@ -363,6 +386,7 @@ module type ToInclude = sig module IncludedA : sig type t end + module type IncludedB = sig type s end @@ -374,56 +398,53 @@ include ToInclude (** This comment is for [record]. *) type record = { - field1 : int; (** This comment is for [field1]. *) - field2 : int; (** This comment is for [field2]. *) + field1 : int; (** This comment is for [field1]. *) + field2 : int; (** This comment is for [field2]. *) } (** This comment is also for [record]. *) type mutable_record = { - mutable a : int; (** [a] is first and mutable *) - b : unit; (** [b] is second and immutable *) - mutable c : int; (** [c] is third and mutable *) + mutable a : int; (** [a] is first and mutable *) + b : unit; (** [b] is second and immutable *) + mutable c : int; (** [c] is third and mutable *) } -type universe_record = { - nihilate : 'a. 'a -> unit; -} +type universe_record = { nihilate : 'a. 'a -> unit } (** This comment is for [variant]. *) type variant = -| TagA (** This comment is for [TagA]. *) -| ConstrB of int (** This comment is for [ConstrB]. *) -| ConstrC of int * int (** This comment is for binary [ConstrC]. *) -| ConstrD of (int * int) -(** This comment is for unary [ConstrD] of binary tuple. *) + | TagA (** This comment is for [TagA]. *) + | ConstrB of int (** This comment is for [ConstrB]. *) + | ConstrC of int * int (** This comment is for binary [ConstrC]. *) + | ConstrD of (int * int) + (** This comment is for unary [ConstrD] of binary tuple. *) (** This comment is also for [variant]. *) (** This comment is for [poly_variant]. *) -type poly_variant = [ -| `TagA (** This comment is for [`TagA]. *) -| `ConstrB of int (** This comment is for [`ConstrB]. *) -] +type poly_variant = + [ `TagA (** This comment is for [`TagA]. *) + | `ConstrB of int (** This comment is for [`ConstrB]. *) ] (** Wow! It was a polymorphic variant! *) (** This comment is for [full_gadt]. *) -type (_,_) full_gadt = -| Tag : (unit,unit) full_gadt -| First : 'a -> ('a,unit) full_gadt -| Second : 'a -> (unit,'a) full_gadt -| Exist : 'a * 'b -> ('b, unit) full_gadt (** *) +type (_, _) full_gadt = + | Tag : (unit, unit) full_gadt + | First : 'a -> ('a, unit) full_gadt + | Second : 'a -> (unit, 'a) full_gadt + | Exist : 'a * 'b -> ('b, unit) full_gadt (** *) (** Wow! It was a GADT! *) (** This comment is for [partial_gadt]. *) type 'a partial_gadt = -| AscribeTag : 'a partial_gadt -| OfTag of 'a partial_gadt -| ExistGadtTag : ('a -> 'b) -> 'a partial_gadt (** *) + | AscribeTag : 'a partial_gadt + | OfTag of 'a partial_gadt + | ExistGadtTag : ('a -> 'b) -> 'a partial_gadt (** *) (** Wow! It was a mixed GADT! *) (** This comment is for [record_arg_gadt]. *) type _ record_arg_gadt = | With_rec : { foo : int } -> unit record_arg_gadt - | With_poly_rec : { bar : 'a. 'a -> 'a } -> ('a -> 'a) record_arg_gadt (** *) + | With_poly_rec : { bar : 'a. 'a -> 'a } -> ('a -> 'a) record_arg_gadt (** *) (** Wow! It was a GADT with record arguments *) (** This comment is for [alias]. *) @@ -434,31 +455,20 @@ type tuple = (alias * alias) * alias * (alias * alias) (** This comment is for [variant_alias]. *) type variant_alias = variant = -| TagA -| ConstrB of int -| ConstrC of int * int -| ConstrD of (int * int) + | TagA + | ConstrB of int + | ConstrC of int * int + | ConstrD of (int * int) (** This comment is for [record_alias]. *) -type record_alias = record = { - field1 : int; - field2 : int; -} +type record_alias = record = { field1 : int; field2 : int } (** This comment is for [poly_variant_union]. *) -type poly_variant_union = [ -| poly_variant -| `TagC -] +type poly_variant_union = [ poly_variant | `TagC ] -type 'a poly_poly_variant = [ -| `TagA of 'a -] +type 'a poly_poly_variant = [ `TagA of 'a ] -type ('a,'b) bin_poly_poly_variant = [ -| `TagA of 'a -| `ConstrB of 'b -] +type ('a, 'b) bin_poly_poly_variant = [ `TagA of 'a | `ConstrB of 'b ] (* TODO: figure out how to spec a conjunctive type type amb_poly_variant = [ @@ -468,7 +478,7 @@ type amb_poly_variant = [ ] *) -type 'a open_poly_variant = [> `TagA ] as 'a +type 'a open_poly_variant = [> `TagA ] as 'a type 'a open_poly_variant2 = [> `ConstrB of int ] as 'a @@ -481,81 +491,70 @@ type 'a poly_fun_constraint = 'a -> 'a constraint 'a = [> `TagA ] type 'a closed_poly_variant = [< `One | `Two ] as 'a type 'a clopen_poly_variant = -[< `One | `Two of int | `Three > `Two `Three] as 'a + [< `One | `Two of int | `Three > `Two `Three ] as 'a -type nested_poly_variant = [ -| `A -| `B of [ - | `B1 - | `B2 -] -| `C -| `D of [ - | `D1 of [ - `D1a - ] -] -] +type nested_poly_variant = + [ `A | `B of [ `B1 | `B2 ] | `C | `D of [ `D1 of [ `D1a ] ] ] (** This comment is for [full_gadt_alias]. *) -type ('a,'b) full_gadt_alias = ('a,'b) full_gadt = -| Tag : (unit,unit) full_gadt_alias -| First : 'a -> ('a,unit) full_gadt_alias -| Second : 'a -> (unit,'a) full_gadt_alias -| Exist : 'a * 'b -> ('b, unit) full_gadt_alias +type ('a, 'b) full_gadt_alias = ('a, 'b) full_gadt = + | Tag : (unit, unit) full_gadt_alias + | First : 'a -> ('a, unit) full_gadt_alias + | Second : 'a -> (unit, 'a) full_gadt_alias + | Exist : 'a * 'b -> ('b, unit) full_gadt_alias (** This comment is for [partial_gadt_alias]. *) type 'a partial_gadt_alias = 'a partial_gadt = -| AscribeTag : 'a partial_gadt_alias -| OfTag of 'a partial_gadt_alias -| ExistGadtTag : ('a -> 'b) -> 'a partial_gadt_alias + | AscribeTag : 'a partial_gadt_alias + | OfTag of 'a partial_gadt_alias + | ExistGadtTag : ('a -> 'b) -> 'a partial_gadt_alias (** This comment is for {!Exn_arrow}. *) exception Exn_arrow : unit -> exn (** This comment is for {!mutual_constr_a} then {!mutual_constr_b}. *) type mutual_constr_a = -| A -| B_ish of mutual_constr_b -(** This comment is between {!mutual_constr_a} and {!mutual_constr_b}. *) -and mutual_constr_b = -| B -| A_ish of mutual_constr_a -(** This comment must be here for the next to associate correctly. *) + | A + | B_ish of mutual_constr_b + (** This comment is between {!mutual_constr_a} and {!mutual_constr_b}. *) + (** This comment is for {!mutual_constr_b} then {!mutual_constr_a}. *) +and mutual_constr_b = + | B + | A_ish of mutual_constr_a + (** This comment must be here for the next to associate correctly. *) -type rec_obj = < f : int; g : unit -> unit; h : rec_obj > +type rec_obj = < f : int ; g : unit -> unit ; h : rec_obj > -type 'a open_obj = < f : int; g : unit -> unit; .. > as 'a +type 'a open_obj = < f : int ; g : unit -> unit ; .. > as 'a -type 'a oof = (< a : unit; .. > as 'a) -> 'a +type 'a oof = (< a : unit ; .. > as 'a) -> 'a type 'a any_obj = < .. > as 'a type empty_obj = < > -type one_meth = < meth: unit > +type one_meth = < meth : unit > (** A mystery wrapped in an ellipsis *) type ext = .. type ext += ExtA + type ext += ExtB -type ext += -| ExtC of unit -| ExtD of ext + +type ext += ExtC of unit | ExtD of ext + type ext += ExtE type ext += private ExtF -type 'a poly_ext = .. (** 'a poly_ext *) +type 'a poly_ext = .. -type 'b poly_ext += Foo of 'b | Bar of 'b * 'b -(** 'b poly_ext *) +type 'b poly_ext += Foo of 'b | Bar of 'b * 'b (** 'b poly_ext *) -type 'c poly_ext += Quux of 'c -(** 'c poly_ext *) +type 'c poly_ext += Quux of 'c (** 'c poly_ext *) module ExtMod : sig type t = .. @@ -563,32 +562,35 @@ module ExtMod : sig type t += Leisureforce end -type ExtMod.t += ZzzTop0 -(** It's got the rock *) +type ExtMod.t += ZzzTop0 (** It's got the rock *) -type ExtMod.t += ZzzTop of unit -(** and it packs a unit. *) +type ExtMod.t += ZzzTop of unit (** and it packs a unit. *) -(** Rotate keys on my mark... *) external launch_missiles : unit -> unit = "tetris" +(** Rotate keys on my mark... *) (** A brown paper package tied up with string*) type my_mod = (module COLLECTION) class empty_class : object end -class one_method_class : object - method go : unit -end +class one_method_class : + object + method go : unit + end -class two_method_class : object - method one : one_method_class - method undo : unit -end +class two_method_class : + object + method one : one_method_class -class ['a] param_class : 'a -> object - method v : 'a -end + method undo : unit + end + +class ['a] param_class : + 'a + -> object + method v : 'a + end type my_unit_object = unit param_class @@ -599,99 +601,139 @@ type 'a my_unit_class = unit #param_class as 'a (* TODO: classes, class types, ...? *) - (* Test resolution of dependently typed modules *) module Dep1 : sig module type S = sig - class c : object - method m : int - end + class c : + object + method m : int + end end + module X : sig module Y : S end end -module Dep2 : - functor (Arg : sig module type S module X : sig module Y : S end end) -> - sig - module A : sig - module Y : Arg.S - end - module B = A.Y - end +module Dep2 : functor + (Arg : sig + module type S + + module X : sig + module Y : S + end + end) + -> sig + module A : sig + module Y : Arg.S + end -type dep1 = Dep2(Dep1).B.c;; + module B = A.Y +end + +type dep1 = Dep2(Dep1).B.c -module Dep3 : sig type a end +module Dep3 : sig + type a +end module Dep4 : sig - module type T = sig type b end + module type T = sig + type b + end + module type S = sig module X : T + module Y : sig end end + module X : T end -module Dep5 : - functor (Arg : sig - module type T - module type S = sig - module X : T - module Y : sig end - end - module X : T - end) -> - sig - module Z : Arg.S with module Y = Dep3 - end +module Dep5 : functor + (Arg : sig + module type T + + module type S = sig + module X : T + + module Y : sig end + end + + module X : T + end) + -> sig + module Z : Arg.S with module Y = Dep3 +end type dep2 = Dep5(Dep4).Z.X.b type dep3 = Dep5(Dep4).Z.Y.a module Dep6 : sig - module type S = sig type d end + module type S = sig + type d + end + module type T = sig module type R = S + module Y : R end + module X : T end -module Dep7 : - functor (Arg : sig - module type S - module type T = sig - module type R = S - module Y : R - end - module X : T - end) -> sig - module M : Arg.T - end +module Dep7 : functor + (Arg : sig + module type S -type dep4 = Dep7(Dep6).M.Y.d;; + module type T = sig + module type R = S + module Y : R + end -module Dep8 : sig module type T = sig type t end end + module X : T + end) + -> sig + module M : Arg.T +end -module Dep9 : functor (X : sig module type T end) -> sig module type T = X.T end +type dep4 = Dep7(Dep6).M.Y.d + +module Dep8 : sig + module type T = sig + type t + end +end + +module Dep9 : functor + (X : sig + module type T + end) + -> sig + module type T = X.T +end module type Dep10 = Dep9(Dep8).T with type t = int module Dep11 : sig module type S = sig - class c : object - method m : int - end + class c : + object + method m : int + end end end -module Dep12 : - functor (Arg : sig module type S end) -> sig - module type T = Arg.S +module Dep12 : functor + (Arg : sig + module type S + end) + -> sig + module type T = Arg.S end module Dep13 : Dep12(Dep11).T @@ -704,11 +746,14 @@ module type With1 = sig module M : sig module type S end + module N : M.S end module With2 : sig - module type S = sig type t end + module type S = sig + type t + end end module With3 : With1 with module M = With2 @@ -720,7 +765,10 @@ module With4 : With1 with module M := With2 type with2 = With4.N.t module With5 : sig - module type S = sig type t end + module type S = sig + type t + end + module N : S end @@ -728,37 +776,46 @@ module With6 : sig module type T = sig module M : sig module type S + module N : S end end end -module With7 : functor (X : sig module type T end) -> sig module type T = X.T end +module With7 : functor + (X : sig + module type T + end) + -> sig + module type T = X.T +end -module type With8 = With7(With6).T with module M = With5 and type M.N.t = With5.N.t +module type With8 = + With7(With6).T with module M = With5 and type M.N.t = With5.N.t module With9 : sig - module type S = sig type t end + module type S = sig + type t + end end module With10 : sig - - + (** {!With10.T} is a submodule type. *) module type T = sig module M : sig module type S end + module N : M.S end - (** {!With10.T} is a submodule type. *) end module type With11 = With7(With10).T with module M = With9 and type N.t = int module type NestedInclude1 = sig - - module type NestedInclude2 = sig type nested_include end - + module type NestedInclude2 = sig + type nested_include + end end include NestedInclude1 @@ -784,8 +841,8 @@ module IncludeInclude1 : sig end include module type of IncludeInclude1 -include IncludeInclude2 +include IncludeInclude2 (** {1:indexmodules Trying the \{!modules: ...\} command.} @@ -824,7 +881,6 @@ module CanonicalTest : sig module C : module type of Base__.List open Base__ - module L = List val foo : int L.t -> float L.t @@ -880,7 +936,6 @@ module Aliases : sig end module Foo__ : sig - (** @canonical Ocamlary.Aliases.Foo.A *) module A = Foo__A @@ -894,26 +949,27 @@ module Aliases : sig module D = Foo__D module E = Foo__E - end module Foo : sig open Foo__ - module A = A module B = B module C = C module D = D - module E = E end module A' = Foo.A type tata = Foo.A.t + type tbtb = Foo__.B.t + type tete = Foo__.E.t + type tata' = A'.t + type tete2 = Foo.E.t module Std : sig @@ -953,6 +1009,7 @@ module Aliases : sig module X2 = P2.Z type p1 = X1.t + type p2 = X2.t end