Simon Krajewski 5 роки тому
батько
коміт
7b31375af9

+ 4 - 0
src/typing/calls.ml

@@ -391,6 +391,10 @@ let type_generic_function ctx (e,fa) el ?(using_param=None) with_type p =
 	let el,_ = with_contextual_monos ctx (fun () ->
 		unify_call_args ctx el args ret p false false
 	) in
+	List.iter (fun t -> match follow t with
+		| TMono m -> ignore(safe_mono_close ctx m p)
+		| _ -> ()
+	) monos;
 	let el = match using_param with None -> el | Some e -> e :: el in
 	(try
 		let gctx = Generic.make_generic ctx cf.cf_params monos p in

+ 1 - 3
src/typing/generic.ml

@@ -49,9 +49,7 @@ let make_generic ctx ps pt p =
 				| TAbstract(a,tl) -> (s_type_path_underscore a.a_path) ^ (loop_tl top tl)
 				| _ when not top ->
 					follow_or t top (fun() -> "_") (* allow unknown/incompatible types as type parameters to retain old behavior *)
-				| TMono ({ tm_type = None } as m) ->
-					if safe_mono_close ctx m p then loop top t
-					else raise (Generic_Exception (("Could not determine type for parameter " ^ s), p))
+				| TMono { tm_type = None } -> raise (Generic_Exception (("Could not determine type for parameter " ^ s), p))
 				| TDynamic _ -> "Dynamic"
 				| t ->
 					follow_or t top (fun() -> raise (Generic_Exception (("Unsupported type parameter: " ^ (s_type (print_context()) t) ^ ")"), p)))

+ 3 - 1
tests/misc/projects/Issue4775/compile1-fail.hxml.stderr

@@ -1,2 +1,4 @@
+Main1.hx:7: characters 15-26 : Constraint check failure for Contain.T
 Main1.hx:7: characters 15-26 : Main1 should be String
-Main1.hx:7: characters 15-26 : For function argument 't'
+Main1.hx:7: characters 15-26 : For function argument 't'
+Main1.hx:7: characters 3-27 : Could not determine type for parameter T