瀏覽代碼

fixed type parameter contraint hole.

Nicolas Cannasse 19 年之前
父節點
當前提交
3248cc1308
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      typer.ml

+ 5 - 1
typer.ml

@@ -167,7 +167,11 @@ let rec load_normal_type ctx t p allow_no_params =
 			| TEnumDecl e -> e.e_types , e.e_path , (fun t -> TEnum (e,t))
 			| TEnumDecl e -> e.e_types , e.e_path , (fun t -> TEnum (e,t))
 		in
 		in
 		if allow_no_params && t.tparams = [] then
 		if allow_no_params && t.tparams = [] then
-			f (List.map (fun _ -> mk_mono()) types)
+			f (List.map (fun (name,t) -> 
+				match follow t with
+				| TEnum _ -> mk_mono()
+				| _ -> error ("Type parameter " ^ name ^ " need constraint") p
+			) types)
 		else if path = ([],"Dynamic") then
 		else if path = ([],"Dynamic") then
 			match t.tparams with
 			match t.tparams with
 			| [] -> t_dynamic
 			| [] -> t_dynamic