瀏覽代碼

[typer] fix type parameter resolution related to meta overloads

Simon Krajewski 1 年之前
父節點
當前提交
45f7252bf3
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      src/typing/typeload.ml

+ 4 - 3
src/typing/typeload.ml

@@ -669,8 +669,8 @@ and init_meta_overloads ctx co cf =
 				| [] ->
 					()
 				| l ->
-					ctx.type_params <- List.filter (fun t ->
-						not (List.mem t l) (* TODO: this still looks suspicious *)
+					ctx.type_params <- List.filter (fun ttp ->
+						ttp.ttp_host <> TPHMethod
 					) ctx.type_params
 			end;
 			let params : type_params = (!type_function_params_ref) ctx f TPHMethod cf.cf_name p in
@@ -761,8 +761,9 @@ let rec type_type_param ctx host path get_params p tp =
 		| None ->
 			mk_type_param c host default None
 		| Some th ->
+			let current_type_params = ctx.type_params in
 			let constraints = lazy (
-				let ctx = { ctx with type_params = ctx.type_params @ get_params() } in
+				let ctx = { ctx with type_params = get_params() @ current_type_params } in
 				let rec loop th = match fst th with
 					| CTIntersection tl -> List.map (load_complex_type ctx true) tl
 					| CTParent ct -> loop ct