summaryrefslogtreecommitdiff
path: root/compiler/PrintPure.ml
diff options
context:
space:
mode:
authorSon Ho2023-08-31 16:56:26 +0200
committerSon Ho2023-08-31 16:56:26 +0200
commit33bb0b7dbdf5cce28b58793e5fb280668a644525 (patch)
tree673827d161034d02576a15c431e51187dd29b722 /compiler/PrintPure.ml
parent6f22190cba92a44b6c74bfcce8f5ed142a68e195 (diff)
Finish updating SymbolicToPure.ml
Diffstat (limited to 'compiler/PrintPure.ml')
-rw-r--r--compiler/PrintPure.ml13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/PrintPure.ml b/compiler/PrintPure.ml
index 724f1e0a..41f1e3dd 100644
--- a/compiler/PrintPure.ml
+++ b/compiler/PrintPure.ml
@@ -251,6 +251,15 @@ let rec ty_to_string (fmt : type_formatter) (inside : bool) (ty : ty) : string =
ty_to_string fmt true arg_ty ^ " -> " ^ ty_to_string fmt false ret_ty
in
if inside then "(" ^ ty ^ ")" else ty
+ | TraitType (trait_ref, generics, type_name) ->
+ let trait_ref = trait_ref_to_string fmt false trait_ref in
+ let s =
+ if generics = empty_generic_args then trait_ref ^ "::" ^ type_name
+ else
+ let generics = generic_args_to_string fmt generics in
+ "(" ^ trait_ref ^ " " ^ generics ^ ")::" ^ type_name
+ in
+ if inside then "(" ^ s ^ ")" else s
and generic_args_to_strings (fmt : type_formatter) (inside : bool)
(generics : generic_args) : string list =
@@ -567,10 +576,10 @@ let rec typed_pattern_to_string (fmt : ast_formatter) (v : typed_pattern) :
let fun_sig_to_string (fmt : ast_formatter) (sg : fun_sig) : string =
let ty_fmt = ast_to_type_formatter fmt in
- let type_params = List.map type_var_to_string sg.type_params in
+ let generics = generic_params_to_strings ty_fmt sg.generics in
let inputs = List.map (ty_to_string ty_fmt false) sg.inputs in
let output = ty_to_string ty_fmt false sg.output in
- let all_types = List.concat [ type_params; inputs; [ output ] ] in
+ let all_types = List.concat [ generics; inputs; [ output ] ] in
String.concat " -> " all_types
let inst_fun_sig_to_string (fmt : ast_formatter) (sg : inst_fun_sig) : string =