From 523b6f50d0419acea965e3602058a9ab390bce10 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Thu, 25 Feb 2021 02:36:32 +0000 Subject: [PATCH] Add a test for #587 Signed-off-by: Jon Ludlam --- test/xref2/dune | 7 ++++ test/xref2/v408_and_above/dune | 4 +++ .../github_issue_587.t/a_intf.ml | 7 ++++ .../v408_and_above/github_issue_587.t/b.mli | 1 + .../github_issue_587.t/b_intf.ml | 13 ++++++++ .../github_issue_587.t/build.sh | 19 +++++++++++ .../v408_and_above/github_issue_587.t/c.mli | 1 + .../github_issue_587.t/odoc_bug__.ml | 3 ++ .../v408_and_above/github_issue_587.t/run.t | 32 +++++++++++++++++++ 9 files changed, 87 insertions(+) create mode 100644 test/xref2/v408_and_above/dune create mode 100644 test/xref2/v408_and_above/github_issue_587.t/a_intf.ml create mode 100644 test/xref2/v408_and_above/github_issue_587.t/b.mli create mode 100644 test/xref2/v408_and_above/github_issue_587.t/b_intf.ml create mode 100755 test/xref2/v408_and_above/github_issue_587.t/build.sh create mode 100644 test/xref2/v408_and_above/github_issue_587.t/c.mli create mode 100644 test/xref2/v408_and_above/github_issue_587.t/odoc_bug__.ml create mode 100644 test/xref2/v408_and_above/github_issue_587.t/run.t diff --git a/test/xref2/dune b/test/xref2/dune index 3169320f2f..3cb9fbcf8f 100644 --- a/test/xref2/dune +++ b/test/xref2/dune @@ -13,3 +13,10 @@ (cram (deps %{bin:odoc} %{bin:odoc_print} %{bin:compile})) + +(subdir + v408_and_above + (cram + (enabled_if + (>= %{ocaml_version} 4.08.0)))) + diff --git a/test/xref2/v408_and_above/dune b/test/xref2/v408_and_above/dune new file mode 100644 index 0000000000..aee459a3c1 --- /dev/null +++ b/test/xref2/v408_and_above/dune @@ -0,0 +1,4 @@ +(cram + (deps %{bin:odoc} %{bin:odoc_print} %{bin:compile})) + + diff --git a/test/xref2/v408_and_above/github_issue_587.t/a_intf.ml b/test/xref2/v408_and_above/github_issue_587.t/a_intf.ml new file mode 100644 index 0000000000..1cefe76e84 --- /dev/null +++ b/test/xref2/v408_and_above/github_issue_587.t/a_intf.ml @@ -0,0 +1,7 @@ +module type S = sig + module Foo : sig end +end + +module type A = sig + module type S = S +end diff --git a/test/xref2/v408_and_above/github_issue_587.t/b.mli b/test/xref2/v408_and_above/github_issue_587.t/b.mli new file mode 100644 index 0000000000..0a3e523a5b --- /dev/null +++ b/test/xref2/v408_and_above/github_issue_587.t/b.mli @@ -0,0 +1 @@ +include B_intf.B diff --git a/test/xref2/v408_and_above/github_issue_587.t/b_intf.ml b/test/xref2/v408_and_above/github_issue_587.t/b_intf.ml new file mode 100644 index 0000000000..ca9552eae4 --- /dev/null +++ b/test/xref2/v408_and_above/github_issue_587.t/b_intf.ml @@ -0,0 +1,13 @@ +module Bar = struct end + +module type S = sig + include A_intf.S + + module Foo : sig end +end + +module type B = sig + module type S = S + + include S +end diff --git a/test/xref2/v408_and_above/github_issue_587.t/build.sh b/test/xref2/v408_and_above/github_issue_587.t/build.sh new file mode 100755 index 0000000000..37cc89caf9 --- /dev/null +++ b/test/xref2/v408_and_above/github_issue_587.t/build.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +OCAMLC=ocamlc +ODOC=odoc + +$OCAMLC -w -49 -no-alias-deps -c odoc_bug__.ml -bin-annot + +for f in a_intf b_intf; do + $OCAMLC -c $f.ml -bin-annot -g -no-alias-deps -open Odoc_bug__ -o odoc_bug__$f +done + +for f in b c; do + $OCAMLC -c -intf $f.mli -bin-annot -no-alias-deps -open Odoc_bug__ -o odoc_bug__$f +done + +for f in .cmt a_intf.cmt b_intf.cmt b.cmti c.cmti; do + odoc compile odoc_bug__$f -I . --pkg odoc_bug +done + diff --git a/test/xref2/v408_and_above/github_issue_587.t/c.mli b/test/xref2/v408_and_above/github_issue_587.t/c.mli new file mode 100644 index 0000000000..37d3d69847 --- /dev/null +++ b/test/xref2/v408_and_above/github_issue_587.t/c.mli @@ -0,0 +1 @@ +include B.S diff --git a/test/xref2/v408_and_above/github_issue_587.t/odoc_bug__.ml b/test/xref2/v408_and_above/github_issue_587.t/odoc_bug__.ml new file mode 100644 index 0000000000..aed21faf3a --- /dev/null +++ b/test/xref2/v408_and_above/github_issue_587.t/odoc_bug__.ml @@ -0,0 +1,3 @@ +module A_intf = Odoc_bug__a_intf +module B = Odoc_bug__b +module B_intf = Odoc_bug__b_intf diff --git a/test/xref2/v408_and_above/github_issue_587.t/run.t b/test/xref2/v408_and_above/github_issue_587.t/run.t new file mode 100644 index 0000000000..723130317d --- /dev/null +++ b/test/xref2/v408_and_above/github_issue_587.t/run.t @@ -0,0 +1,32 @@ +A quick test to repro the issue found in #587 + + $ ./build.sh + odoc: internal error, uncaught exception: + Failure("Error") + Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33 + Called from Odoc_xref2__Subst.rename_bound_idents.new_module_id in file "src/xref2/subst.ml", line 771, characters 13-29 + Called from Odoc_xref2__Subst.rename_bound_idents.(fun) in file "src/xref2/subst.ml", line 809, characters 16-32 + Called from Odoc_xref2__Subst.rename_bound_idents.(fun) in file "src/xref2/subst.ml", line 868, characters 8-69 + Called from Odoc_xref2__Subst.signature in file "src/xref2/subst.ml", line 907, characters 17-50 + Called from Odoc_xref2__Subst.simple_expansion in file "src/xref2/subst.ml", line 503, characters 30-46 + Called from Odoc_xref2__Subst.option_ in file "src/xref2/subst.ml", line 412, characters 51-61 + Called from Odoc_xref2__Subst.module_type_expr in file "src/xref2/subst.ml", line 599, characters 24-62 + Called from Odoc_xref2__Subst.module_type in file "src/xref2/subst.ml", line 509, characters 37-59 + Called from Odoc_xref2__Tools.handle_module_type_lookup.(fun) in file "src/xref2/tools.ml", line 415, characters 13-37 + Called from Odoc_xref2__Tools.resolve_module_type.(fun) in file "src/xref2/tools.ml", line 708, characters 8-68 + Called from Odoc_xref2__Expand_tools.aux_expansion_of_u_module_type_expr in file "src/xref2/expand_tools.ml", line 111, characters 6-61 + Called from Odoc_xref2__Compile.include_.get_expansion in file "src/xref2/compile.ml", line 325, characters 10-66 + Called from Odoc_xref2__Compile.signature_items.(fun) in file "src/xref2/compile.ml", line 240, characters 21-35 + Called from Stdlib__list.fold_left in file "list.ml", line 121, characters 24-34 + Called from Odoc_xref2__Compile.signature_items in file "src/xref2/compile.ml", line 204, characters 4-1023 + Called from Odoc_xref2__Compile.signature in file "src/xref2/compile.ml", line 273, characters 16-46 + Called from Odoc_xref2__Compile.content.(fun) in file "src/xref2/compile.ml", line 66, characters 13-54 + Called from Odoc_xref2__Compile.unit in file "src/xref2/compile.ml", line 59, characters 21-47 + Called from Odoc_xref2__Lookup_failures.catch_failures in file "src/xref2/lookup_failures.ml", line 18, characters 10-14 + Called from Odoc_odoc__Compile.resolve_and_substitute.(fun) in file "src/odoc/compile.ml", line 74, characters 2-37 + Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 25, characters 19-24 + Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 23, characters 12-19 + Called from Cmdliner.Term.run in file "cmdliner.ml", line 117, characters 32-39 + [2] + +