From f7ec223df9c9c4871040251fb1f558e0876d379a Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Sat, 9 May 2020 08:43:23 +0200 Subject: [PATCH] add a known-bug test for buggy 'rec' (non)use in the #show command --- .../known-bugs/broken_rec_in_show.ml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 testsuite/tests/tool-toplevel/known-bugs/broken_rec_in_show.ml diff --git a/testsuite/tests/tool-toplevel/known-bugs/broken_rec_in_show.ml b/testsuite/tests/tool-toplevel/known-bugs/broken_rec_in_show.ml new file mode 100644 index 000000000..255c4d10c --- /dev/null +++ b/testsuite/tests/tool-toplevel/known-bugs/broken_rec_in_show.ml @@ -0,0 +1,47 @@ +(* TEST + * expect +*) + +(* This is a known-bug file for use of 'rec' by the '#show' command, + to record known regressions from #7453 and #9094 *) + +type t = T of t;; +[%%expect{| +type t = T of t +|}] +#show t;; +(* this output is CORRECT, it does not use nonrec *) +[%%expect{| +type t = T of t +|}];; + +type nonrec t = Foo of t;; +[%%expect{| +type nonrec t = Foo of t +|}];; +#show t;; +(* this output in INCORRECT, it should use nonrec *) +[%%expect{| +type t = Foo of t +|}];; + + + +module M : sig type t val x : t end = struct type t = int let x = 0 end;; +[%%expect{| +module M : sig type t val x : t end +|}];; +(* this output is CORRECT, it does not use 'rec' *) +[%%expect{| +|}];; + +module rec M : sig type t val x : M.t end = struct type t = int let x = 0 end;; +(* this output is strange, it is surprising to use M/2 here. *) +[%%expect{| +module rec M : sig type t val x : M/2.t end +|}];; +#show_module M;; +(* this output is INCORRECT, it should use 'rec' *) +[%%expect{| +module M : sig type t val x : M.t end +|}];;