@@ -812,14 +812,28 @@ module Full = struct
812812 (* Prints a decl_ty. If there isn't enough fuel, the type is omitted. Each
813813 recursive call to print a type depletes the fuel by one. *)
814814 let rec decl_ty ~fuel :
815- _ -> _ -> _ -> verbose_fun :bool -> decl_ty -> Fuel.t * Doc.t =
816- fun to_doc st penv ~verbose_fun x ->
817- Fuel. provide fuel (decl_ty_ to_doc st penv ~verbose_fun (get_node x))
815+ _ ->
816+ _ ->
817+ _ ->
818+ verbose_fun :bool ->
819+ omit_likes :bool ->
820+ decl_ty ->
821+ Fuel. t * Doc. t =
822+ fun to_doc st penv ~verbose_fun ~omit_likes x ->
823+ Fuel. provide
824+ fuel
825+ (decl_ty_ to_doc st penv ~verbose_fun ~omit_likes (get_node x))
818826
819827 and decl_ty_ ~fuel :
820- _ -> _ -> _ -> verbose_fun :bool -> decl_phase ty_ -> Fuel.t * Doc.t =
821- fun to_doc st penv ~verbose_fun x ->
822- let ty = decl_ty ~verbose_fun in
828+ _ ->
829+ _ ->
830+ _ ->
831+ verbose_fun :bool ->
832+ omit_likes :bool ->
833+ decl_phase ty_ ->
834+ Fuel. t * Doc. t =
835+ fun to_doc st penv ~verbose_fun ~omit_likes x ->
836+ let ty = decl_ty ~verbose_fun ~omit_likes in
823837 let k ~fuel x = ty ~fuel to_doc st penv x in
824838 match x with
825839 | Tany _ -> (fuel, text " _" )
@@ -845,7 +859,12 @@ module Full = struct
845859 (fuel, option_doc)
846860 | Tlike x ->
847861 let (fuel, ty_doc) = k ~fuel x in
848- let like_doc = Concat [text " ~" ; ty_doc] in
862+ let like_doc =
863+ if omit_likes then
864+ ty_doc
865+ else
866+ Concat [text " ~" ; ty_doc]
867+ in
849868 (fuel, like_doc)
850869 | Tprim x -> (fuel, tprim x)
851870 | Tfun ft ->
@@ -857,7 +876,7 @@ module Full = struct
857876 penv
858877 ~verbose: verbose_fun
859878 ft
860- (fun_decl_implicit_params ~verbose_fun )
879+ (fun_decl_implicit_params ~verbose_fun ~omit_likes )
861880 | Tapply ((_, n), [ty])
862881 when String. equal n SN.Classes. cSupportDyn
863882 && not (show_supportdyn_penv penv) ->
@@ -900,9 +919,9 @@ module Full = struct
900919 let class_ptr_doc = Concat [text " class<" ; ty_doc; text " >" ] in
901920 (fuel, class_ptr_doc)
902921
903- and fun_decl_implicit_params ~fuel ~verbose_fun =
922+ and fun_decl_implicit_params ~fuel ~verbose_fun ~ omit_likes =
904923 fun_implicit_params
905- (decl_ty ~verbose_fun )
924+ (decl_ty ~verbose_fun ~omit_likes )
906925 (Typing_make_type. default_capability_decl Pos_or_decl. none)
907926 ~fuel
908927
@@ -1456,7 +1475,7 @@ module Full = struct
14561475 to_string ~fuel ~ty text_strip_ns env x
14571476
14581477 let to_string_decl ~fuel (x : decl_ty ) =
1459- let ty = decl_ty ~verbose_fun: false in
1478+ let ty = decl_ty ~verbose_fun: false ~omit_likes: false in
14601479 to_string ~fuel ~ty Doc. text Declenv x
14611480
14621481 (* * For functions and methods, interpret supportdyn as use of <<__SupportDynamicType>> attribute *)
@@ -1620,12 +1639,13 @@ module Full = struct
16201639 definition_opt
16211640
16221641 let to_string_decl_with_identity
1623- ~fuel ~verbose_fun env (x : decl_ty ) occurrence definition_opt =
1642+ ~fuel ~verbose_fun ~omit_likes env (x : decl_ty ) occurrence definition_opt
1643+ =
16241644 to_string_with_identity
16251645 ~fuel
16261646 env
16271647 x
1628- (decl_ty ~verbose_fun )
1648+ (decl_ty ~verbose_fun ~omit_likes )
16291649 ~default_capability:
16301650 (Typing_make_type. default_capability_decl Pos_or_decl. none)
16311651 ~constraints: Nothing
@@ -1903,7 +1923,10 @@ let full_strip_ns_decl ?(msg = true) ~verbose_fun env ty =
19031923 supply_fuel
19041924 ~msg
19051925 env.genv.tcopt
1906- (Full. to_string_strip_ns ~ty: (Full. decl_ty ~verbose_fun ) (Loclenv env) ty)
1926+ (Full. to_string_strip_ns
1927+ ~ty: (Full. decl_ty ~verbose_fun ~omit_likes: false )
1928+ (Loclenv env)
1929+ ty)
19071930
19081931let full_with_identity ~hide_internals env x occurrence definition_opt =
19091932 supply_fuel
@@ -1915,11 +1938,13 @@ let full_with_identity ~hide_internals env x occurrence definition_opt =
19151938 occurrence
19161939 definition_opt)
19171940
1918- let full_decl_with_identity env ~verbose_fun x occurrence definition_opt =
1941+ let full_decl_with_identity
1942+ env ~omit_likes ~verbose_fun x occurrence definition_opt =
19191943 supply_fuel
19201944 env.genv.tcopt
19211945 (Full. to_string_decl_with_identity
19221946 ~verbose_fun
1947+ ~omit_likes
19231948 env
19241949 x
19251950 occurrence
0 commit comments