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 when substituting for the same name at different arities #930

Open
lukemaurer opened this issue Feb 17, 2023 · 3 comments
Open

Crash when substituting for the same name at different arities #930

lukemaurer opened this issue Feb 17, 2023 · 3 comments

Comments

@lukemaurer
Copy link
Contributor

lukemaurer commented Feb 17, 2023

The MWE is highly suggestive of what's going on:

module type S1 = sig
  type t0
  type 'a t := unit

  val x : t0 t
end

module type S2 = sig
  type t (* must be the same name as [S1.t] *)

  include S1 with type t0 := t
end

module type S3 = sig
  type t1

  include S2 with type t := t1
end

The result is an Invalid_argument out of List.fold_left2, caused by a length mismatch between the parameter list and the argument list.

$ ocamlc -c test.mli -bin-annot
$ _build/install/default/bin/odoc compile test.cmti
  odoc: internal error, uncaught exception:
      Invalid_argument("List.fold_left2")
      Raised at Stdlib.invalid_arg in file "stdlib.ml", line 33, characters 20-45
      Called from Odoc_xref2__Subst.type_expr in file "subst.ml", line 598, characters 21-59
      Called from Odoc_xref2__Subst.value in file "subst.ml" (inlined), line 842, characters 19-38
      Called from Odoc_xref2__Subst.apply_sig_map.inner.(fun) in file "subst.ml", line 1089, characters 19-52
      Called from Odoc_xref2__Component.Delayed.get in file "component.ml" (inlined), line 55, characters 16-22
      Called from Odoc_xref2__Lang_of.signature_items.inner in file "lang_of.ml", line 438, characters 16-39
      Called from Odoc_xref2__Lang_of.signature in file "lang_of.ml" (inlined), line 466, characters 12-43
      Called from Odoc_xref2__Lang_of.include_ in file "lang_of.ml", line 641, characters 18-69
      ...
@gpetiot
Copy link
Contributor

gpetiot commented Oct 16, 2023

I cannot reproduce this with the master version, do you still observe this bug with the last odoc build?

@lukemaurer
Copy link
Contributor Author

I cannot reproduce this with the master version, do you still observe this bug with the last odoc build?

I do. Notably, I only get it when going through a .cmti, though. I'll update with more specific instructions.

panglesd added a commit to panglesd/odoc that referenced this issue Apr 19, 2024
Signed-off-by: Paul-Elliot <peada@free.fr>
panglesd added a commit to panglesd/odoc that referenced this issue Apr 19, 2024
Signed-off-by: Paul-Elliot <peada@free.fr>
@panglesd
Copy link
Collaborator

I made a repro at https://github.com/panglesd/odoc/tree/fix-930.

I think .cmigives odoc module type whose values are "already computed" by the compiler, hence the fact that there is no issue.

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