From 5ef071bbbc54eb144876badcbaaa97f02463930e Mon Sep 17 00:00:00 2001 From: Tim-ats-d Date: Thu, 20 Nov 2025 17:05:00 +0100 Subject: [PATCH 1/2] Add a test reproducing the issue #1983. --- tests/test-dirs/document/issue1983.t | 107 +++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 tests/test-dirs/document/issue1983.t diff --git a/tests/test-dirs/document/issue1983.t b/tests/test-dirs/document/issue1983.t new file mode 100644 index 0000000000..56e37a9a2e --- /dev/null +++ b/tests/test-dirs/document/issue1983.t @@ -0,0 +1,107 @@ +The "document" command sometimes concatenates documentation for consecutive entries of variants or records. + + $ document_pos () { + > pos="$1" + > ocamlmerlin single document -position "$pos" < test.ml | jq .value -r + > } + + $ cat > test.ml < type variant = + > | A (** A *) + > | B (** B *) + > | C (** C *) + > + > type record = + > { e : int (** e *) + > ; f : int (** f *) + > ; g : int (** g *) + > } + > + > let _ = A, B, C + > let _f x = x.e, x.f, x.g + > EOF + +Get doc for A +FIXME: this should just be "A" + $ document_pos 12:9 + A + B + +Get doc for B +FIXME: this should just be "B" + $ document_pos 12:12 + B + C + +Get doc for C + $ document_pos 12:15 + C + +Get doc for e +FIXME: this should just be "e" + $ document_pos 13:14 + e + f + +Get doc for f +FIXME: this should just be "f" + $ document_pos 13:19 + e + f + g + +Get doc for g +FIXME: this should just be "g" + $ document_pos 13:24 + f + g + + $ cat > test.ml < type variant = + > | A + > (** A *) + > | B + > (** B *) + > | C + > (** C *) + > + > type record = + > { e : int + > (** e *) + > ; f : int + > (** f *) + > ; g : int + > (** g *) + > } + > + > let _ = A, B, C + > let _f x = x.e, x.f, x.g + > EOF + +Get doc for A + $ document_pos 18:9 + A + +Get doc for B + $ document_pos 18:12 + B + +Get doc for C + $ document_pos 18:15 + C + +Get doc for e + $ document_pos 19:14 + e + +Get doc for f +FIXME: this should just be "f" + $ document_pos 19:19 + e + f + +Get doc for g +FIXME: this should just be "g" + $ document_pos 19:24 + f + g From 20b8f673ad1b1a65c0cbc9196d45d7cd7882d49c Mon Sep 17 00:00:00 2001 From: Tim-ats-d Date: Thu, 20 Nov 2025 17:09:55 +0100 Subject: [PATCH 2/2] Add a changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index a1b98ec3db..b67f2ac40c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ unreleased + test suite - Add a test to ensure the behavior showed in issue #1517 is no longer relevant (#1995) - Add a test to ensure the code fragment exhibited in issue #1118 no longer makes Merlin crash (#1996) + - Add a test reproducing issue #1983 where `document` command which sometime concatenates consecutive variants and labels (#2005) merlin 5.6 ==========