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

Crash on open of ascription with manifest type #1066

Closed
lukemaurer opened this issue Dec 18, 2023 · 2 comments
Closed

Crash on open of ascription with manifest type #1066

lukemaurer opened this issue Dec 18, 2023 · 2 comments

Comments

@lukemaurer
Copy link
Contributor

The following crashes odoc master:

module M = struct
  type t = A
end

module type S = sig
  type t = A
end

open (M : S)

The crucial bits here are that the open expression itself contains an ascription (no crash if we bind M : S to another name and open that name instead) and the ascribed module type has a manifest type in it (re-exported or otherwise). The module type can have any form so long as it evaluates to a signature with a manifest type as a member (so, in fact, the single line open (Unit : module type of Unit) suffices).

The crash happens in Cmi.read_constructor_declaration (note that we're loading from .cmt rather than .cmi; in fact, there's no crash if you start from the .cmi instead):

$ ocamlc -c module_subst_with_manifest_type3.ml -bin-annot
$ _build/install/default/bin/odoc compile module_subst_with_manifest_type3.cmt
odoc: internal error, uncaught exception:
      Not_found
      Raised at Ident.find_same in file "typing/ident.ml", line 253, characters 6-21
      Called from Odoc_loader__Cmi.read_constructor_declaration in file "src/loader/cmi.ml", line 630, characters 11-61
      Called from Stdlib__list.map in file "list.ml", line 92, characters 20-23
      Called from Odoc_loader__Cmi.read_type_kind.(fun) in file "src/loader/cmi.ml", line 649, characters 10-66
      Called from Odoc_loader__Cmi.read_type_declaration in file "src/loader/cmi.ml", line 716, characters 23-86
      Called from Odoc_loader__Cmi.read_signature_noenv.loop in file "src/loader/cmi.ml", line 1006, characters 19-59
      Called from Odoc_loader__Cmt.read_open in file "src/loader/cmt.ml", line 572, characters 21-96
      Called from Odoc_loader__Cmt.read_structure_item in file "src/loader/cmt.ml", line 520, characters 14-38
      Called from Odoc_loader__Cmt.read_structure.(fun) in file "src/loader/cmt.ml", line 592, characters 24-61
      Called from Stdlib__list.fold_left in file "list.ml", line 121, characters 24-34
      Called from Odoc_loader__Cmt.read_structure in file "src/loader/cmt.ml", line 590, characters 4-127
      Called from Odoc_loader__Cmt.read_implementation in file "src/loader/cmt.ml", line 605, characters 4-79
      Called from Odoc_loader.read_cmt in file "src/loader/odoc_loader.ml", line 170, characters 34-74
      Called from Odoc_loader.wrap_errors.(fun) in file "src/loader/odoc_loader.ml", line 193, characters 10-14
      Called from Odoc_model__Error.catch in file "src/model/error.ml", line 54, characters 21-27
      Called from Odoc_model__Error.catch_warnings.(fun) in file "src/model/error.ml", line 89, characters 18-22
      Called from Odoc_model__Error.with_ref in file "src/model/error.ml", line 67, characters 12-16
      Re-raised at Odoc_model__Error.with_ref in file "src/model/error.ml", line 72, characters 4-11
      Called from Odoc_odoc__Compile.resolve_and_substitute in file "src/odoc/compile.ml", line 111, characters 8-101
      Called from Odoc_model__Error.catch in file "src/model/error.ml", line 54, characters 21-27
      Called from Odoc_model__Error.catch_warnings.(fun) in file "src/model/error.ml", line 89, characters 18-22
      Called from Odoc_model__Error.with_ref in file "src/model/error.ml", line 67, characters 12-16
      Re-raised at Odoc_model__Error.with_ref in file "src/model/error.ml", line 72, characters 4-11
      Called from Odoc_odoc__Compile.compile.(fun) in file "src/odoc/compile.ml", line 298, characters 6-199
      Called from Dune__exe__Main.Compile.compile.(fun) in file "src/odoc/bin/main.ml", line 222, characters 4-147
      Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 24, characters 19-24
      Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 22, characters 12-19
      Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 34, characters 37-44
jonludlam added a commit to jonludlam/odoc that referenced this issue Dec 19, 2023
@c-cube
Copy link

c-cube commented Jan 19, 2024

I have a similar issue on ocaml-trace at ecf51ce32b4a6fdc038383c1f8b0910055ee7e35 with odoc 2.4. Not sure if it's the same trigger but it looks like the same error:

