Skip to content

Conversation

@liam923
Copy link
Contributor

@liam923 liam923 commented Feb 9, 2026

This PR cherrypicks the compiler changes from PR oxcaml/oxcaml#5398. The reason for eagerly cherry-picking is to fix verbose kind hovers without waiting for the next compiler roll.

Copy link
Contributor

@dkalinichenko-js dkalinichenko-js left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 4-way diff, courtesy of Claude:

  ⎿  ======================================================================
     4-WAY DIFF: oxcaml/oxcaml#5398 vs oxcaml/merlin#218
     ======================================================================

     Shared files (3):
       - typing/printtyp.ml
       - typing/typemode.ml
       - typing/typemode.mli

     oxcaml-only files (1):
       - testsuite/tests/typing-jkind-bounds/verbosity/verbosity2.ml

     merlin-only files (1):
       - tests/test-dirs/kind-enclosing/verbosity.t

     ======================================================================
     FILE: typing/printtyp.ml
       DIFFERENCES FOUND:

     --- oxcaml#typing/printtyp.ml
     +++ merlin#typing/printtyp.ml
     @@ -1,7 +1,7 @@
      diff --git a/typing/printtyp.ml b/typing/printtyp.ml
     ---- a/typing/printtyp.ml
     +--- b/typing/printtyp.ml
      +++ b/typing/printtyp.ml
     -@@ -1433,7 +1433,7 @@ let outcome_label : Types.arg_label -> Outcometree.arg_label = function
     +@@ -1352,7 +1352,7 @@ let outcome_label : Types.arg_label -> Outcometree.arg_label = function
           accordingly. *)
       let tree_of_modalities mut t =
         t
     @@ -9,4 +9,4 @@
      +  |> Typemode.least_modalities ~include_implied:false ~mut
         |> Typemode.sort_dedup_modalities
         |> List.map (fun (Atom (ax, m) : Modality.atom) ->
     -       Fmt.asprintf "%a" (Modality.Per_axis.print ax) m)
     +       Format.asprintf "%a" (Modality.Per_axis.print ax) m)

     ======================================================================
     FILE: typing/typemode.ml
       DIFFERENCES FOUND:

     --- oxcaml#typing/typemode.ml
     +++ merlin#typing/typemode.ml
     @@ -1,5 +1,5 @@
      diff --git a/typing/typemode.ml b/typing/typemode.ml
     ---- a/typing/typemode.ml
     +--- b/typing/typemode.ml
      +++ b/typing/typemode.ml
      @@ -520,7 +520,7 @@ let idx_expected_modalities ~(mut : bool) =
             "Typemode.idx_expected_modalities: mismatch with mutable implied \
     @@ -31,12 +31,12 @@
      -    |> List.map (fun (Atom (ax, m) : Modality.atom) ->
      +    List.map
      +      (fun (Atom (ax, m) : Modality.atom) ->
     -         let s = Format_doc.asprintf "%a" (Modality.Per_axis.print ax) m in
     +         let s = Format.asprintf "%a" (Modality.Per_axis.print ax) m in
               { Location.txt = Parsetree.Mode s; loc = Location.none })
      +      least_modalities
         in
      -  let nonmodal_annots =
     -+  (* These mod-bounds are top ones, which are redundant to print. But we include
     ++    (* These mod-bounds are top ones, which are redundant to print. But we include
      +     them when printing verbosely. *)
      +  let top_modality_annots () =
      +    List.filter_map
     @@ -52,7 +52,7 @@
      +        | true -> None
      +        | false ->
      +          let s =
     -+            Format_doc.asprintf "%a"
     ++            Format.asprintf "%a"
      +              (Modality.Per_axis.print ax)
      +              (Modality.Const.proj ax modality)
      +          in
     @@ -65,11 +65,11 @@
      -      if (not verbose) && value = default
      -      then None
      -      else
     --        let s = Format_doc.asprintf "%a" print value in
     +-        let s = Format.asprintf "%a" print value in
      -        Some { Location.txt = Parsetree.Mode s; loc = Location.none }
     -+    let mk_annot top print value =
     ++        let mk_annot top print value =
      +      let only_when_verbose = value = top in
     -+      let s = Format_doc.asprintf "%a" print value in
     ++      let s = Format.asprintf "%a" print value in
      +      ( { Location.txt = Parsetree.Mode s; loc = Location.none },
      +        only_when_verbose )
           in

     ======================================================================
     FILE: typing/typemode.mli
       DIFFERENCES FOUND:

     --- oxcaml#typing/typemode.mli
     +++ merlin#typing/typemode.mli
     @@ -1,5 +1,5 @@
      diff --git a/typing/typemode.mli b/typing/typemode.mli
     ---- a/typing/typemode.mli
     +--- b/typing/typemode.mli
      +++ b/typing/typemode.mli
      @@ -33,8 +33,14 @@ val transl_modalities :
         Parsetree.modalities ->

@liam923
Copy link
Contributor Author

liam923 commented Feb 9, 2026

Thanks for catching my sloppiness - fixed.

@liam923 liam923 merged commit 468e4b8 into main Feb 9, 2026
1 check passed
@liam923 liam923 deleted the account-for-implied-modalities branch February 9, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants