|
@@ -186,9 +186,11 @@ let rec s_type ctx t =
|
|
| TInst (c,tl) ->
|
|
| TInst (c,tl) ->
|
|
Ast.s_type_path c.cl_path ^ s_type_params ctx tl
|
|
Ast.s_type_path c.cl_path ^ s_type_params ctx tl
|
|
| TFun ([],t) ->
|
|
| TFun ([],t) ->
|
|
- "Void -> " ^ s_type ctx t
|
|
|
|
|
|
+ "Void -> " ^ s_fun ctx t false
|
|
| TFun (l,t) ->
|
|
| TFun (l,t) ->
|
|
- String.concat " -> " (List.map (fun (s,t) -> (if s = "" then "" else s ^ " : ") ^ match t with TFun _ -> "(" ^ s_type ctx t ^ ")" | _ -> s_type ctx t) l) ^ " -> " ^ s_type ctx t
|
|
|
|
|
|
+ String.concat " -> " (List.map (fun (s,t) ->
|
|
|
|
+ (if s = "" then "" else s ^ " : ") ^ s_fun ctx t true
|
|
|
|
+ ) l) ^ " -> " ^ s_fun ctx t false
|
|
| TAnon (fl,name) ->
|
|
| TAnon (fl,name) ->
|
|
(match name with
|
|
(match name with
|
|
| Some s -> s
|
|
| Some s -> s
|
|
@@ -200,6 +202,12 @@ let rec s_type ctx t =
|
|
| TLazy f ->
|
|
| TLazy f ->
|
|
s_type ctx (!f())
|
|
s_type ctx (!f())
|
|
|
|
|
|
|
|
+and s_fun ctx t void =
|
|
|
|
+ match t with
|
|
|
|
+ | TFun _ -> "(" ^ s_type ctx t ^ ")"
|
|
|
|
+ | TEnum ({ e_path = ([],"Void") },[]) when void -> "(" ^ s_type ctx t ^ ")"
|
|
|
|
+ | _ -> s_type ctx t
|
|
|
|
+
|
|
and s_type_params ctx = function
|
|
and s_type_params ctx = function
|
|
| [] -> ""
|
|
| [] -> ""
|
|
| l -> "<" ^ String.concat ", " (List.map (s_type ctx) l) ^ ">"
|
|
| l -> "<" ^ String.concat ", " (List.map (s_type ctx) l) ^ ">"
|