Skip to content

Conversation

@mhjd
Copy link
Contributor

@mhjd mhjd commented Aug 22, 2024

Résumé

J'ai fais une autre pull request, pour la version d'OCaml 5.1, mais cela ne fonctionne pas. J'ai donné les explications dans l'autre pull request.

Cette branche fonctionne avec ocaml > 4.13.1 et < 5.1.0.

Ocaml 4.13 : modification d'un type

File "odoc_import.ml", line 35, characters 23-38:
35 |     | Types.Tlink t2 | Types.Tsubst t2 -> need_parent t2
                            ^^^^^^^^^^^^^^^
Error: The constructor Types.Tsubst expects 2 argument(s),
       but is applied here to 1 argument(s)
make[1]: *** [Makefile:45: odoc_import.cmo] Error 2

Vient de ce changement :
ocaml/ocaml#10174

Avant :

| Tsubst of type_expr         (* for copying *)
  (** [Tsubst] is used temporarily to store information in low-level
      functions manipulating representation of types, such as
      instantiation or copy.

Après :

| Tsubst of type_expr * type_expr option
  (** [Tsubst] is used temporarily to store information in low-level
      functions manipulating representation of types, such as
      instantiation or copy.
      The first argument contains a copy of the original node.
      The second is available only when the first is the row variable of
      a polymorphic variant.  It then contains a copy of the whole variant.

J'ai donc modifié en ignorant le second argument et ça marche :

  | Types.Tlink t2 | Types.Tsubst (t2, _) -> is_arrow_type t2

Après j'ai pas trop compris le message de la PR, mais ça dit bien que c'est un extra argument:

The constructor Tsubst of type_desc has only one type_expr as its argument while it needs two during a copy.
The two values are currently packed as a Ttuple and wrapped in an extra type_expr before they are fed to Tsubst.
This style looks quite ad-hoc, and moreover it turned out to be an obstacle in our (@garrigue and me) attempt to make
type_expr an abstract type.
This PR adds to Tsubst another argument of type type_expr option to eliminate that hackish use of Ttuple.

Supression d'un warning

Simple changement d'appel de fonction :

-           self#html_of_record b indent father l ;
+           self#html_of_record b ~indent ~father l ;

Les labels étaient pas préciser ce qui cause maintenant un warning

mark_loops erreurs

printtyp.mark_loops a disparu à ce commit là : https://github.com/ocaml/ocaml/pull/10488/files

Updated ocamldoc to the new API by: (1) removing unncessary calls to Printtyp.mark_loops which were handled by the formatters; and
(2) replacing Printtyp.type_scheme_max ~b_reset_names: false with Printtyp.shared_type_scheme.

Files modified:

ocamldoc/odoc_env.ml
ocamldoc/odoc_print.ml
ocamldoc/odoc_str.ml
ocamldoc/odoc_value.ml

Il y a certain morceaux de code qui cause des erreurs quasi identique dans odoc_str.ml, ceux-ci ont été modifié. J'ai donc juste eu à copié les changement.
Y a un autre morceau de code qui n'était pas quasi identique mais ressemblait.
J'ai suivi la recommandation : (2) replacing Printtyp.type_scheme_max ~b_reset_names: false with Printtyp.shared_type_scheme

En ce qui concerne la supression de Printtyp.mark_loops t, c'est dis dans le premier conseil qu'il faut suprimé quand c'est "handled by the formatters", et juste après notre Printtyp.mark_loops t, y a un fmt :
Format.fprintf fmt "@[<hov 2>%s%s%a%s@] ->@ "
Donc j'ai supprimé.

@mhjd mhjd force-pushed the fix-version-issue-before-5.1 branch from 0a1c51d to da5af8a Compare August 22, 2024 14:26
@mhjd mhjd force-pushed the fix-version-issue-before-5.1 branch from da5af8a to 7317ffe Compare August 22, 2024 14:28
@balat balat merged commit 99484ca into master Aug 22, 2024
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.

3 participants