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

"Cannot find type Topdirs.printer_type_new" with OCaml 5 #410

Open
talex5 opened this issue Dec 18, 2022 · 3 comments
Open

"Cannot find type Topdirs.printer_type_new" with OCaml 5 #410

talex5 opened this issue Dec 18, 2022 · 3 comments

Comments

@talex5
Copy link
Contributor

talex5 commented Dec 18, 2022

Testing with this input:

```ocaml
# let pp f x = Format.fprintf f "[%s]" x;;
# #install_printer pp;;
# "hi";;
```

On OCaml 4.14 it works:

```ocaml
# let pp f x = Format.fprintf f "[%s]" x;;
val pp : Format.formatter -> string -> unit = <fun>
# #install_printer pp;;
# "hi";;
- : string = [hi]
```

but on 5.0.0 I get an error:

```ocaml
# let pp f x = Format.fprintf f "[%s]" x;;
val pp : Format.formatter -> string -> unit = <fun>
# #install_printer pp;;
Cannot find type Topdirs.printer_type_new.
# "hi";;
- : string = "hi"
```

It works in the OCaml 5 toplevel itself:

$ ocaml
OCaml version 5.0.0
Enter #help;; for help.

# let pp f x = Format.fprintf f "[%s]" x;;
val pp : Format.formatter -> string -> unit = <fun>
# #install_printer pp;;
# "hi";;
- : string = [hi]
@Leonidas-from-XIV
Copy link
Collaborator

I first thought it is due to the way we patch the printers in 19095a9 but it seems we only do that < 4.14 so there is something else going on here. Will need to investigate where the Topdirs.printer_type_new comes from.

@patricoferris
Copy link

I seem to be able to get this to work by including compiler-libs.toplevel in the libraries field of the mdx stanza. I'm not quite sure why, maybe something related to ocaml/ocaml#11745 but I'm not sure.

@Octachron
Copy link

The relevant PR for 5.0.0 is probably more ocaml/ocaml#11199: In brief, REPLs that want to install printers need to call Topcommon.load_topdirs_signature () in 5.0.0. Normally, ocaml/ocaml#11745 will solve this issue by removing completely the need to read Topdirs.printer_type_new in 5.1 .

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

No branches or pull requests

4 participants