$ dune build @doc 
…
File "src/fuchsia/write/.trace_fuchsia_write.objs/byte/_unknown_", line 1, characters 0-0:
odoc: internal error, uncaught exception:
      Not_found
      Raised at Ident.find_same in file "typing/ident.ml", line 266, characters 6-21
      Called from Odoc_loader__Ident_env.find_exception_identifier in file "src/loader/ident_env.cppo.ml" (inlined), line 654, characters 2-35
      Called from Odoc_loader__Cmi.read_exception in file "src/loader/cmi.ml", line 775, characters 11-47
      Called from Odoc_loader__Cmi.read_signature_noenv.loop in file "src/loader/cmi.ml", line 1028, characters 18-50
      Called from Odoc_loader__Cmt.read_open in file "src/loader/cmt.ml", line 572, characters 21-96
      Called from Odoc_loader__Cmt.read_structure_item in file "src/loader/cmt.ml", line 520, characters 14-38
      Called from Odoc_loader__Cmt.read_structure.(fun) in file "src/loader/cmt.ml", line 592, characters 24-61
      Called from Stdlib__List.fold_left in file "list.ml", line 123, characters 24-34
      Called from Odoc_loader__Cmt.read_structure in file "src/loader/cmt.ml", line 590, characters 4-127
      Called from Odoc_loader__Cmt.read_implementation in file "src/loader/cmt.ml", line 605, characters 4-79
      Called from Odoc_loader.read_cmt in file "src/loader/odoc_loader.ml", line 169, characters 34-74
      Called from Odoc_loader.wrap_errors.(fun) in file "src/loader/odoc_loader.ml", line 192, characters 10-14
      Called from Odoc_model__Error.catch in file "src/model/error.ml", line 54, characters 21-27
      Called from Odoc_model__Error.catch_warnings.(fun) in file "src/model/error.ml", line 89, characters 18-22
      Called from Odoc_model__Error.with_ref in file "src/model/error.ml", line 67, characters 12-16
      Re-raised at Odoc_model__Error.with_ref in file "src/model/error.ml", line 72, characters 4-11
      Called from Odoc_odoc__Compile.resolve_and_substitute in file "src/odoc/compile.ml", line 111, characters 8-72
      Called from Odoc_model__Error.catch in file "src/model/error.ml", line 54, characters 21-27
      Called from Odoc_model__Error.catch_warnings.(fun) in file "src/model/error.ml", line 89, characters 18-22
      Called from Odoc_model__Error.with_ref in file "src/model/error.ml", line 67, characters 12-16
      Re-raised at Odoc_model__Error.with_ref in file "src/model/error.ml", line 72, characters 4-11
      Called from Odoc_odoc__Compile.compile.(fun) in file "src/odoc/compile.ml", line 297, characters 6-180
      Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 24, characters 19-24
      Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 22, characters 12-19
      Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 34, characters 37-44

jonludlam added a commit to jonludlam/odoc that referenced this issue Feb 8, 2024
jonludlam added a commit to jonludlam/odoc that referenced this issue Feb 9, 2024
@jonludlam
Copy link
Member

Should be fixed by #1082

jonludlam added a commit to jonludlam/odoc that referenced this issue Mar 27, 2024
This is related to issue ocaml#1066, which was partially fixed by ocaml#1082. This PR
sorts the remaining two instances of the problem: exceptions and type
extensions.

Fixes ocaml#1095
jonludlam added a commit to jonludlam/odoc that referenced this issue Mar 27, 2024
This is related to issue ocaml#1066, which was partially fixed by ocaml#1082. This PR
sorts the remaining two instances of the problem: exceptions and type
extensions.

Fixes ocaml#1095
jonludlam added a commit to jonludlam/odoc that referenced this issue Mar 28, 2024
This is related to issue ocaml#1066, which was partially fixed by ocaml#1082. This PR
sorts the remaining two instances of the problem: exceptions and type
extensions.

Fixes ocaml#1095
jonludlam added a commit to jonludlam/odoc that referenced this issue Mar 28, 2024
This is related to issue ocaml#1066, which was partially fixed by ocaml#1082. This PR
sorts the remaining two instances of the problem: exceptions and type
extensions.

Fixes ocaml#1095
jonludlam added a commit to jonludlam/odoc that referenced this issue Mar 28, 2024
This is related to issue ocaml#1066, which was partially fixed by ocaml#1082. This PR
sorts the remaining two instances of the problem: exceptions and type
extensions.

Fixes ocaml#1095
jonludlam added a commit that referenced this issue Apr 17, 2024
This is related to issue #1066, which was partially fixed by #1082. This PR
sorts the remaining two instances of the problem: exceptions and type
extensions.

Fixes #1095
jonludlam added a commit to jonludlam/odoc that referenced this issue Apr 29, 2024
This is related to issue ocaml#1066, which was partially fixed by ocaml#1082. This PR
sorts the remaining two instances of the problem: exceptions and type
extensions.

Fixes ocaml#1095
jonludlam added a commit that referenced this issue Apr 29, 2024
This is related to issue #1066, which was partially fixed by #1082. This PR
sorts the remaining two instances of the problem: exceptions and type
extensions.

Fixes #1095
jonludlam added a commit to jonludlam/opam-repository that referenced this issue Apr 29, 2024
CHANGES:

### Added

- OCaml 5.2.0 compatibility (@Octachron, ocaml/odoc#1094, ocaml/odoc#1112)

### Fixed

- Fix issues ocaml/odoc#1066 and ocaml/odoc#1095 with extended opens (@jonludlam, ocaml/odoc#1082, ocaml/odoc#1100)
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

3 participants