瀏覽代碼

fixed function printing

Nicolas Cannasse 16 年之前
父節點
當前提交
8f58b08cdd
共有 1 個文件被更改,包括 12 次插入3 次删除
  1. 12 3
      type.ml

+ 12 - 3
type.ml

@@ -268,9 +268,18 @@ let rec s_type ctx t =
 
 
 and s_fun ctx t void =
 and s_fun ctx t void =
 	match t with
 	match t with
-	| TFun _ -> "(" ^ s_type ctx t ^ ")"
-	| TEnum ({ e_path = ([],"Void") },[]) when void -> "(" ^ s_type ctx t ^ ")"
-	| _ -> s_type ctx t
+	| TFun _ ->
+		"(" ^ s_type ctx t ^ ")"
+	| TEnum ({ e_path = ([],"Void") },[]) when void ->
+		"(" ^ s_type ctx t ^ ")"
+	| TMono r ->
+		(match !r with
+		| None -> s_type ctx t
+		| Some t -> s_fun ctx t void)
+	| TLazy f ->
+		s_fun ctx (!f()) void
+	| _ ->
+		s_type ctx t
 
 
 and s_type_params ctx = function
 and s_type_params ctx = function
 	| [] -> ""
 	| [] -> ""