Merge pull request #9831 from yallop/short-paths-show-fix

Fix #show with -short-paths
master
Florian Angeletti 2020-08-06 10:44:20 +02:00 committed by GitHub
commit b73b8a3299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 11 deletions

View File

@ -10,19 +10,19 @@ type t = T of t;;
type t = T of t
|}]
#show t;;
(* this output is CORRECT, it does not use nonrec *)
(* this output is INCORRECT, it should not use nonrec *)
[%%expect{|
type t = T of t
type nonrec t = T of t
|}];;
type nonrec t = Foo of t;;
type nonrec s = Foo of t;;
[%%expect{|
type nonrec t = Foo of t
type nonrec s = Foo of t
|}];;
#show t;;
(* this output in INCORRECT, it should use nonrec *)
#show s;;
(* this output is CORRECT, it uses nonrec *)
[%%expect{|
type t = Foo of t
type nonrec s = Foo of t
|}];;

View File

@ -40,7 +40,7 @@ type 'a option = None | Some of 'a
#show option;;
[%%expect {|
type 'a option = None | Some of 'a
type nonrec 'a option = None | Some of 'a
|}];;
#show Open_binary;;
@ -59,7 +59,7 @@ type Stdlib.open_flag =
#show open_flag;;
[%%expect {|
type open_flag =
type nonrec open_flag =
Open_rdonly
| Open_wronly
| Open_append
@ -90,7 +90,7 @@ type extensible += B of int
#show extensible;;
[%%expect {|
type extensible = ..
type nonrec extensible = ..
|}];;
type 'a t = ..;;

View File

@ -0,0 +1,19 @@
(* TEST
flags = " -short-paths "
* expect
*)
(* This is currently just a regression test for the bug
reported here: https://github.com/ocaml/ocaml/issues/9828 *)
#show list;;
[%%expect {|
type nonrec 'a list = [] | (::) of 'a * 'a list
|}];;
type 'a t;;
#show t;;
[%%expect {|
type 'a t
type nonrec 'a t
|}];;

View File

@ -556,7 +556,7 @@ let () =
reg_show_prim "show_type"
(fun env loc id lid ->
let _path, desc = Env.lookup_type ~loc lid env in
[ Sig_type (id, desc, Trec_first, Exported) ]
[ Sig_type (id, desc, Trec_not, Exported) ]
)
"Print the signature of the corresponding type constructor."