Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade OCamlformat to 0.26.1 #997

Merged
merged 4 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ c5b7900eb40a48e2877db4994a2b2f8d755531e4
8b4a11d74af7dd4de0ae9463af3c9d563d758cfc
# ocamlformat 0.25.1
0f01f32f3b3adc849bc7cc859776763a9139da19
# Upgrade to OCamlformat 0.26.0
1cf80035f66badcc8b4e667cbfd13cb483a7a773
# Upgrade to OCamlformat 0.26.1
1c015488b8d32a0571eaa144a92ab4725bad0b85
3 changes: 2 additions & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
module-item-spacing=preserve
version=0.25.1
version=0.26.1
ocaml-version=4.02
65 changes: 30 additions & 35 deletions doc/examples/markup.mli
Original file line number Diff line number Diff line change
Expand Up @@ -52,46 +52,42 @@ module type Foo = sig
val bar : string
(** This comment is associated to bar. *)

class cl :
object

(** Interesting information about cl *)
end
class cl : object
(** Interesting information about cl *)
end

(** The comment for class my_class *)
class my_class :
object
inherit cl
(** A comment to describe inheritance from cl *)
class my_class : object
inherit cl
(** A comment to describe inheritance from cl *)

val mutable tutu : string
(** The comment for attribute tutu *)
val mutable tutu : string
(** The comment for attribute tutu *)

val toto : int
(** The comment for attribute toto. *)
val toto : int
(** The comment for attribute toto. *)

(** This comment is not attached to titi since
(** This comment is not attached to titi since
there is a blank line before titi, but is kept
as a comment in the class. *)

val titi : string
val titi : string

method toto : string
(** Comment for method toto *)
method toto : string
(** Comment for method toto *)

method m : float -> int
(** Comment for method m *)
end
method m : float -> int
(** Comment for method m *)
end

(** The comment for the class type my_class_type *)
class type my_class_type =
object
val mutable x : int
(** The comment for variable x. *)
class type my_class_type = object
val mutable x : int
(** The comment for variable x. *)

method m : int -> int
(** The comment for method m. *)
end
method m : int -> int
(** The comment for method m. *)
end

(** The comment for module Foo *)
module Foo : sig
Expand Down Expand Up @@ -119,16 +115,15 @@ end
module Stop : sig
(** This module demonstrates the use of stop comments ([(**/**)]) *)

class type foo =
object
method m : string
(** comment for method m *)
class type foo = object
method m : string
(** comment for method m *)

(**/**)
(**/**)

method bar : int
(** This method won't appear in the documentation *)
end
method bar : int
(** This method won't appear in the documentation *)
end

val foo : string
(** This value appears in the documentation, since the Stop special comment
Expand Down
38 changes: 16 additions & 22 deletions src/ocamlary/ocamlary.mli
Original file line number Diff line number Diff line change
Expand Up @@ -579,23 +579,19 @@ 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
class two_method_class : object
method one : one_method_class

method undo : unit
end
method undo : unit
end

class ['a] param_class :
'a
-> object
method v : 'a
end
class ['a] param_class : 'a -> object
method v : 'a
end

type my_unit_object = unit param_class

Expand All @@ -609,10 +605,9 @@ type 'a my_unit_class = unit #param_class as 'a
(* 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
Expand Down Expand Up @@ -726,10 +721,9 @@ 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

Expand Down
26 changes: 12 additions & 14 deletions src/xref2/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,14 @@ let s_module : Component.Element.module_ scope =

let s_any : Component.Element.any scope =
make_scope ~root:lookup_page_or_root_module_fallback
~check:
(fun env -> function
| `Label (id, _) -> (
try
Some
(Identifier.Maps.Label.find id env.ambiguous_labels
:> Component.Element.any amb_err)
with Not_found -> None)
| _ -> None)
~check:(fun env -> function
| `Label (id, _) -> (
try
Some
(Identifier.Maps.Label.find id env.ambiguous_labels
:> Component.Element.any amb_err)
with Not_found -> None)
| _ -> None)
(function
(* Reference to [A] could refer to [extension-A] or [extension-decl-A].
The legacy behavior refers to the constructor [extension-A]. *)
Expand Down Expand Up @@ -562,11 +561,10 @@ let s_value : Component.Element.value scope =

let s_label : Component.Element.label scope =
make_scope
~check:
(fun env -> function
| `Label (id, _) -> (
try Some (Identifier.Maps.Label.find id env.ambiguous_labels)
with Not_found -> None))
~check:(fun env -> function
| `Label (id, _) -> (
try Some (Identifier.Maps.Label.find id env.ambiguous_labels)
with Not_found -> None))
(function #Component.Element.label as r -> Some r | _ -> None)

let s_constructor : Component.Element.constructor scope =
Expand Down
2 changes: 1 addition & 1 deletion src/xref2/ref_tools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ module L = struct
| `Heading
( _,
({ Odoc_model.Paths.Identifier.iv = `Label (_, name'); _ } as
label),
label),
_ )
when name = LabelName.to_string name' ->
Ok (`Identifier label)
Expand Down
Loading