瀏覽代碼

handle abstracts in EFunction (fixed issue #1689)

Simon Krajewski 12 年之前
父節點
當前提交
0c27980048
共有 1 個文件被更改,包括 13 次插入8 次删除
  1. 13 8
      typer.ml

+ 13 - 8
typer.ml

@@ -2721,14 +2721,19 @@ and type_expr ctx (e,p) (with_type:with_type) =
 		) f.f_args in
 		(match with_type with
 		| WithType t | WithTypeResume t ->
-			(match follow t with
-			| TFun (args2,_) when List.length args2 = List.length args ->
-				List.iter2 (fun (_,_,t1) (_,_,t2) ->
-					match follow t1 with
-					| TMono _ -> unify ctx t2 t1 p
-					| _ -> ()
-				) args args2;
-			| _ -> ())
+			let rec loop t =
+				(match follow t with
+				| TFun (args2,_) when List.length args2 = List.length args ->
+					List.iter2 (fun (_,_,t1) (_,_,t2) ->
+						match follow t1 with
+						| TMono _ -> unify ctx t2 t1 p
+						| _ -> ()
+					) args args2;
+				| TAbstract({a_this = ta} as a,tl) ->
+					loop (apply_params a.a_types tl ta)
+				| _ -> ())
+			in
+			loop t
 		| _ ->
 			());
 		let ft = TFun (fun_args args,rt) in