فهرست منبع

consider abstract field type parameters when inlining

Simon Krajewski 12 سال پیش
والد
کامیت
f2abbe321d
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      codegen.ml
  2. 1 1
      typer.ml

+ 1 - 1
codegen.ml

@@ -1328,7 +1328,7 @@ let handle_abstract_casts ctx e =
 		in
 		(match cf.cf_expr with
 		| Some { eexpr = TFunction fd } when cf.cf_kind = Method MethInline ->
-			let config = if Meta.has Meta.Impl cf.cf_meta then (Some (a.a_types <> [], apply_params a.a_types pl)) else None in
+			let config = if Meta.has Meta.Impl cf.cf_meta then (Some (a.a_types <> [] || cf.cf_params <> [], fun t -> apply_params a.a_types pl (monomorphs cf.cf_params t))) else None in
 			(match Optimizer.type_inline ctx cf fd ethis args t config p true with
 				| Some e -> e
 				| None ->

+ 1 - 1
typer.ml

@@ -574,7 +574,7 @@ let make_call ctx e params t p =
 			| Some ({cl_kind = KAbstractImpl _ }) when Meta.has Meta.Impl f.cf_meta ->
 				(match if fname = "_new" then t else follow (List.hd params).etype with
 					| TAbstract(a,pl) ->
-						Some (a.a_types <> [], apply_params a.a_types pl)
+						Some (a.a_types <> [] || f.cf_params <> [], fun t -> apply_params a.a_types pl (monomorphs f.cf_params t))
 					| _ ->
 						None);
 			| _ ->