Sfoglia il codice sorgente

handle abstracts in EFunction (fixed issue #1689)

Simon Krajewski 12 anni fa
parent
commit
0c27980048
1 ha cambiato i file con 13 aggiunte e 8 eliminazioni
  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
 		) f.f_args in
 		(match with_type with
 		(match with_type with
 		| WithType t | WithTypeResume t ->
 		| 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
 		let ft = TFun (fun_args args,rt) in