Browse Source

unify existing generic specializations with expected function type (fixed issue #1263)

Simon Krajewski 13 năm trước cách đây
mục cha
commit
7f29d059f5
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      typer.ml

+ 3 - 1
typer.ml

@@ -1051,7 +1051,9 @@ let type_generic_function ctx (e,cf) el p =
 		let gctx = Codegen.make_generic ctx cf.cf_params monos p in
 		let name = cf.cf_name ^ "_" ^ gctx.Codegen.name in
 		let cf2 = try
-			PMap.find name (if stat then c.cl_statics else c.cl_fields)
+			let cf2 = PMap.find name (if stat then c.cl_statics else c.cl_fields) in
+			unify ctx cf2.cf_type t cf2.cf_pos;
+			cf2
 		with Not_found ->
 			let cf2 = mk_field name t cf.cf_pos in
 			if stat then begin