Browse Source

rename `(cl|en|t|a|mt)_types` to `_params` for consistency

Simon Krajewski 11 years ago
parent
commit
53f0a0c259
20 changed files with 417 additions and 417 deletions
  1. 29 29
      codegen.ml
  2. 1 1
      dce.ml
  3. 1 1
      filters.ml
  4. 3 3
      genas3.ml
  5. 123 123
      gencommon.ml
  6. 9 9
      gencpp.ml
  7. 35 35
      gencs.ml
  8. 12 12
      genjava.ml
  9. 3 3
      genphp.ml
  10. 1 1
      genpy.ml
  11. 1 1
      genswf.ml
  12. 3 3
      genswf9.ml
  13. 9 9
      genxml.ml
  14. 2 2
      interp.ml
  15. 18 18
      matcher.ml
  16. 7 7
      optimizer.ml
  17. 35 35
      type.ml
  18. 1 1
      typecore.ml
  19. 60 60
      typeload.ml
  20. 64 64
      typer.ml

+ 29 - 29
codegen.ml

@@ -191,7 +191,7 @@ let extend_remoting ctx c t p async prot =
 		error ("Module " ^ s_type_path path ^ " does not define type " ^ t.tname) p
 		error ("Module " ^ s_type_path path ^ " does not define type " ^ t.tname) p
 	) in
 	) in
 	match t with
 	match t with
-	| TClassDecl c2 when c2.cl_types = [] -> c2.cl_build(); c.cl_super <- Some (c2,[]);
+	| TClassDecl c2 when c2.cl_params = [] -> c2.cl_build(); c.cl_super <- Some (c2,[]);
 	| _ -> error "Remoting proxy must be a class without parameters" p
 	| _ -> error "Remoting proxy must be a class without parameters" p
 
 
 (* -------------------------------------------------------------------------- *)
 (* -------------------------------------------------------------------------- *)
@@ -301,13 +301,13 @@ let rec build_generic ctx c p tl =
 	if !recurse then begin
 	if !recurse then begin
 		TInst (c,tl) (* build a normal instance *)
 		TInst (c,tl) (* build a normal instance *)
 	end else begin
 	end else begin
-	let gctx = make_generic ctx c.cl_types tl p in
+	let gctx = make_generic ctx c.cl_params tl p in
 	let name = (snd c.cl_path) ^ "_" ^ gctx.name in
 	let name = (snd c.cl_path) ^ "_" ^ gctx.name in
 	try
 	try
 		Typeload.load_instance ctx { tpackage = pack; tname = name; tparams = []; tsub = None } p false
 		Typeload.load_instance ctx { tpackage = pack; tname = name; tparams = []; tsub = None } p false
 	with Error(Module_not_found path,_) when path = (pack,name) ->
 	with Error(Module_not_found path,_) when path = (pack,name) ->
 		let m = (try Hashtbl.find ctx.g.modules (Hashtbl.find ctx.g.types_module c.cl_path) with Not_found -> assert false) in
 		let m = (try Hashtbl.find ctx.g.modules (Hashtbl.find ctx.g.types_module c.cl_path) with Not_found -> assert false) in
-		let ctx = { ctx with m = { ctx.m with module_types = m.m_types @ ctx.m.module_types } } in
+		let ctx = { ctx with m = { ctx.m with module_params = m.m_types @ ctx.m.module_params } } in
 		c.cl_build(); (* make sure the super class is already setup *)
 		c.cl_build(); (* make sure the super class is already setup *)
 		let mg = {
 		let mg = {
 			m_id = alloc_mid();
 			m_id = alloc_mid();
@@ -392,7 +392,7 @@ let rec build_generic ctx c p tl =
 						end;
 						end;
 						t
 						t
 					with Not_found ->
 					with Not_found ->
-						apply_params c.cl_types tl (TInst(cs,pl))
+						apply_params c.cl_params tl (TInst(cs,pl))
 				in
 				in
 				let ts = follow (find_class gctx.subst) in
 				let ts = follow (find_class gctx.subst) in
 				let cs,pl = Typeload.check_extends ctx c ts p in
 				let cs,pl = Typeload.check_extends ctx c ts p in
@@ -604,13 +604,13 @@ let build_instance ctx mtype p =
 			| _ ->
 			| _ ->
 				TInst (c,pl)
 				TInst (c,pl)
 		) in
 		) in
-		c.cl_types , c.cl_path , ft
+		c.cl_params , c.cl_path , ft
 	| TEnumDecl e ->
 	| TEnumDecl e ->
-		e.e_types , e.e_path , (fun t -> TEnum (e,t))
+		e.e_params , e.e_path , (fun t -> TEnum (e,t))
 	| TTypeDecl t ->
 	| TTypeDecl t ->
-		t.t_types , t.t_path , (fun tl -> TType(t,tl))
+		t.t_params , t.t_path , (fun tl -> TType(t,tl))
 	| TAbstractDecl a ->
 	| TAbstractDecl a ->
-		a.a_types, a.a_path, (fun tl -> TAbstract(a,tl))
+		a.a_params, a.a_path, (fun tl -> TAbstract(a,tl))
 
 
 let on_inherit ctx c p h =
 let on_inherit ctx c p h =
 	match h with
 	match h with
@@ -631,7 +631,7 @@ let on_inherit ctx c p h =
 
 
 (* Promotes type parameters of abstracts to their implementation fields *)
 (* Promotes type parameters of abstracts to their implementation fields *)
 let promote_abstract_parameters ctx t = match t with
 let promote_abstract_parameters ctx t = match t with
-	| TClassDecl ({cl_kind = KAbstractImpl a} as c) when a.a_types <> [] ->
+	| TClassDecl ({cl_kind = KAbstractImpl a} as c) when a.a_params <> [] ->
 		List.iter (fun f ->
 		List.iter (fun f ->
 			List.iter (fun (n,t) -> match t with
 			List.iter (fun (n,t) -> match t with
 				| TInst({cl_kind = KTypeParameter _; cl_path=p,n} as cp,[]) when not (List.mem_assoc n f.cf_params) ->
 				| TInst({cl_kind = KTypeParameter _; cl_path=p,n} as cp,[]) when not (List.mem_assoc n f.cf_params) ->
@@ -639,7 +639,7 @@ let promote_abstract_parameters ctx t = match t with
 					f.cf_params <- (n,TInst({cp with cl_path = path},[])) :: f.cf_params
 					f.cf_params <- (n,TInst({cp with cl_path = path},[])) :: f.cf_params
 				| _ ->
 				| _ ->
 					()
 					()
-			) a.a_types;
+			) a.a_params;
 		) c.cl_ordered_statics;
 		) c.cl_ordered_statics;
 	| _ ->
 	| _ ->
 		()
 		()
@@ -690,10 +690,10 @@ module Abstract = struct
 			if Meta.has Meta.CoreType a.a_meta then
 			if Meta.has Meta.CoreType a.a_meta then
 				t_dynamic
 				t_dynamic
 			else
 			else
-				maybe_recurse (apply_params a.a_types pl a.a_this)
+				maybe_recurse (apply_params a.a_params pl a.a_this)
 
 
 	let make_static_call ctx c cf a pl args t p =
 	let make_static_call ctx c cf a pl args t p =
-		make_static_call ctx c cf (apply_params a.a_types pl) args t p
+		make_static_call ctx c cf (apply_params a.a_params pl) args t p
 
 
 	let rec do_check_cast ctx tleft eright p =
 	let rec do_check_cast ctx tleft eright p =
 		let recurse cf f =
 		let recurse cf f =
@@ -706,7 +706,7 @@ module Abstract = struct
 		let find a tl f =
 		let find a tl f =
 			let tcf,cfo = f() in
 			let tcf,cfo = f() in
 			let mk_cast () =
 			let mk_cast () =
-				let tcf = apply_params a.a_types tl tcf in
+				let tcf = apply_params a.a_params tl tcf in
 				if type_iseq tcf tleft then
 				if type_iseq tcf tleft then
 					eright
 					eright
 				else
 				else
@@ -756,7 +756,7 @@ module Abstract = struct
 					| EConst(Ident s) -> Hashtbl.replace relevant s true
 					| EConst(Ident s) -> Hashtbl.replace relevant s true
 					| _ -> error "Type parameter expected" (pos e)
 					| _ -> error "Type parameter expected" (pos e)
 				) el;
 				) el;
-				let tl = List.map2 (fun (n,_) t -> if Hashtbl.mem relevant n || not (has_mono t) then t else t_dynamic) a.a_types pl in
+				let tl = List.map2 (fun (n,_) t -> if Hashtbl.mem relevant n || not (has_mono t) then t else t_dynamic) a.a_params pl in
 				if com.platform = Js && a.a_path = ([],"Map") then begin match tl with
 				if com.platform = Js && a.a_path = ([],"Map") then begin match tl with
 					| t1 :: _ ->
 					| t1 :: _ ->
 						let rec loop stack t =
 						let rec loop stack t =
@@ -783,7 +783,7 @@ module Abstract = struct
 			try
 			try
 				find_to a tl m
 				find_to a tl m
 			with Not_found ->
 			with Not_found ->
-				let at = apply_params a.a_types pl a.a_this in
+				let at = apply_params a.a_params pl a.a_this in
 				let st = s_type (print_context()) at in
 				let st = s_type (print_context()) at in
 				if has_mono at then
 				if has_mono at then
 					error ("Type parameters of multi type abstracts must be known (for " ^ st ^ ")") p
 					error ("Type parameters of multi type abstracts must be known (for " ^ st ^ ")") p
@@ -1175,12 +1175,12 @@ let fix_override com c f fd =
 			let prefix = "_tmp_" in
 			let prefix = "_tmp_" in
 			let nargs = List.map2 (fun ((v,ct) as cur) (_,_,t2) ->
 			let nargs = List.map2 (fun ((v,ct) as cur) (_,_,t2) ->
 				try
 				try
-					type_eq EqStrict (monomorphs c.cl_types (monomorphs f.cf_params v.v_type)) t2;
+					type_eq EqStrict (monomorphs c.cl_params (monomorphs f.cf_params v.v_type)) t2;
 					(* Flash generates type parameters with a single constraint as that constraint type, so we
 					(* Flash generates type parameters with a single constraint as that constraint type, so we
 					   have to detect this case and change the variable (issue #2712). *)
 					   have to detect this case and change the variable (issue #2712). *)
 					begin match follow v.v_type with
 					begin match follow v.v_type with
 						| TInst({cl_kind = KTypeParameter [tc]} as cp,_) when com.platform = Flash ->
 						| TInst({cl_kind = KTypeParameter [tc]} as cp,_) when com.platform = Flash ->
-							if List.mem_assoc (snd cp.cl_path) c.cl_types then raise (Unify_error [])
+							if List.mem_assoc (snd cp.cl_path) c.cl_params then raise (Unify_error [])
 						| _ ->
 						| _ ->
 							()
 							()
 					end;
 					end;
@@ -1271,7 +1271,7 @@ let rec is_volatile t =
 	| TType (t,tl) ->
 	| TType (t,tl) ->
 		(match t.t_path with
 		(match t.t_path with
 		| ["mt";"flash"],"Volatile" -> true
 		| ["mt";"flash"],"Volatile" -> true
-		| _ -> is_volatile (apply_params t.t_types tl t.t_type))
+		| _ -> is_volatile (apply_params t.t_params tl t.t_type))
 	| _ ->
 	| _ ->
 		false
 		false
 
 
@@ -1347,7 +1347,7 @@ let dump_types com =
 				print ";\n\n";
 				print ";\n\n";
 				List.iter (fun f -> print_field stat f) f.cf_overloads
 				List.iter (fun f -> print_field stat f) f.cf_overloads
 			in
 			in
-			print "%s%s%s %s%s" (if c.cl_private then "private " else "") (if c.cl_extern then "extern " else "") (if c.cl_interface then "interface" else "class") (s_type_path path) (params c.cl_types);
+			print "%s%s%s %s%s" (if c.cl_private then "private " else "") (if c.cl_extern then "extern " else "") (if c.cl_interface then "interface" else "class") (s_type_path path) (params c.cl_params);
 			(match c.cl_super with None -> () | Some (c,pl) -> print " extends %s" (s_type (TInst (c,pl))));
 			(match c.cl_super with None -> () | Some (c,pl) -> print " extends %s" (s_type (TInst (c,pl))));
 			List.iter (fun (c,pl) -> print " implements %s" (s_type (TInst (c,pl)))) c.cl_implements;
 			List.iter (fun (c,pl) -> print " implements %s" (s_type (TInst (c,pl)))) c.cl_implements;
 			(match c.cl_dynamic with None -> () | Some t -> print " implements Dynamic<%s>" (s_type t));
 			(match c.cl_dynamic with None -> () | Some t -> print " implements Dynamic<%s>" (s_type t));
@@ -1360,16 +1360,16 @@ let dump_types com =
 			List.iter (print_field true) c.cl_ordered_statics;
 			List.iter (print_field true) c.cl_ordered_statics;
 			print "}";
 			print "}";
 		| Type.TEnumDecl e ->
 		| Type.TEnumDecl e ->
-			print "%s%senum %s%s {\n" (if e.e_private then "private " else "") (if e.e_extern then "extern " else "") (s_type_path path) (params e.e_types);
+			print "%s%senum %s%s {\n" (if e.e_private then "private " else "") (if e.e_extern then "extern " else "") (s_type_path path) (params e.e_params);
 			List.iter (fun n ->
 			List.iter (fun n ->
 				let f = PMap.find n e.e_constrs in
 				let f = PMap.find n e.e_constrs in
 				print "\t%s : %s;\n" f.ef_name (s_type f.ef_type);
 				print "\t%s : %s;\n" f.ef_name (s_type f.ef_type);
 			) e.e_names;
 			) e.e_names;
 			print "}"
 			print "}"
 		| Type.TTypeDecl t ->
 		| Type.TTypeDecl t ->
-			print "%stype %s%s = %s" (if t.t_private then "private " else "") (s_type_path path) (params t.t_types) (s_type t.t_type);
+			print "%stype %s%s = %s" (if t.t_private then "private " else "") (s_type_path path) (params t.t_params) (s_type t.t_type);
 		| Type.TAbstractDecl a ->
 		| Type.TAbstractDecl a ->
-			print "%sabstract %s%s {}" (if a.a_private then "private " else "") (s_type_path path) (params a.a_types);
+			print "%sabstract %s%s {}" (if a.a_private then "private " else "") (s_type_path path) (params a.a_params);
 		);
 		);
 		close();
 		close();
 	) com.types
 	) com.types
@@ -1443,7 +1443,7 @@ struct
 				TType(t, [simplify_t t2])
 				TType(t, [simplify_t t2])
 			| t2 -> t2)
 			| t2 -> t2)
 		| TType(t, tl) ->
 		| TType(t, tl) ->
-			simplify_t (apply_params t.t_types tl t.t_type)
+			simplify_t (apply_params t.t_params tl t.t_type)
 		| TMono r -> (match !r with
 		| TMono r -> (match !r with
 			| Some t -> simplify_t t
 			| Some t -> simplify_t t
 			| None -> t_dynamic)
 			| None -> t_dynamic)
@@ -1469,13 +1469,13 @@ struct
 				| [] -> (let acc, ca, tla = !cur in match ca.cl_super with
 				| [] -> (let acc, ca, tla = !cur in match ca.cl_super with
 					| None -> raise Not_found
 					| None -> raise Not_found
 					| Some (sup,tls) ->
 					| Some (sup,tls) ->
-						cur := (acc+1,sup,List.map (apply_params ca.cl_types tla) tls);
+						cur := (acc+1,sup,List.map (apply_params ca.cl_params tla) tls);
 						stack := [!cur];
 						stack := [!cur];
 						loop())
 						loop())
 				| (acc,ca,tla) :: _ when ca == cf ->
 				| (acc,ca,tla) :: _ when ca == cf ->
 					acc,tla
 					acc,tla
 				| (acc,ca,tla) :: s ->
 				| (acc,ca,tla) :: s ->
-					stack := s @ List.map (fun (c,tl) -> (acc+1,c,List.map (apply_params ca.cl_types tla) tl)) ca.cl_implements;
+					stack := s @ List.map (fun (c,tl) -> (acc+1,c,List.map (apply_params ca.cl_params tla) tl)) ca.cl_implements;
 					loop()
 					loop()
 			in
 			in
 			let acc, tla = loop() in
 			let acc, tla = loop() in
@@ -1487,7 +1487,7 @@ struct
 				else match ca.cl_super with
 				else match ca.cl_super with
 				| None -> raise Not_found
 				| None -> raise Not_found
 				| Some(sup,stl) ->
 				| Some(sup,stl) ->
-					loop (acc+1) sup (List.map (apply_params ca.cl_types tla) stl)
+					loop (acc+1) sup (List.map (apply_params ca.cl_params tla) stl)
 			in
 			in
 			let acc, tla = loop 0 ca tla in
 			let acc, tla = loop 0 ca tla in
 			(cacc + acc, rate_tp tlf tla)
 			(cacc + acc, rate_tp tlf tla)
@@ -1508,7 +1508,7 @@ struct
 			else
 			else
 				let ret = ref None in
 				let ret = ref None in
 				if List.exists (fun (t,_) -> try
 				if List.exists (fun (t,_) -> try
-					ret := Some (rate_conv (cacc+1) (apply_params af.a_types tlf t) targ);
+					ret := Some (rate_conv (cacc+1) (apply_params af.a_params tlf t) targ);
 					true
 					true
 				with | Not_found ->
 				with | Not_found ->
 					false
 					false
@@ -1516,7 +1516,7 @@ struct
 					Option.get !ret
 					Option.get !ret
 			else
 			else
 				if List.exists (fun (t,_) -> try
 				if List.exists (fun (t,_) -> try
-					ret := Some (rate_conv (cacc+1) tfun (apply_params aa.a_types tla t));
+					ret := Some (rate_conv (cacc+1) tfun (apply_params aa.a_params tla t));
 					true
 					true
 				with | Not_found ->
 				with | Not_found ->
 					false
 					false
@@ -1646,7 +1646,7 @@ module UnificationCallback = struct
 				{e with eexpr = TCall(e1,el)}
 				{e with eexpr = TCall(e1,el)}
 			| TNew(c,tl,el) ->
 			| TNew(c,tl,el) ->
 				begin try
 				begin try
-					let tcf,_ = get_constructor (fun cf -> apply_params c.cl_types tl cf.cf_type) c in
+					let tcf,_ = get_constructor (fun cf -> apply_params c.cl_params tl cf.cf_type) c in
 					let el = check_call f el tcf in
 					let el = check_call f el tcf in
 					{e with eexpr = TNew(c,tl,el)}
 					{e with eexpr = TNew(c,tl,el)}
 				with Not_found ->
 				with Not_found ->

+ 1 - 1
dce.ml

@@ -221,7 +221,7 @@ let rec to_string dce t = match t with
 	| TType(tt,tl) ->
 	| TType(tt,tl) ->
 		if not (List.exists (fun t2 -> Type.fast_eq t t2) dce.ts_stack) then begin
 		if not (List.exists (fun t2 -> Type.fast_eq t t2) dce.ts_stack) then begin
 			dce.ts_stack <- t :: dce.ts_stack;
 			dce.ts_stack <- t :: dce.ts_stack;
-			to_string dce (apply_params tt.t_types tl tt.t_type)
+			to_string dce (apply_params tt.t_params tl tt.t_type)
 		end
 		end
 	| TAbstract({a_impl = Some c} as a,tl) ->
 	| TAbstract({a_impl = Some c} as a,tl) ->
 		if Meta.has Meta.CoreType a.a_meta then
 		if Meta.has Meta.CoreType a.a_meta then

+ 1 - 1
filters.ml

@@ -989,7 +989,7 @@ let add_rtti ctx t =
 let add_field_inits ctx t =
 let add_field_inits ctx t =
 	let is_as3 = Common.defined ctx.com Define.As3 && not ctx.in_macro in
 	let is_as3 = Common.defined ctx.com Define.As3 && not ctx.in_macro in
 	let apply c =
 	let apply c =
-		let ethis = mk (TConst TThis) (TInst (c,List.map snd c.cl_types)) c.cl_pos in
+		let ethis = mk (TConst TThis) (TInst (c,List.map snd c.cl_params)) c.cl_pos in
 		(* TODO: we have to find a variable name which is not used in any of the functions *)
 		(* TODO: we have to find a variable name which is not used in any of the functions *)
 		let v = alloc_var "_g" ethis.etype in
 		let v = alloc_var "_g" ethis.etype in
 		let need_this = ref false in
 		let need_this = ref false in

+ 3 - 3
genas3.ml

@@ -291,7 +291,7 @@ let rec type_str ctx t p =
 				| TEnum ({ e_path = [],"Bool" },_) -> "*"
 				| TEnum ({ e_path = [],"Bool" },_) -> "*"
 				| _ -> type_str ctx t p)
 				| _ -> type_str ctx t p)
 			| _ -> assert false);
 			| _ -> assert false);
-		| _ -> type_str ctx (apply_params t.t_types args t.t_type) p)
+		| _ -> type_str ctx (apply_params t.t_params args t.t_type) p)
 	| TLazy f ->
 	| TLazy f ->
 		type_str ctx ((!f)()) p
 		type_str ctx ((!f)()) p
 
 
@@ -1069,7 +1069,7 @@ let generate_class ctx c =
 	ctx.curclass <- c;
 	ctx.curclass <- c;
 	define_getset ctx true c;
 	define_getset ctx true c;
 	define_getset ctx false c;
 	define_getset ctx false c;
-	ctx.local_types <- List.map snd c.cl_types;
+	ctx.local_types <- List.map snd c.cl_params;
 	let pack = open_block ctx in
 	let pack = open_block ctx in
 	print ctx "\tpublic %s%s%s %s " (final c.cl_meta) (match c.cl_dynamic with None -> "" | Some _ -> if c.cl_interface then "" else "dynamic ") (if c.cl_interface then "interface" else "class") (snd c.cl_path);
 	print ctx "\tpublic %s%s%s %s " (final c.cl_meta) (match c.cl_dynamic with None -> "" | Some _ -> if c.cl_interface then "" else "dynamic ") (if c.cl_interface then "interface" else "class") (snd c.cl_path);
 	(match c.cl_super with
 	(match c.cl_super with
@@ -1130,7 +1130,7 @@ let generate_main ctx inits =
 	newline ctx
 	newline ctx
 
 
 let generate_enum ctx e =
 let generate_enum ctx e =
-	ctx.local_types <- List.map snd e.e_types;
+	ctx.local_types <- List.map snd e.e_params;
 	let pack = open_block ctx in
 	let pack = open_block ctx in
 	let ename = snd e.e_path in
 	let ename = snd e.e_path in
 	print ctx "\tpublic final class %s extends enum {" ename;
 	print ctx "\tpublic final class %s extends enum {" ename;

+ 123 - 123
gencommon.ml

@@ -89,7 +89,7 @@ let follow_once t =
 	| TLazy f ->
 	| TLazy f ->
 		!f()
 		!f()
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		apply_params t.t_types tl t.t_type
+		apply_params t.t_params tl t.t_type
 	| _ -> t
 	| _ -> t
 
 
 let t_empty = TAnon({ a_fields = PMap.empty; a_status = ref (Closed) })
 let t_empty = TAnon({ a_fields = PMap.empty; a_status = ref (Closed) })
@@ -536,7 +536,7 @@ type generator_ctx =
 	(* add type can be called at any time, and will add a new module_def that may or may not be filtered *)
 	(* add type can be called at any time, and will add a new module_def that may or may not be filtered *)
 	(* module_type -> should_filter *)
 	(* module_type -> should_filter *)
 	mutable gadd_type : module_type -> bool -> unit;
 	mutable gadd_type : module_type -> bool -> unit;
-	(* during expr filters, add_to_module will be available so module_types can be added to current module_def. we must pass the priority argument so the filters can be resumed	*)
+	(* during expr filters, add_to_module will be available so module_params can be added to current module_def. we must pass the priority argument so the filters can be resumed	*)
 	mutable gadd_to_module : module_type -> float -> unit;
 	mutable gadd_to_module : module_type -> float -> unit;
 	(* during expr filters, shows the current class path *)
 	(* during expr filters, shows the current class path *)
 	mutable gcurrent_path : path;
 	mutable gcurrent_path : path;
@@ -763,7 +763,7 @@ let init_ctx gen =
 		| TLazy f ->
 		| TLazy f ->
 			follow_f (!f())
 			follow_f (!f())
 		| TType (t,tl) ->
 		| TType (t,tl) ->
-			follow_f (apply_params t.t_types tl t.t_type)
+			follow_f (apply_params t.t_params tl t.t_type)
 		| _ -> Some t
 		| _ -> Some t
 	in
 	in
 	gen.gfollow#add ~name:"final" ~priority:PLast follow
 	gen.gfollow#add ~name:"final" ~priority:PLast follow
@@ -1157,7 +1157,7 @@ let follow_module follow_func md = match md with
 	| TClassDecl _
 	| TClassDecl _
 	| TEnumDecl _
 	| TEnumDecl _
 	| TAbstractDecl _ -> md
 	| TAbstractDecl _ -> md
-	| TTypeDecl tdecl -> match (follow_func (TType(tdecl, List.map snd tdecl.t_types))) with
+	| TTypeDecl tdecl -> match (follow_func (TType(tdecl, List.map snd tdecl.t_params))) with
 		| TInst(cl,_) -> TClassDecl cl
 		| TInst(cl,_) -> TClassDecl cl
 		| TEnum(e,_) -> TEnumDecl e
 		| TEnum(e,_) -> TEnumDecl e
 		| TType(t,_) -> TTypeDecl t
 		| TType(t,_) -> TTypeDecl t
@@ -1187,10 +1187,10 @@ let is_hxgen_t t =
 
 
 let mt_to_t_dyn md =
 let mt_to_t_dyn md =
 	match md with
 	match md with
-		| TClassDecl cl -> TInst(cl, List.map (fun _ -> t_dynamic) cl.cl_types)
-		| TEnumDecl e -> TEnum(e, List.map (fun _ -> t_dynamic) e.e_types)
-		| TAbstractDecl a -> TAbstract(a, List.map (fun _ -> t_dynamic) a.a_types)
-		| TTypeDecl t -> TType(t, List.map (fun _ -> t_dynamic) t.t_types)
+		| TClassDecl cl -> TInst(cl, List.map (fun _ -> t_dynamic) cl.cl_params)
+		| TEnumDecl e -> TEnum(e, List.map (fun _ -> t_dynamic) e.e_params)
+		| TAbstractDecl a -> TAbstract(a, List.map (fun _ -> t_dynamic) a.a_params)
+		| TTypeDecl t -> TType(t, List.map (fun _ -> t_dynamic) t.t_params)
 
 
 let mt_to_t mt params =
 let mt_to_t mt params =
 	match mt with
 	match mt with
@@ -1290,34 +1290,34 @@ let find_first_declared_field gen orig_cl ?exact_field field =
 				chosen := Some(depth,ret,c,tl,tlch)
 				chosen := Some(depth,ret,c,tl,tlch)
 			| _, Some f2 ->
 			| _, Some f2 ->
 				List.iter (fun f ->
 				List.iter (fun f ->
-					let declared_t = apply_params c.cl_types tl f.cf_type in
+					let declared_t = apply_params c.cl_params tl f.cf_type in
 					if Typeload.same_overload_args declared_t f2.cf_type f f2 then
 					if Typeload.same_overload_args declared_t f2.cf_type f f2 then
 						chosen := Some(depth,f,c,tl,tlch)
 						chosen := Some(depth,f,c,tl,tlch)
 				) (ret :: ret.cf_overloads)
 				) (ret :: ret.cf_overloads)
 		with | Not_found -> ());
 		with | Not_found -> ());
 		(match c.cl_super with
 		(match c.cl_super with
 		| Some (sup,stl) ->
 		| Some (sup,stl) ->
-			let tl = List.map (apply_params c.cl_types tl) stl in
+			let tl = List.map (apply_params c.cl_params tl) stl in
 			let stl = gen.greal_type_param (TClassDecl sup) stl in
 			let stl = gen.greal_type_param (TClassDecl sup) stl in
-			let tlch = List.map (apply_params c.cl_types tlch) stl in
+			let tlch = List.map (apply_params c.cl_params tlch) stl in
 			loop_cl (depth+1) sup tl tlch
 			loop_cl (depth+1) sup tl tlch
 		| None -> ());
 		| None -> ());
 		if c.cl_interface then
 		if c.cl_interface then
 			List.iter (fun (sup,stl) ->
 			List.iter (fun (sup,stl) ->
-				let tl = List.map (apply_params c.cl_types tl) stl in
+				let tl = List.map (apply_params c.cl_params tl) stl in
 				let stl = gen.greal_type_param (TClassDecl sup) stl in
 				let stl = gen.greal_type_param (TClassDecl sup) stl in
-				let tlch = List.map (apply_params c.cl_types tlch) stl in
+				let tlch = List.map (apply_params c.cl_params tlch) stl in
 				loop_cl (depth+1) sup tl tlch
 				loop_cl (depth+1) sup tl tlch
 			) c.cl_implements
 			) c.cl_implements
 	in
 	in
-	loop_cl 0 orig_cl (List.map snd orig_cl.cl_types) (List.map snd orig_cl.cl_types);
+	loop_cl 0 orig_cl (List.map snd orig_cl.cl_params) (List.map snd orig_cl.cl_params);
 	match !chosen with
 	match !chosen with
 	| None -> None
 	| None -> None
 	| Some(_,f,c,tl,tlch) ->
 	| Some(_,f,c,tl,tlch) ->
 		if !is_overload && not (Meta.has Meta.Overload f.cf_meta) then
 		if !is_overload && not (Meta.has Meta.Overload f.cf_meta) then
 			f.cf_meta <- (Meta.Overload,[],f.cf_pos) :: f.cf_meta;
 			f.cf_meta <- (Meta.Overload,[],f.cf_pos) :: f.cf_meta;
-		let declared_t = apply_params c.cl_types tl f.cf_type in
-		let params_t = apply_params c.cl_types tlch f.cf_type in
+		let declared_t = apply_params c.cl_params tl f.cf_type in
+		let params_t = apply_params c.cl_params tlch f.cf_type in
 		let actual_t = match follow params_t with
 		let actual_t = match follow params_t with
 		| TFun(args,ret) -> TFun(List.map (fun (n,o,t) -> (n,o,gen.greal_type t)) args, gen.greal_type ret)
 		| TFun(args,ret) -> TFun(List.map (fun (n,o,t) -> (n,o,gen.greal_type t)) args, gen.greal_type ret)
 		| _ -> gen.greal_type params_t in
 		| _ -> gen.greal_type params_t in
@@ -1337,7 +1337,7 @@ let field_access gen (t:t) (field:string) : (tfield_access) =
 			let rec not_found cl params =
 			let rec not_found cl params =
 				match cl.cl_dynamic with
 				match cl.cl_dynamic with
 					| Some t ->
 					| Some t ->
-						let t = apply_params cl.cl_types params t in
+						let t = apply_params cl.cl_params params t in
 						FDynamicField t
 						FDynamicField t
 					| None ->
 					| None ->
 						match cl.cl_super with
 						match cl.cl_super with
@@ -1354,7 +1354,7 @@ let field_access gen (t:t) (field:string) : (tfield_access) =
 			in
 			in
 
 
 			(* this is a hack for C#'s different generic types with same path *)
 			(* this is a hack for C#'s different generic types with same path *)
-			let hashtbl_field = (String.concat "" (List.map (fun _ -> "]") cl.cl_types)) ^ field in
+			let hashtbl_field = (String.concat "" (List.map (fun _ -> "]") cl.cl_params)) ^ field in
 			let types = try
 			let types = try
 				Hashtbl.find gen.greal_field_types (orig_cl.cl_path, hashtbl_field)
 				Hashtbl.find gen.greal_field_types (orig_cl.cl_path, hashtbl_field)
 			with | Not_found ->
 			with | Not_found ->
@@ -1376,7 +1376,7 @@ let field_access gen (t:t) (field:string) : (tfield_access) =
 			(try match !(anon.a_status) with
 			(try match !(anon.a_status) with
 				| Statics cl ->
 				| Statics cl ->
 					let cf = PMap.find field cl.cl_statics in
 					let cf = PMap.find field cl.cl_statics in
-					FClassField(cl, List.map (fun _ -> t_dynamic) cl.cl_types, cl, cf, true, cf.cf_type, cf.cf_type)
+					FClassField(cl, List.map (fun _ -> t_dynamic) cl.cl_params, cl, cf, true, cf.cf_type, cf.cf_type)
 				| EnumStatics e ->
 				| EnumStatics e ->
 					let f = PMap.find field e.e_constrs in
 					let f = PMap.find field e.e_constrs in
 					let is_param = match follow f.ef_type with | TFun _ -> true | _ -> false in
 					let is_param = match follow f.ef_type with | TFun _ -> true | _ -> false in
@@ -1402,7 +1402,7 @@ let field_access_esp gen t field = match field with
 		in
 		in
 		let p = match follow (run_follow gen t) with
 		let p = match follow (run_follow gen t) with
 			| TInst(_,p) -> p
 			| TInst(_,p) -> p
-			| _ -> List.map snd cl.cl_types
+			| _ -> List.map snd cl.cl_params
 		in
 		in
 		FClassField(cl,p,cl,cf,static,cf.cf_type,cf.cf_type)
 		FClassField(cl,p,cl,cf,static,cf.cf_type,cf.cf_type)
 	| _ -> field_access gen t (field_name field)
 	| _ -> field_access gen t (field_name field)
@@ -1410,7 +1410,7 @@ let field_access_esp gen t field = match field with
 let mk_field_access gen expr field pos =
 let mk_field_access gen expr field pos =
 	match field_access gen expr.etype field with
 	match field_access gen expr.etype field with
 		| FClassField(c,p,dc,cf,false,at,_) ->
 		| FClassField(c,p,dc,cf,false,at,_) ->
-				{ eexpr = TField(expr, FInstance(dc,cf)); etype = apply_params c.cl_types p at; epos = pos }
+				{ eexpr = TField(expr, FInstance(dc,cf)); etype = apply_params c.cl_params p at; epos = pos }
 		| FClassField(c,p,dc,cf,true,at,_) ->
 		| FClassField(c,p,dc,cf,true,at,_) ->
 				{ eexpr = TField(expr, FStatic(dc,cf)); etype = at; epos = pos }
 				{ eexpr = TField(expr, FStatic(dc,cf)); etype = at; epos = pos }
 		| FAnonField cf ->
 		| FAnonField cf ->
@@ -1597,12 +1597,12 @@ struct
 		| None -> match c.cl_super with
 		| None -> match c.cl_super with
 		| None -> raise Not_found
 		| None -> raise Not_found
 		| Some (sup,stl) ->
 		| Some (sup,stl) ->
-			cur_ctor sup (List.map (apply_params c.cl_types tl) stl)
+			cur_ctor sup (List.map (apply_params c.cl_params tl) stl)
 
 
 	let rec prev_ctor c tl =
 	let rec prev_ctor c tl =
 		match c.cl_super with
 		match c.cl_super with
 		| None -> raise Not_found
 		| None -> raise Not_found
-		| Some (sup,stl) -> let stl = List.map (apply_params c.cl_types tl) stl in
+		| Some (sup,stl) -> let stl = List.map (apply_params c.cl_params tl) stl in
 		match sup.cl_constructor with
 		match sup.cl_constructor with
 		| None -> prev_ctor sup stl
 		| None -> prev_ctor sup stl
 		| Some ctor -> ctor, sup, stl
 		| Some ctor -> ctor, sup, stl
@@ -1612,7 +1612,7 @@ struct
 		let rec loop_super c tl = match c.cl_super with
 		let rec loop_super c tl = match c.cl_super with
 			| None -> raise Not_found
 			| None -> raise Not_found
 			| Some(sup,stl) ->
 			| Some(sup,stl) ->
-				let stl = List.map (apply_params c.cl_types tl) stl in
+				let stl = List.map (apply_params c.cl_params tl) stl in
 				try
 				try
 					let static_ctor_name = name ^ "_" ^ (String.concat "_" (fst sup.cl_path)) ^ "_" ^ (snd sup.cl_path) in
 					let static_ctor_name = name ^ "_" ^ (String.concat "_" (fst sup.cl_path)) ^ "_" ^ (snd sup.cl_path) in
 					sup, stl, PMap.find static_ctor_name sup.cl_statics
 					sup, stl, PMap.find static_ctor_name sup.cl_statics
@@ -1659,13 +1659,13 @@ struct
 			let static_ctor_name = name ^ "_" ^ (String.concat "_" (fst cl.cl_path)) ^ "_" ^ (snd cl.cl_path) in
 			let static_ctor_name = name ^ "_" ^ (String.concat "_" (fst cl.cl_path)) ^ "_" ^ (snd cl.cl_path) in
 			(* create the static constructor *)
 			(* create the static constructor *)
 			let basic = gen.gcon.basic in
 			let basic = gen.gcon.basic in
-			let ctor_types = List.map (fun (s,t) -> (s, TInst(map_param (get_cl_t t), []))) cl.cl_types in
+			let ctor_types = List.map (fun (s,t) -> (s, TInst(map_param (get_cl_t t), []))) cl.cl_params in
 			let me = mk_temp gen "me" (TInst(cl, List.map snd ctor_types)) in
 			let me = mk_temp gen "me" (TInst(cl, List.map snd ctor_types)) in
 			me.v_capture <- true;
 			me.v_capture <- true;
 
 
 			let fn_args, _ = get_fun ctor.cf_type in
 			let fn_args, _ = get_fun ctor.cf_type in
 			let ctor_params = List.map snd ctor_types in
 			let ctor_params = List.map snd ctor_types in
-			let fn_type = TFun((me.v_name,false, me.v_type) :: List.map (fun (n,o,t) -> (n,o,apply_params cl.cl_types ctor_params t)) fn_args, basic.tvoid) in
+			let fn_type = TFun((me.v_name,false, me.v_type) :: List.map (fun (n,o,t) -> (n,o,apply_params cl.cl_params ctor_params t)) fn_args, basic.tvoid) in
 			let cur_tf_args = match ctor.cf_expr with
 			let cur_tf_args = match ctor.cf_expr with
 			| Some { eexpr = TFunction(tf) } -> tf.tf_args
 			| Some { eexpr = TFunction(tf) } -> tf.tf_args
 			| _ -> assert false
 			| _ -> assert false
@@ -1675,7 +1675,7 @@ struct
 
 
 			let local_map = Hashtbl.create (List.length cur_tf_args) in
 			let local_map = Hashtbl.create (List.length cur_tf_args) in
 			let static_tf_args = (me, None) :: List.map (fun (v,b) ->
 			let static_tf_args = (me, None) :: List.map (fun (v,b) ->
-				let new_v = alloc_var v.v_name (apply_params cl.cl_types ctor_params v.v_type) in
+				let new_v = alloc_var v.v_name (apply_params cl.cl_params ctor_params v.v_type) in
 				Hashtbl.add local_map v.v_id new_v;
 				Hashtbl.add local_map v.v_id new_v;
 				(new_v, b)
 				(new_v, b)
 			) cur_tf_args in
 			) cur_tf_args in
@@ -1701,11 +1701,11 @@ struct
 					mk_local me e.epos
 					mk_local me e.epos
 				| TBlock (fst :: bl) ->
 				| TBlock (fst :: bl) ->
 					let fst = map_expr ~is_first:is_first fst in
 					let fst = map_expr ~is_first:is_first fst in
-					{ e with eexpr = TBlock(fst :: List.map (fun e -> map_expr ~is_first:false e) bl); etype = apply_params cl.cl_types ctor_params e.etype }
+					{ e with eexpr = TBlock(fst :: List.map (fun e -> map_expr ~is_first:false e) bl); etype = apply_params cl.cl_params ctor_params e.etype }
 				| _ ->
 				| _ ->
 					do_map e
 					do_map e
 			and do_map ?(is_first=false) e =
 			and do_map ?(is_first=false) e =
-				let do_t = apply_params cl.cl_types ctor_params in
+				let do_t = apply_params cl.cl_params ctor_params in
 				let do_v v = try
 				let do_v v = try
 						Hashtbl.find local_map v.v_id
 						Hashtbl.find local_map v.v_id
 					with | Not_found ->
 					with | Not_found ->
@@ -1740,10 +1740,10 @@ struct
 							eexpr = TField(
 							eexpr = TField(
 								mk_classtype_access cl p,
 								mk_classtype_access cl p,
 								FStatic(cl, static_ctor));
 								FStatic(cl, static_ctor));
-							etype = apply_params static_ctor.cf_params (List.map snd cl.cl_types) static_ctor.cf_type;
+							etype = apply_params static_ctor.cf_params (List.map snd cl.cl_params) static_ctor.cf_type;
 							epos = p
 							epos = p
 						},
 						},
-						[{ eexpr = TConst TThis; etype = TInst(cl, List.map snd cl.cl_types); epos = p }]
+						[{ eexpr = TConst TThis; etype = TInst(cl, List.map snd cl.cl_params); epos = p }]
 						@ List.map (fun (v,_) -> mk_local v p) cur_tf_args
 						@ List.map (fun (v,_) -> mk_local v p) cur_tf_args
 					);
 					);
 					etype = basic.tvoid;
 					etype = basic.tvoid;
@@ -1756,7 +1756,7 @@ struct
 	let clone_ctors gen ctor sup stl cl =
 	let clone_ctors gen ctor sup stl cl =
 		let basic = gen.gcon.basic in
 		let basic = gen.gcon.basic in
 		let rec clone cf =
 		let rec clone cf =
-			let ncf = mk_class_field "new" (apply_params sup.cl_types stl cf.cf_type) cf.cf_public cf.cf_pos cf.cf_kind cf.cf_params in
+			let ncf = mk_class_field "new" (apply_params sup.cl_params stl cf.cf_type) cf.cf_public cf.cf_pos cf.cf_kind cf.cf_params in
 			let args, ret = get_fun ncf.cf_type in
 			let args, ret = get_fun ncf.cf_type in
 			(* single expression: call to super() *)
 			(* single expression: call to super() *)
 			let tf_args = List.map (fun (name,_,t) ->
 			let tf_args = List.map (fun (name,_,t) ->
@@ -1766,7 +1766,7 @@ struct
 			let super_call =
 			let super_call =
 			{
 			{
 				eexpr = TCall(
 				eexpr = TCall(
-					{ eexpr = TConst TSuper; etype = TInst(cl, List.map snd cl.cl_types); epos = ctor.cf_pos },
+					{ eexpr = TConst TSuper; etype = TInst(cl, List.map snd cl.cl_params); epos = ctor.cf_pos },
 					List.map (fun (v,_) -> mk_local v ctor.cf_pos) tf_args);
 					List.map (fun (v,_) -> mk_local v ctor.cf_pos) tf_args);
 				etype = basic.tvoid;
 				etype = basic.tvoid;
 				epos = ctor.cf_pos;
 				epos = ctor.cf_pos;
@@ -1850,7 +1850,7 @@ struct
 						let ctor = match cl.cl_constructor with
 						let ctor = match cl.cl_constructor with
 						| Some ctor -> ctor
 						| Some ctor -> ctor
 						| None -> try
 						| None -> try
-							let sctor, sup, stl = prev_ctor cl (List.map snd cl.cl_types) in
+							let sctor, sup, stl = prev_ctor cl (List.map snd cl.cl_params) in
 							(* we have a previous constructor. if we support inheritance, exit *)
 							(* we have a previous constructor. if we support inheritance, exit *)
 							if supports_ctor_inheritance then raise Exit;
 							if supports_ctor_inheritance then raise Exit;
 							(* we'll make constructors that will only call super() *)
 							(* we'll make constructors that will only call super() *)
@@ -1899,14 +1899,14 @@ struct
 							if supports_ctor_inheritance && is_none cl.cl_constructor then raise Exit;
 							if supports_ctor_inheritance && is_none cl.cl_constructor then raise Exit;
 							[{
 							[{
 								eexpr = TCall(
 								eexpr = TCall(
-									{ eexpr = TConst TSuper; etype = TInst(cl, List.map snd cl.cl_types); epos = cl.cl_pos },
+									{ eexpr = TConst TSuper; etype = TInst(cl, List.map snd cl.cl_params); epos = cl.cl_pos },
 									[ empty_ctor_expr ]);
 									[ empty_ctor_expr ]);
 								etype = basic.tvoid;
 								etype = basic.tvoid;
 								epos = cl.cl_pos
 								epos = cl.cl_pos
 							}]
 							}]
 						with | Not_found -> try
 						with | Not_found -> try
 							(* super type is native: find super constructor with least arguments *)
 							(* super type is native: find super constructor with least arguments *)
-							let sctor, sup, stl = prev_ctor cl (List.map snd cl.cl_types) in
+							let sctor, sup, stl = prev_ctor cl (List.map snd cl.cl_params) in
 							let rec loop remaining (best,n) =
 							let rec loop remaining (best,n) =
 								match remaining with
 								match remaining with
 								| [] -> best
 								| [] -> best
@@ -1922,7 +1922,7 @@ struct
 							let args,_ = get_fun best.cf_type in
 							let args,_ = get_fun best.cf_type in
 							[{
 							[{
 								eexpr = TCall(
 								eexpr = TCall(
-									{ eexpr = TConst TSuper; etype = TInst(cl, List.map snd cl.cl_types); epos = cl.cl_pos },
+									{ eexpr = TConst TSuper; etype = TInst(cl, List.map snd cl.cl_params); epos = cl.cl_pos },
 									List.map (fun (n,o,t) -> null t cl.cl_pos) args);
 									List.map (fun (n,o,t) -> null t cl.cl_pos) args);
 								etype = basic.tvoid;
 								etype = basic.tvoid;
 								epos = cl.cl_pos
 								epos = cl.cl_pos
@@ -2055,7 +2055,7 @@ struct
 							| Method(MethDynamic) ->
 							| Method(MethDynamic) ->
 								(match cf.cf_expr, cf.cf_params with
 								(match cf.cf_expr, cf.cf_params with
 									| Some e, [] ->
 									| Some e, [] ->
-										let var = { eexpr = TField({ eexpr = TConst(TThis); epos = cf.cf_pos; etype = TInst(cl, List.map snd cl.cl_types); }, FInstance(cl, cf)); etype = cf.cf_type; epos = cf.cf_pos } in
+										let var = { eexpr = TField({ eexpr = TConst(TThis); epos = cf.cf_pos; etype = TInst(cl, List.map snd cl.cl_params); }, FInstance(cl, cf)); etype = cf.cf_type; epos = cf.cf_pos } in
 										let ret = ({ eexpr = TBinop(Ast.OpAssign, var, e); etype = cf.cf_type; epos = cf.cf_pos; }) in
 										let ret = ({ eexpr = TBinop(Ast.OpAssign, var, e); etype = cf.cf_type; epos = cf.cf_pos; }) in
 										cf.cf_expr <- None;
 										cf.cf_expr <- None;
 										let is_override = List.memq cf cl.cl_overrides in
 										let is_override = List.memq cf cl.cl_overrides in
@@ -2068,7 +2068,7 @@ struct
 									| Some e, _ ->
 									| Some e, _ ->
 										let params = List.map (fun _ -> t_dynamic) cf.cf_params in
 										let params = List.map (fun _ -> t_dynamic) cf.cf_params in
 										let fn = apply_params cf.cf_params params in
 										let fn = apply_params cf.cf_params params in
-										let var = { eexpr = TField({ eexpr = TConst(TThis); epos = cf.cf_pos; etype = TInst(cl, List.map snd cl.cl_types); }, FInstance(cl, cf)); etype = cf.cf_type; epos = cf.cf_pos } in
+										let var = { eexpr = TField({ eexpr = TConst(TThis); epos = cf.cf_pos; etype = TInst(cl, List.map snd cl.cl_params); }, FInstance(cl, cf)); etype = cf.cf_type; epos = cf.cf_pos } in
 										let rec change_expr e =
 										let rec change_expr e =
 											Type.map_expr_type (change_expr) fn (fun v -> v.v_type <- fn v.v_type; v) e
 											Type.map_expr_type (change_expr) fn (fun v -> v.v_type <- fn v.v_type; v) e
 										in
 										in
@@ -2094,7 +2094,7 @@ struct
 							let ctors = match cl.cl_constructor with
 							let ctors = match cl.cl_constructor with
 							| Some ctor -> ctor
 							| Some ctor -> ctor
 							| None -> try
 							| None -> try
-								let sctor, sup, stl = OverloadingConstructor.prev_ctor cl (List.map snd cl.cl_types) in
+								let sctor, sup, stl = OverloadingConstructor.prev_ctor cl (List.map snd cl.cl_params) in
 								let ctor = OverloadingConstructor.clone_ctors gen sctor sup stl cl in
 								let ctor = OverloadingConstructor.clone_ctors gen sctor sup stl cl in
 								cl.cl_constructor <- Some ctor;
 								cl.cl_constructor <- Some ctor;
 								ctor
 								ctor
@@ -3114,11 +3114,11 @@ struct
 			let cls = mk_class (get ft.fgen.gcurrent_class).cl_module path tfunc.tf_expr.epos in
 			let cls = mk_class (get ft.fgen.gcurrent_class).cl_module path tfunc.tf_expr.epos in
 			if in_unsafe then cls.cl_meta <- (Meta.Unsafe,[],Ast.null_pos) :: cls.cl_meta;
 			if in_unsafe then cls.cl_meta <- (Meta.Unsafe,[],Ast.null_pos) :: cls.cl_meta;
 			cls.cl_module <- (get ft.fgen.gcurrent_class).cl_module;
 			cls.cl_module <- (get ft.fgen.gcurrent_class).cl_module;
-			cls.cl_types <- cltypes;
+			cls.cl_params <- cltypes;
 
 
 			let mk_this v pos =
 			let mk_this v pos =
 				{
 				{
-					(mk_field_access gen { eexpr = TConst TThis; etype = TInst(cls, List.map snd cls.cl_types); epos = pos } v.v_name pos)
+					(mk_field_access gen { eexpr = TConst TThis; etype = TInst(cls, List.map snd cls.cl_params); epos = pos } v.v_name pos)
 					with etype = v.v_type
 					with etype = v.v_type
 				}
 				}
 			in
 			in
@@ -3168,7 +3168,7 @@ struct
 						eexpr = TCall({
 						eexpr = TCall({
 							eexpr = TField({
 							eexpr = TField({
 								eexpr = TConst TThis;
 								eexpr = TConst TThis;
-								etype = TInst(cls, List.map snd cls.cl_types);
+								etype = TInst(cls, List.map snd cls.cl_params);
 								epos = pos;
 								epos = pos;
 							}, FInstance(cls, cf));
 							}, FInstance(cls, cf));
 							etype = cf.cf_type;
 							etype = cf.cf_type;
@@ -3302,7 +3302,7 @@ struct
 				let cltparams = List.map (fun (_,t) ->
 				let cltparams = List.map (fun (_,t) ->
 					try
 					try
 						snd (List.find (fun (t2,_) -> same_cl t t2) passoc)
 						snd (List.find (fun (t2,_) -> same_cl t t2) passoc)
-					with | Not_found -> t) cls.cl_types
+					with | Not_found -> t) cls.cl_params
 				in
 				in
 				{ e with eexpr = TNew(cls, cltparams, captured) }
 				{ e with eexpr = TNew(cls, cltparams, captured) }
 			with
 			with
@@ -3597,7 +3597,7 @@ struct
 			let map_base_classfields cl is_function map_fn =
 			let map_base_classfields cl is_function map_fn =
 
 
 				let pos = cl.cl_pos in
 				let pos = cl.cl_pos in
-				let this_t = TInst(cl,List.map snd cl.cl_types) in
+				let this_t = TInst(cl,List.map snd cl.cl_params) in
 				let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 				let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 				let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 				let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 
 
@@ -3766,7 +3766,7 @@ struct
 			let get_base_classfields_for cl is_function mk_additional_args =
 			let get_base_classfields_for cl is_function mk_additional_args =
 				let pos = cl.cl_pos in
 				let pos = cl.cl_pos in
 
 
-				let this_t = TInst(cl,List.map snd cl.cl_types) in
+				let this_t = TInst(cl,List.map snd cl.cl_params) in
 				let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 				let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 				let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 				let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 
 
@@ -3798,7 +3798,7 @@ struct
 					} )
 					} )
 				in
 				in
 
 
-				let cl_t = TInst(cl,List.map snd cl.cl_types) in
+				let cl_t = TInst(cl,List.map snd cl.cl_params) in
 				let this = { eexpr = TConst(TThis); etype = cl_t; epos = pos } in
 				let this = { eexpr = TConst(TThis); etype = cl_t; epos = pos } in
 				let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 				let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 				let mk_int i = { eexpr = TConst(TInt ( Int32.of_int i)); etype = basic.tint; epos = pos } in
 				let mk_int i = { eexpr = TConst(TInt ( Int32.of_int i)); etype = basic.tint; epos = pos } in
@@ -4111,7 +4111,7 @@ struct
 							Some false
 							Some false
 						else if Meta.has Meta.HaxeGeneric cl.cl_meta then
 						else if Meta.has Meta.HaxeGeneric cl.cl_meta then
 							Some true
 							Some true
-						else if cl.cl_types = [] then
+						else if cl.cl_params = [] then
 							(cl.cl_meta <- (Meta.HaxeGeneric,[],cl.cl_pos) :: cl.cl_meta;
 							(cl.cl_meta <- (Meta.HaxeGeneric,[],cl.cl_pos) :: cl.cl_meta;
 							Some true)
 							Some true)
 						else if not (is_hxgen md) then
 						else if not (is_hxgen md) then
@@ -4129,7 +4129,7 @@ struct
 									Some false
 									Some false
 								| _ ->
 								| _ ->
 									(* see if it's a generic class *)
 									(* see if it's a generic class *)
-									match cl.cl_types with
+									match cl.cl_params with
 										| [] ->
 										| [] ->
 											(* if it's not, then it will be hxgeneric *)
 											(* if it's not, then it will be hxgeneric *)
 											cl.cl_meta <- (Meta.HaxeGeneric, [], cl.cl_pos) :: cl.cl_meta;
 											cl.cl_meta <- (Meta.HaxeGeneric, [], cl.cl_pos) :: cl.cl_meta;
@@ -4170,7 +4170,7 @@ struct
 							Some false
 							Some false
 						end else begin
 						end else begin
 							(* if enum is not generic, then it's hxgeneric *)
 							(* if enum is not generic, then it's hxgeneric *)
-							match e.e_types with
+							match e.e_params with
 								| [] ->
 								| [] ->
 									e.e_meta <- (Meta.HaxeGeneric, [], e.e_pos) :: e.e_meta;
 									e.e_meta <- (Meta.HaxeGeneric, [], e.e_pos) :: e.e_meta;
 									Some true
 									Some true
@@ -4248,28 +4248,28 @@ struct
 				let fields = List.fold_left (fun acc cf ->
 				let fields = List.fold_left (fun acc cf ->
 					match follow (gen.greal_type (gen.gfollow#run_f (cf.cf_type))) with
 					match follow (gen.greal_type (gen.gfollow#run_f (cf.cf_type))) with
 						| TInst(cli, ((_ :: _) as p)) when (not (is_hxgeneric (TClassDecl cli))) && params_has_tparams p ->
 						| TInst(cli, ((_ :: _) as p)) when (not (is_hxgeneric (TClassDecl cli))) && params_has_tparams p ->
-							(cf, apply_params cl.cl_types params_cl cf.cf_type, apply_params cl.cl_types params_cf cf.cf_type) :: acc
+							(cf, apply_params cl.cl_params params_cl cf.cf_type, apply_params cl.cl_params params_cf cf.cf_type) :: acc
 						| TEnum(e, ((_ :: _) as p)) when not (is_hxgeneric (TEnumDecl e)) && params_has_tparams p ->
 						| TEnum(e, ((_ :: _) as p)) when not (is_hxgeneric (TEnumDecl e)) && params_has_tparams p ->
-							(cf, apply_params cl.cl_types params_cl cf.cf_type, apply_params cl.cl_types params_cf cf.cf_type) :: acc
+							(cf, apply_params cl.cl_params params_cl cf.cf_type, apply_params cl.cl_params params_cf cf.cf_type) :: acc
 						| _ -> acc
 						| _ -> acc
 				) [] cl.cl_ordered_fields in
 				) [] cl.cl_ordered_fields in
 				match cl.cl_super with
 				match cl.cl_super with
 					| Some(cs, tls) ->
 					| Some(cs, tls) ->
-						get_fields gen cs (List.map (apply_params cl.cl_types params_cl) tls) (List.map (apply_params cl.cl_types params_cf) tls) (fields @ acc)
+						get_fields gen cs (List.map (apply_params cl.cl_params params_cl) tls) (List.map (apply_params cl.cl_params params_cf) tls) (fields @ acc)
 					| None -> (fields @ acc)
 					| None -> (fields @ acc)
 
 
 			(* overrides all needed cast functions from super classes / interfaces to call the new cast function *)
 			(* overrides all needed cast functions from super classes / interfaces to call the new cast function *)
 			let create_stub_casts gen cl cast_cfield =
 			let create_stub_casts gen cl cast_cfield =
 				(* go through superclasses and interfaces *)
 				(* go through superclasses and interfaces *)
 				let p = cl.cl_pos in
 				let p = cl.cl_pos in
-				let this = { eexpr = TConst TThis; etype = (TInst(cl, List.map snd cl.cl_types)); epos = p } in
+				let this = { eexpr = TConst TThis; etype = (TInst(cl, List.map snd cl.cl_params)); epos = p } in
 
 
 				let rec loop cls tls level reverse_params =
 				let rec loop cls tls level reverse_params =
 					if (level <> 0 || cls.cl_interface) && tls <> [] && is_hxgeneric (TClassDecl cls) then begin
 					if (level <> 0 || cls.cl_interface) && tls <> [] && is_hxgeneric (TClassDecl cls) then begin
-						let cparams = List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) cls.cl_types in
+						let cparams = List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) cls.cl_params in
 						let name = String.concat "_" ((fst cls.cl_path) @ [snd cls.cl_path; cast_field_name]) in
 						let name = String.concat "_" ((fst cls.cl_path) @ [snd cls.cl_path; cast_field_name]) in
 						if not (PMap.mem name cl.cl_fields) then begin
 						if not (PMap.mem name cl.cl_fields) then begin
-							let reverse_params = List.map (apply_params cls.cl_types (List.map snd cparams)) reverse_params in
+							let reverse_params = List.map (apply_params cls.cl_params (List.map snd cparams)) reverse_params in
 							let cfield = mk_class_field name (TFun([], t_dynamic)) false cl.cl_pos (Method MethNormal) cparams in
 							let cfield = mk_class_field name (TFun([], t_dynamic)) false cl.cl_pos (Method MethNormal) cparams in
 							let field = { eexpr = TField(this, FInstance(cl,cast_cfield)); etype = apply_params cast_cfield.cf_params reverse_params cast_cfield.cf_type; epos = p } in
 							let field = { eexpr = TField(this, FInstance(cl,cast_cfield)); etype = apply_params cast_cfield.cf_params reverse_params cast_cfield.cf_type; epos = p } in
 							let call =
 							let call =
@@ -4304,7 +4304,7 @@ struct
 						end
 						end
 					end;
 					end;
 					let get_reverse super supertl =
 					let get_reverse super supertl =
-						let kv = List.map2 (fun (_,tparam) applied -> (follow applied, follow tparam)) super.cl_types supertl in
+						let kv = List.map2 (fun (_,tparam) applied -> (follow applied, follow tparam)) super.cl_params supertl in
 						List.map (fun t ->
 						List.map (fun t ->
 							try
 							try
 								List.assq (follow t) kv
 								List.assq (follow t) kv
@@ -4319,7 +4319,7 @@ struct
 						loop iface ifacetl level (get_reverse iface ifacetl)
 						loop iface ifacetl level (get_reverse iface ifacetl)
 					) cls.cl_implements
 					) cls.cl_implements
 				in
 				in
-				loop cl (List.map snd cl.cl_types) 0 (List.map snd cl.cl_types)
+				loop cl (List.map snd cl.cl_params) 0 (List.map snd cl.cl_params)
 
 
 			(*
 			(*
 				Creates a cast classfield, with the desired name
 				Creates a cast classfield, with the desired name
@@ -4332,11 +4332,11 @@ struct
 			*)
 			*)
 			let create_cast_cfield gen cl name =
 			let create_cast_cfield gen cl name =
 				let basic = gen.gcon.basic in
 				let basic = gen.gcon.basic in
-				let cparams = List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) cl.cl_types in
+				let cparams = List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) cl.cl_params in
 				let cfield = mk_class_field name (TFun([], t_dynamic)) false cl.cl_pos (Method MethNormal) cparams in
 				let cfield = mk_class_field name (TFun([], t_dynamic)) false cl.cl_pos (Method MethNormal) cparams in
 				let params = List.map snd cparams in
 				let params = List.map snd cparams in
 
 
-				let fields = get_fields gen cl (List.map snd cl.cl_types) params [] in
+				let fields = get_fields gen cl (List.map snd cl.cl_params) params [] in
 
 
 				(* now create the contents of the function *)
 				(* now create the contents of the function *)
 				(*
 				(*
@@ -4363,7 +4363,7 @@ struct
 
 
 				let new_me_var = alloc_var "new_me" new_t in
 				let new_me_var = alloc_var "new_me" new_t in
 				let local_new_me = { eexpr = TLocal(new_me_var); etype = new_t; epos = pos } in
 				let local_new_me = { eexpr = TLocal(new_me_var); etype = new_t; epos = pos } in
-				let this = { eexpr = TConst(TThis); etype = (TInst(cl, List.map snd cl.cl_types)); epos = pos } in
+				let this = { eexpr = TConst(TThis); etype = (TInst(cl, List.map snd cl.cl_params)); epos = pos } in
 				let field_var = alloc_var "field" gen.gcon.basic.tstring in
 				let field_var = alloc_var "field" gen.gcon.basic.tstring in
 				let local_field = { eexpr = TLocal(field_var); etype = field_var.v_type; epos = pos } in
 				let local_field = { eexpr = TLocal(field_var); etype = field_var.v_type; epos = pos } in
 
 
@@ -4429,7 +4429,7 @@ struct
 								(* if (typeof(T) == typeof(T2)) return this *)
 								(* if (typeof(T) == typeof(T2)) return this *)
 								{
 								{
 									eexpr = TIf(
 									eexpr = TIf(
-										mk_typehandle_cond (List.map snd cl.cl_types) params,
+										mk_typehandle_cond (List.map snd cl.cl_params) params,
 										mk_return this,
 										mk_return this,
 										None);
 										None);
 									etype = basic.tvoid;
 									etype = basic.tvoid;
@@ -4525,9 +4525,9 @@ struct
 				let implement_stub_cast cthis iface tl =
 				let implement_stub_cast cthis iface tl =
 					let name = get_cast_name iface in
 					let name = get_cast_name iface in
 					if not (PMap.mem name cthis.cl_fields) then begin
 					if not (PMap.mem name cthis.cl_fields) then begin
-						let cparams = List.map (fun (s,t) -> ("To_" ^ s, TInst(map_param (get_cl_t t), []))) iface.cl_types in
+						let cparams = List.map (fun (s,t) -> ("To_" ^ s, TInst(map_param (get_cl_t t), []))) iface.cl_params in
 						let field = mk_class_field name (TFun([],t_dynamic)) false iface.cl_pos (Method MethNormal) cparams in
 						let field = mk_class_field name (TFun([],t_dynamic)) false iface.cl_pos (Method MethNormal) cparams in
-						let this = { eexpr = TConst TThis; etype = TInst(cthis, List.map snd cthis.cl_types); epos = cthis.cl_pos } in
+						let this = { eexpr = TConst TThis; etype = TInst(cthis, List.map snd cthis.cl_params); epos = cthis.cl_pos } in
 						field.cf_expr <- Some {
 						field.cf_expr <- Some {
 							etype = TFun([],t_dynamic);
 							etype = TFun([],t_dynamic);
 							epos = this.epos;
 							epos = this.epos;
@@ -4546,19 +4546,19 @@ struct
 
 
 				let rec run md =
 				let rec run md =
 					match md with
 					match md with
-						| TClassDecl ({ cl_extern = false; cl_types = [] } as cl) ->
+						| TClassDecl ({ cl_extern = false; cl_params = [] } as cl) ->
 							(* see if we're implementing any generic interface *)
 							(* see if we're implementing any generic interface *)
 							let rec check (iface,tl) =
 							let rec check (iface,tl) =
 								if tl <> [] && set_hxgeneric gen (TClassDecl iface) then
 								if tl <> [] && set_hxgeneric gen (TClassDecl iface) then
 									(* implement cast stub *)
 									(* implement cast stub *)
 									implement_stub_cast cl iface tl;
 									implement_stub_cast cl iface tl;
-								List.iter (fun (s,stl) -> check (s, List.map (apply_params iface.cl_types tl) stl)) iface.cl_implements;
+								List.iter (fun (s,stl) -> check (s, List.map (apply_params iface.cl_params tl) stl)) iface.cl_implements;
 							in
 							in
 							List.iter (check) cl.cl_implements;
 							List.iter (check) cl.cl_implements;
 							md
 							md
-						| TClassDecl ({ cl_extern = false; cl_types = hd :: tl } as cl) when set_hxgeneric gen md ->
+						| TClassDecl ({ cl_extern = false; cl_params = hd :: tl } as cl) when set_hxgeneric gen md ->
 							let iface = mk_class cl.cl_module cl.cl_path cl.cl_pos in
 							let iface = mk_class cl.cl_module cl.cl_path cl.cl_pos in
-							iface.cl_array_access <- Option.map (apply_params (cl.cl_types) (List.map (fun _ -> t_dynamic) cl.cl_types)) cl.cl_array_access;
+							iface.cl_array_access <- Option.map (apply_params (cl.cl_params) (List.map (fun _ -> t_dynamic) cl.cl_params)) cl.cl_array_access;
 							iface.cl_module <- cl.cl_module;
 							iface.cl_module <- cl.cl_module;
 							iface.cl_meta <- (Meta.HxGen, [], cl.cl_pos) :: iface.cl_meta;
 							iface.cl_meta <- (Meta.HxGen, [], cl.cl_pos) :: iface.cl_meta;
 							Hashtbl.add ifaces cl.cl_path iface;
 							Hashtbl.add ifaces cl.cl_path iface;
@@ -4707,19 +4707,19 @@ struct
 					i := 0;
 					i := 0;
 
 
 					found_types := PMap.empty;
 					found_types := PMap.empty;
-					List.iter iter_types cl.cl_types;
+					List.iter iter_types cl.cl_params;
 					let cur_found_types = !found_types in
 					let cur_found_types = !found_types in
 					List.iter (fun cf ->
 					List.iter (fun cf ->
 						found_types := cur_found_types;
 						found_types := cur_found_types;
 						List.iter iter_types cf.cf_params
 						List.iter iter_types cf.cf_params
 					) (cl.cl_ordered_fields @ cl.cl_ordered_statics)
 					) (cl.cl_ordered_fields @ cl.cl_ordered_statics)
 
 
-				| TEnumDecl ( ({ e_types = hd :: tl }) ) ->
+				| TEnumDecl ( ({ e_params = hd :: tl }) ) ->
 					i := 0;
 					i := 0;
 					found_types := PMap.empty;
 					found_types := PMap.empty;
 					List.iter iter_types (hd :: tl)
 					List.iter iter_types (hd :: tl)
 
 
-				| TAbstractDecl { a_types = hd :: tl } ->
+				| TAbstractDecl { a_params = hd :: tl } ->
 					i := 0;
 					i := 0;
 					found_types := PMap.empty;
 					found_types := PMap.empty;
 					List.iter iter_types (hd :: tl)
 					List.iter iter_types (hd :: tl)
@@ -5522,7 +5522,7 @@ struct
 				| TBinop ( (Ast.OpAssignOp _ as op),({ eexpr = TField(tf, f) } as e1), e2 ) ->
 				| TBinop ( (Ast.OpAssignOp _ as op),({ eexpr = TField(tf, f) } as e1), e2 ) ->
 					(match field_access_esp gen (gen.greal_type tf.etype) (f) with
 					(match field_access_esp gen (gen.greal_type tf.etype) (f) with
 						| FClassField(cl,params,_,_,is_static,actual_t,_) ->
 						| FClassField(cl,params,_,_,is_static,actual_t,_) ->
-							let actual_t = if is_static then actual_t else apply_params cl.cl_types params actual_t in
+							let actual_t = if is_static then actual_t else apply_params cl.cl_params params actual_t in
 							let e1 = extract_expr (run e1) in
 							let e1 = extract_expr (run e1) in
 							{ e with eexpr = TBinop(op, e1, handle (run e2) actual_t e2.etype); etype = e1.etype }
 							{ e with eexpr = TBinop(op, e1, handle (run e2) actual_t e2.etype); etype = e1.etype }
 						| _ ->
 						| _ ->
@@ -5560,9 +5560,9 @@ struct
 				| None -> false
 				| None -> false
 				| Some (cs,tls) ->
 				| Some (cs,tls) ->
 					let tls = gen.greal_type_param (TClassDecl cs) tls in
 					let tls = gen.greal_type_param (TClassDecl cs) tls in
-					loop cs (List.map (apply_params c.cl_types tl) tls)
+					loop cs (List.map (apply_params c.cl_params tl) tls)
 			) || (if also_implements then List.exists (fun (cs,tls) ->
 			) || (if also_implements then List.exists (fun (cs,tls) ->
-				loop cs (List.map (apply_params c.cl_types tl) tls)
+				loop cs (List.map (apply_params c.cl_params tl) tls)
 			) c.cl_implements else false)
 			) c.cl_implements else false)
 		in
 		in
 		loop
 		loop
@@ -5799,9 +5799,9 @@ struct
 					mk_cast to_t e
 					mk_cast to_t e
 			| _, TAnon(anon) -> (try
 			| _, TAnon(anon) -> (try
 				let p2 = match !(anon.a_status) with
 				let p2 = match !(anon.a_status) with
-				| Statics c -> TInst(c,List.map (fun _ -> t_dynamic) c.cl_types)
-				| EnumStatics e -> TEnum(e, List.map (fun _ -> t_dynamic) e.e_types)
-				| AbstractStatics a -> TAbstract(a, List.map (fun _ -> t_dynamic) a.a_types)
+				| Statics c -> TInst(c,List.map (fun _ -> t_dynamic) c.cl_params)
+				| EnumStatics e -> TEnum(e, List.map (fun _ -> t_dynamic) e.e_params)
+				| AbstractStatics a -> TAbstract(a, List.map (fun _ -> t_dynamic) a.a_params)
 				| _ -> raise Not_found
 				| _ -> raise Not_found
 				in
 				in
 				let tclass = match get_type gen ([],"Class") with
 				let tclass = match get_type gen ([],"Class") with
@@ -5969,7 +5969,7 @@ struct
 				tl
 				tl
 			else match c.cl_super with
 			else match c.cl_super with
 			| None -> stl
 			| None -> stl
-			| Some(sup,stl) -> get_changed_stl sup (List.map (apply_params c.cl_types tl) stl)
+			| Some(sup,stl) -> get_changed_stl sup (List.map (apply_params c.cl_params tl) stl)
 		in
 		in
 		let ret_tparams = List.map (fun t -> match follow t with
 		let ret_tparams = List.map (fun t -> match follow t with
 		| TDynamic _ | TMono _ -> t_empty
 		| TDynamic _ | TMono _ -> t_empty
@@ -6005,7 +6005,7 @@ struct
 			| _ -> false
 			| _ -> false
 		in
 		in
 		let rec check_cf cf =
 		let rec check_cf cf =
-			let t = apply_params sup.cl_types stl cf.cf_type in
+			let t = apply_params sup.cl_params stl cf.cf_type in
 			replace_mono t;
 			replace_mono t;
 			let args, _ = get_fun t in
 			let args, _ = get_fun t in
 			check_arg args etl
 			check_arg args etl
@@ -6070,7 +6070,7 @@ struct
 							(* FIXME: this is a workaround for issue #1743 . Uncomment this code after it was solved *)
 							(* FIXME: this is a workaround for issue #1743 . Uncomment this code after it was solved *)
 							(* let t, cf = List.find (fun (t,cf2) -> cf == cf2) (Typeload.get_overloads cl (field_name f)) in *)
 							(* let t, cf = List.find (fun (t,cf2) -> cf == cf2) (Typeload.get_overloads cl (field_name f)) in *)
 							(* cf, t, false *)
 							(* cf, t, false *)
-							select_overload gen e1.etype (Typeload.get_overloads cl (field_name f)) cl.cl_types params, false
+							select_overload gen e1.etype (Typeload.get_overloads cl (field_name f)) cl.cl_params params, false
 						| FStatic(c,f) ->
 						| FStatic(c,f) ->
 							(* workaround for issue #1743 *)
 							(* workaround for issue #1743 *)
 							(* f,f.cf_type, false *)
 							(* f,f.cf_type, false *)
@@ -6087,7 +6087,7 @@ struct
 								eexpr = TCall(
 								eexpr = TCall(
 									{ eexpr = TLocal(alloc_var "__as__" t_dynamic); etype = t_dynamic; epos = pos },
 									{ eexpr = TLocal(alloc_var "__as__" t_dynamic); etype = t_dynamic; epos = pos },
 									[!ef]);
 									[!ef]);
-								etype = TInst(declared_cl,List.map (apply_params cl.cl_types params) tl);
+								etype = TInst(declared_cl,List.map (apply_params cl.cl_params params) tl);
 								epos = pos
 								epos = pos
 							}
 							}
 						end;
 						end;
@@ -6115,12 +6115,12 @@ struct
 					(* infer arguments *)
 					(* infer arguments *)
 					(* let called_t = TFun(List.map (fun e -> "arg",false,e.etype) elist, ecall.etype) in *)
 					(* let called_t = TFun(List.map (fun e -> "arg",false,e.etype) elist, ecall.etype) in *)
 					let called_t = match follow e1.etype with | TFun _ -> e1.etype | _ -> TFun(List.map (fun e -> "arg",false,e.etype) elist, ecall.etype)	in (* workaround for issue #1742 *)
 					let called_t = match follow e1.etype with | TFun _ -> e1.etype | _ -> TFun(List.map (fun e -> "arg",false,e.etype) elist, ecall.etype)	in (* workaround for issue #1742 *)
-					let fparams = TypeParams.infer_params gen ecall.epos (get_fun (apply_params cl.cl_types params actual_t)) (get_fun called_t) cf.cf_params calls_parameters_explicitly in
+					let fparams = TypeParams.infer_params gen ecall.epos (get_fun (apply_params cl.cl_params params actual_t)) (get_fun called_t) cf.cf_params calls_parameters_explicitly in
 					(* get what the backend actually sees *)
 					(* get what the backend actually sees *)
 					(* actual field's function *)
 					(* actual field's function *)
 					let actual_t = get_real_fun gen actual_t in
 					let actual_t = get_real_fun gen actual_t in
 					let real_params = gen.greal_type_param (TClassDecl cl) params in
 					let real_params = gen.greal_type_param (TClassDecl cl) params in
-					let function_t = apply_params cl.cl_types real_params actual_t in
+					let function_t = apply_params cl.cl_params real_params actual_t in
 					let real_fparams = if calls_parameters_explicitly then
 					let real_fparams = if calls_parameters_explicitly then
 						gen.greal_type_param (TClassDecl cl) fparams
 						gen.greal_type_param (TClassDecl cl) fparams
 					else
 					else
@@ -6164,13 +6164,13 @@ struct
 				end
 				end
 		| FClassField (cl,params,_,{ cf_kind = (Method MethDynamic | Var _) },_,actual_t,_) ->
 		| FClassField (cl,params,_,{ cf_kind = (Method MethDynamic | Var _) },_,actual_t,_) ->
 			(* if it's a var, we will just try to apply the class parameters that have been changed with greal_type_param *)
 			(* if it's a var, we will just try to apply the class parameters that have been changed with greal_type_param *)
-			let t = apply_params cl.cl_types (gen.greal_type_param (TClassDecl cl) params) (gen.greal_type actual_t) in
+			let t = apply_params cl.cl_params (gen.greal_type_param (TClassDecl cl) params) (gen.greal_type actual_t) in
 			return_var (handle_cast gen { e1 with eexpr = TField(ef, f) } (gen.greal_type e1.etype) (gen.greal_type t))
 			return_var (handle_cast gen { e1 with eexpr = TField(ef, f) } (gen.greal_type e1.etype) (gen.greal_type t))
 		| FClassField (cl,params,_,cf,_,actual_t,_) ->
 		| FClassField (cl,params,_,cf,_,actual_t,_) ->
 			return_var (handle_cast gen { e1 with eexpr = TField({ ef with etype = t_dynamic }, f) } e1.etype t_dynamic) (* force dynamic and cast back to needed type *)
 			return_var (handle_cast gen { e1 with eexpr = TField({ ef with etype = t_dynamic }, f) } e1.etype t_dynamic) (* force dynamic and cast back to needed type *)
 		| FEnumField (en, efield, true) ->
 		| FEnumField (en, efield, true) ->
 			let ecall = match e with | None -> trace (field_name f); trace efield.ef_name; gen.gcon.error "This field should be called immediately" ef.epos; assert false | Some ecall -> ecall in
 			let ecall = match e with | None -> trace (field_name f); trace efield.ef_name; gen.gcon.error "This field should be called immediately" ef.epos; assert false | Some ecall -> ecall in
-			(match en.e_types with
+			(match en.e_params with
 				(*
 				(*
 				| [] ->
 				| [] ->
 					let args, ret = get_args (efield.ef_type) in
 					let args, ret = get_args (efield.ef_type) in
@@ -6189,7 +6189,7 @@ struct
 					let cf_params = List.map (fun t -> match follow t with | TDynamic _ -> t_empty | _ -> t) _params in
 					let cf_params = List.map (fun t -> match follow t with | TDynamic _ -> t_empty | _ -> t) _params in
 					(* params are inverted *)
 					(* params are inverted *)
 					let cf_params = List.rev cf_params in
 					let cf_params = List.rev cf_params in
-					let t = apply_params en.e_types (gen.greal_type_param (TEnumDecl en) cf_params) actual_t in
+					let t = apply_params en.e_params (gen.greal_type_param (TEnumDecl en) cf_params) actual_t in
 					let t = apply_params efield.ef_params (List.map (fun _ -> t_dynamic) efield.ef_params) t in
 					let t = apply_params efield.ef_params (List.map (fun _ -> t_dynamic) efield.ef_params) t in
 
 
 					let args, ret = get_args t in
 					let args, ret = get_args t in
@@ -6285,7 +6285,7 @@ struct
 								handle e t1 t2
 								handle e t1 t2
 						in
 						in
 						let stl = gen.greal_type_param (TClassDecl sup) stl in
 						let stl = gen.greal_type_param (TClassDecl sup) stl in
-						let args, _ = get_fun (apply_params sup.cl_types stl cf.cf_type) in
+						let args, _ = get_fun (apply_params sup.cl_params stl cf.cf_type) in
 						let eparams = List.map2 (fun e (_,_,t) ->
 						let eparams = List.map2 (fun e (_,_,t) ->
 							handle (run e) t e.etype
 							handle (run e) t e.etype
 						) eparams args in
 						) eparams args in
@@ -6314,7 +6314,7 @@ struct
 							handle e t1 t2
 							handle e t1 t2
 					in
 					in
 					let stl = gen.greal_type_param (TClassDecl sup) stl in
 					let stl = gen.greal_type_param (TClassDecl sup) stl in
-					let args, _ = get_fun (apply_params sup.cl_types stl cf.cf_type) in
+					let args, _ = get_fun (apply_params sup.cl_params stl cf.cf_type) in
 					let eparams = List.map2 (fun e (_,_,t) ->
 					let eparams = List.map2 (fun e (_,_,t) ->
 						handle (run e) t e.etype
 						handle (run e) t e.etype
 					) eparams args in
 					) eparams args in
@@ -6344,8 +6344,8 @@ struct
 								| Some t ->
 								| Some t ->
 									(* if it does, apply current parameters (and change them) *)
 									(* if it does, apply current parameters (and change them) *)
 									(* let real_t = apply_params_internal (List.map (gen.greal_type_param (TClassDecl cl))) cl params t in *)
 									(* let real_t = apply_params_internal (List.map (gen.greal_type_param (TClassDecl cl))) cl params t in *)
-									let param = apply_params cl.cl_types (gen.greal_type_param (TClassDecl cl) params) t in
-									let real_t = apply_params cl.cl_types params param in
+									let param = apply_params cl.cl_params (gen.greal_type_param (TClassDecl cl) params) t in
+									let real_t = apply_params cl.cl_params params param in
 									(* see if it needs a cast *)
 									(* see if it needs a cast *)
 
 
 									handle (e) (gen.greal_type e.etype) (gen.greal_type real_t)
 									handle (e) (gen.greal_type e.etype) (gen.greal_type real_t)
@@ -6752,7 +6752,7 @@ struct
 			}
 			}
 		in
 		in
 
 
-		let this_t = TInst(cl, List.map snd cl.cl_types) in
+		let this_t = TInst(cl, List.map snd cl.cl_params) in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 		if ctx.rcf_optimize then
 		if ctx.rcf_optimize then
@@ -6911,7 +6911,7 @@ struct
 
 
 	let get_delete_field ctx cl is_dynamic =
 	let get_delete_field ctx cl is_dynamic =
 		let pos = cl.cl_pos in
 		let pos = cl.cl_pos in
-		let this_t = TInst(cl, List.map snd cl.cl_types) in
+		let this_t = TInst(cl, List.map snd cl.cl_params) in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let gen = ctx.rcf_gen in
 		let gen = ctx.rcf_gen in
 		let basic = gen.gcon.basic in
 		let basic = gen.gcon.basic in
@@ -7057,7 +7057,7 @@ struct
 			alloc_var name t, None
 			alloc_var name t, None
 		) fields in
 		) fields in
 
 
-		let this = { eexpr = TConst TThis; etype = TInst(cl, List.map snd cl.cl_types); epos = pos } in
+		let this = { eexpr = TConst TThis; etype = TInst(cl, List.map snd cl.cl_params); epos = pos } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 		let fun_t = TFun(fun_args tf_args,basic.tvoid) in
 		let fun_t = TFun(fun_args tf_args,basic.tvoid) in
 		let ctor = mk_class_field "new" fun_t true pos (Method MethNormal) [] in
 		let ctor = mk_class_field "new" fun_t true pos (Method MethNormal) [] in
@@ -7237,7 +7237,7 @@ struct
 		let basic = gen.gcon.basic in
 		let basic = gen.gcon.basic in
 		let pos = cl.cl_pos in
 		let pos = cl.cl_pos in
 		let is_override = is_override cl in
 		let is_override = is_override cl in
-		let tparams = List.map (fun _ -> t_empty) cl.cl_types in
+		let tparams = List.map (fun _ -> t_empty) cl.cl_params in
 
 
 		let create =
 		let create =
 			let arr = alloc_var "arr" (basic.tarray t_dynamic) in
 			let arr = alloc_var "arr" (basic.tarray t_dynamic) in
@@ -7326,7 +7326,7 @@ struct
 		let pos = cl.cl_pos in
 		let pos = cl.cl_pos in
 		let is_override = is_override cl in
 		let is_override = is_override cl in
 
 
-		let this = { eexpr = TConst(TThis); etype = TInst(cl, List.map snd cl.cl_types); epos = pos } in
+		let this = { eexpr = TConst(TThis); etype = TInst(cl, List.map snd cl.cl_params); epos = pos } in
 
 
 		(*
 		(*
 			this function will create the class fields and call callback for each version
 			this function will create the class fields and call callback for each version
@@ -7452,7 +7452,7 @@ struct
 			let handle_prop = alloc_var "handleProperties" basic.tbool in
 			let handle_prop = alloc_var "handleProperties" basic.tbool in
 			let handle_prop_local = mk_local handle_prop pos in
 			let handle_prop_local = mk_local handle_prop pos in
 
 
-			let this = { eexpr = TConst TThis; etype = TInst(cl, List.map snd cl.cl_types); epos = pos } in
+			let this = { eexpr = TConst TThis; etype = TInst(cl, List.map snd cl.cl_params); epos = pos } in
 			let mk_this_call_raw name fun_t params =
 			let mk_this_call_raw name fun_t params =
 				{ eexpr = TCall( { (mk_field_access gen this name pos) with etype = fun_t; }, params ); etype = snd (get_args fun_t); epos = pos }
 				{ eexpr = TCall( { (mk_field_access gen this name pos) with etype = fun_t; }, params ); etype = snd (get_args fun_t); epos = pos }
 			in
 			in
@@ -7465,7 +7465,7 @@ struct
 
 
 			let maybe_cast e = e in
 			let maybe_cast e = e in
 
 
-			let t = TInst(cl, List.map snd cl.cl_types) in
+			let t = TInst(cl, List.map snd cl.cl_params) in
 
 
 			(* if it's not latest hxgen class -> check super *)
 			(* if it's not latest hxgen class -> check super *)
 			let mk_do_default args do_default =
 			let mk_do_default args do_default =
@@ -7834,7 +7834,7 @@ struct
 							(if is_some if_not_inst then get if_not_inst else []) @
 							(if is_some if_not_inst then get if_not_inst else []) @
 							[{
 							[{
 								eexpr = TCall(
 								eexpr = TCall(
-									{ eexpr = TField({ eexpr = TConst TSuper; etype = TInst(cl, List.map snd cl.cl_types); epos = pos }, FInstance(cl, cf)); etype = t; epos = pos },
+									{ eexpr = TField({ eexpr = TConst TSuper; etype = TInst(cl, List.map snd cl.cl_params); epos = pos }, FInstance(cl, cf)); etype = t; epos = pos },
 									base_arr :: (if ctx.rcf_handle_statics then [is_inst] else [])
 									base_arr :: (if ctx.rcf_handle_statics then [is_inst] else [])
 								);
 								);
 								etype = basic.tvoid;
 								etype = basic.tvoid;
@@ -7914,7 +7914,7 @@ struct
 		in
 		in
 		(* register_cf cf false; *)
 		(* register_cf cf false; *)
 
 
-		let this_t = TInst(cl, List.map snd cl.cl_types) in
+		let this_t = TInst(cl, List.map snd cl.cl_params) in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 		let proxy = mk_this name t in
 		let proxy = mk_this name t in
@@ -8046,7 +8046,7 @@ struct
 		let pos = cl.cl_pos in
 		let pos = cl.cl_pos in
 
 
 		let tclass = get_cl ( (Hashtbl.find gen.gtypes ([],"Class")) ) in
 		let tclass = get_cl ( (Hashtbl.find gen.gtypes ([],"Class")) ) in
-		let cls = TInst(tclass, [ TInst(cl, List.map (fun _ -> t_dynamic) cl.cl_types) ]) in
+		let cls = TInst(tclass, [ TInst(cl, List.map (fun _ -> t_dynamic) cl.cl_params) ]) in
 		let cls_dyn = TInst(tclass, [t_dynamic]) in
 		let cls_dyn = TInst(tclass, [t_dynamic]) in
 
 
 		let expr, static_cfs =
 		let expr, static_cfs =
@@ -8062,7 +8062,7 @@ struct
 
 
 
 
 				let create_expr = {
 				let create_expr = {
-					eexpr = TNew(get ctx.rcf_class_cl, [], [gen.gtools.rf_create_empty cl (List.map (fun _ -> t_dynamic) cl.cl_types) pos]);
+					eexpr = TNew(get ctx.rcf_class_cl, [], [gen.gtools.rf_create_empty cl (List.map (fun _ -> t_dynamic) cl.cl_params) pos]);
 					etype = cls;
 					etype = cls;
 					epos = pos
 					epos = pos
 				} in
 				} in
@@ -8149,7 +8149,7 @@ struct
 		let all_args = field_args @ (if ctx.rcf_handle_statics then [ is_static,None; dynamic_arg,None ] else [ dynamic_arg, None ] ) in
 		let all_args = field_args @ (if ctx.rcf_handle_statics then [ is_static,None; dynamic_arg,None ] else [ dynamic_arg, None ] ) in
 		let fun_t = TFun(fun_args all_args, t_dynamic) in
 		let fun_t = TFun(fun_args all_args, t_dynamic) in
 
 
-		let this_t = TInst(cl, List.map snd cl.cl_types) in
+		let this_t = TInst(cl, List.map snd cl.cl_params) in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let apply_object cf = apply_params cf.cf_params (List.map (fun _ -> t_dynamic) cf.cf_params) cf.cf_type in
 		let apply_object cf = apply_params cf.cf_params (List.map (fun _ -> t_dynamic) cf.cf_params) cf.cf_type in
 
 
@@ -8303,7 +8303,7 @@ struct
 		let gen = ctx.rcf_gen in
 		let gen = ctx.rcf_gen in
 		let basic = gen.gcon.basic in
 		let basic = gen.gcon.basic in
 
 
-		let this_t = TInst(cl, List.map snd cl.cl_types) in
+		let this_t = TInst(cl, List.map snd cl.cl_params) in
 		let this = { eexpr = TConst(TThis); etype = this_t ; epos = pos } in
 		let this = { eexpr = TConst(TThis); etype = this_t ; epos = pos } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 
 
@@ -8362,7 +8362,7 @@ struct
 		let field_args, _ = field_type_args ctx pos in
 		let field_args, _ = field_type_args ctx pos in
 		let obj_arg = alloc_var "target" (TInst(ctx.rcf_object_iface, [])) in
 		let obj_arg = alloc_var "target" (TInst(ctx.rcf_object_iface, [])) in
 
 
-		let this_t = TInst(cl, List.map snd cl.cl_types) in
+		let this_t = TInst(cl, List.map snd cl.cl_params) in
 		let this = { eexpr = TConst(TThis); etype = this_t ; epos = pos } in
 		let this = { eexpr = TConst(TThis); etype = this_t ; epos = pos } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 		let mk_this field t = { (mk_field_access gen this field pos) with etype = t } in
 
 
@@ -8500,7 +8500,7 @@ struct
 		let gen = ctx.rcf_gen in
 		let gen = ctx.rcf_gen in
 		let pos = cl.cl_pos in
 		let pos = cl.cl_pos in
 
 
-		let this_t = TInst(cl, List.map snd cl.cl_types) in
+		let this_t = TInst(cl, List.map snd cl.cl_params) in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 		let this = { eexpr = TConst(TThis); etype = this_t; epos = pos } in
 
 
 		let last_fields = match cl.cl_super with
 		let last_fields = match cl.cl_super with
@@ -8779,12 +8779,12 @@ struct
 				| _ -> ());
 				| _ -> ());
 			let c_types =
 			let c_types =
 				if handle_type_params then
 				if handle_type_params then
-					List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) en.e_types
+					List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) en.e_params
 				else
 				else
 					[]
 					[]
 			in
 			in
 
 
-			cl.cl_types <- c_types;
+			cl.cl_params <- c_types;
 
 
 			let i = ref 0 in
 			let i = ref 0 in
 			let cfs = List.map (fun name ->
 			let cfs = List.map (fun name ->
@@ -8797,14 +8797,14 @@ struct
 					| TFun(params,ret) ->
 					| TFun(params,ret) ->
 						let dup_types =
 						let dup_types =
 							if handle_type_params then
 							if handle_type_params then
-								List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) en.e_types
+								List.map (fun (s,t) -> (s, TInst (map_param (get_cl_t t), []))) en.e_params
 							else
 							else
 								[]
 								[]
 						in
 						in
 
 
 						let ef_type =
 						let ef_type =
-							let fn, types = if handle_type_params then snd, dup_types else (fun _ -> t_dynamic), en.e_types in
-							let t = apply_params en.e_types (List.map fn types) ef.ef_type in
+							let fn, types = if handle_type_params then snd, dup_types else (fun _ -> t_dynamic), en.e_params in
+							let t = apply_params en.e_params (List.map fn types) ef.ef_type in
 							apply_params ef.ef_params (List.map fn ef.ef_params) t
 							apply_params ef.ef_params (List.map fn ef.ef_params) t
 						in
 						in
 
 
@@ -8835,8 +8835,8 @@ struct
 						let cf = mk_class_field name actual_t true pos (Var { v_read = AccNormal; v_write = AccNormal }) [] in
 						let cf = mk_class_field name actual_t true pos (Var { v_read = AccNormal; v_write = AccNormal }) [] in
 						cf.cf_meta <- [];
 						cf.cf_meta <- [];
 						cf.cf_expr <- Some {
 						cf.cf_expr <- Some {
-							eexpr = TNew(cl, List.map (fun _ -> t_empty) cl.cl_types, [mk_int gen old_i pos; { eexpr = TArrayDecl []; etype = basic.tarray t_empty; epos = pos }]);
-							etype = TInst(cl, List.map (fun _ -> t_empty) cl.cl_types);
+							eexpr = TNew(cl, List.map (fun _ -> t_empty) cl.cl_params, [mk_int gen old_i pos; { eexpr = TArrayDecl []; etype = basic.tarray t_empty; epos = pos }]);
+							etype = TInst(cl, List.map (fun _ -> t_empty) cl.cl_params);
 							epos = pos;
 							epos = pos;
 						};
 						};
 						cf
 						cf
@@ -8862,7 +8862,7 @@ struct
 				let tf_args = [ alloc_var "index" basic.tint, None; alloc_var "params" (basic.tarray t_empty), None ] in
 				let tf_args = [ alloc_var "index" basic.tint, None; alloc_var "params" (basic.tarray t_empty), None ] in
 				let ftype = TFun(fun_args tf_args, basic.tvoid) in
 				let ftype = TFun(fun_args tf_args, basic.tvoid) in
 				let ctor = mk_class_field "new" ftype true pos (Method MethNormal) [] in
 				let ctor = mk_class_field "new" ftype true pos (Method MethNormal) [] in
-				let me = TInst(cl, List.map snd cl.cl_types) in
+				let me = TInst(cl, List.map snd cl.cl_params) in
 				ctor.cf_expr <-
 				ctor.cf_expr <-
 				Some {
 				Some {
 					eexpr = TFunction(
 					eexpr = TFunction(
@@ -9174,7 +9174,7 @@ struct
 				try match follow v.v_type with
 				try match follow v.v_type with
 					| TInst(cl, params) ->
 					| TInst(cl, params) ->
 						let field = PMap.find name cl.cl_fields in
 						let field = PMap.find name cl.cl_fields in
-						apply_params cl.cl_types params field.cf_type
+						apply_params cl.cl_params params field.cf_type
 					| TAnon(anon) ->
 					| TAnon(anon) ->
 						let field = PMap.find name anon.a_fields in
 						let field = PMap.find name anon.a_fields in
 						field.cf_type
 						field.cf_type
@@ -9337,7 +9337,7 @@ struct
 								List.map (fun e -> match e.eexpr with
 								List.map (fun e -> match e.eexpr with
 								| TConst(TInt i) ->
 								| TConst(TInt i) ->
 									let ef = Hashtbl.find fields (Int32.to_int i) in
 									let ef = Hashtbl.find fields (Int32.to_int i) in
-									{ e with eexpr = TField(enum_expr, FEnum(real_enum,ef)); etype = TEnum(real_enum,List.map (fun _ -> t_dynamic) real_enum.e_types) }
+									{ e with eexpr = TField(enum_expr, FEnum(real_enum,ef)); etype = TEnum(real_enum,List.map (fun _ -> t_dynamic) real_enum.e_params) }
 								| _ -> raise Not_found) el, e
 								| _ -> raise Not_found) el, e
 							) cases in
 							) cases in
 							{ e with eexpr = TSwitch(enum,cases,default) }
 							{ e with eexpr = TSwitch(enum,cases,default) }
@@ -9455,7 +9455,7 @@ struct
 		| TMono r -> (match !r with | Some t -> is_null_t gen t | None -> None)
 		| TMono r -> (match !r with | Some t -> is_null_t gen t | None -> None)
 		| TLazy f -> is_null_t gen (!f())
 		| TLazy f -> is_null_t gen (!f())
 		| TType (t, tl) ->
 		| TType (t, tl) ->
-			is_null_t gen (apply_params t.t_types tl t.t_type)
+			is_null_t gen (apply_params t.t_params tl t.t_type)
 		| _ -> None
 		| _ -> None
 
 
 	let follow_addon gen t =
 	let follow_addon gen t =
@@ -10513,7 +10513,7 @@ struct
 						List.iter (function
 						List.iter (function
 							| cf when Meta.has Meta.Impl cf.cf_meta ->
 							| cf when Meta.has Meta.Impl cf.cf_meta ->
 									(* add type parameters to all implementation functions *)
 									(* add type parameters to all implementation functions *)
-									cf.cf_params <- cf.cf_params @ a.a_types
+									cf.cf_params <- cf.cf_params @ a.a_params
 							| _ -> ()
 							| _ -> ()
 						) c.cl_ordered_statics;
 						) c.cl_ordered_statics;
 						Some md
 						Some md
@@ -10572,15 +10572,15 @@ struct
 				) c.cl_ordered_fields;
 				) c.cl_ordered_fields;
 				md
 				md
 			| TClassDecl({ cl_extern = false } as c) ->
 			| TClassDecl({ cl_extern = false } as c) ->
-				let this = { eexpr = TConst TThis; etype = TInst(c,List.map snd c.cl_types); epos = c.cl_pos } in
+				let this = { eexpr = TConst TThis; etype = TInst(c,List.map snd c.cl_params); epos = c.cl_pos } in
 				(* look through all interfaces, and try to find a type that applies exactly *)
 				(* look through all interfaces, and try to find a type that applies exactly *)
 				let rec loop_iface (iface:tclass) itl =
 				let rec loop_iface (iface:tclass) itl =
-					List.iter (fun (s,stl) -> loop_iface s (List.map (apply_params iface.cl_types itl) stl)) iface.cl_implements;
+					List.iter (fun (s,stl) -> loop_iface s (List.map (apply_params iface.cl_params itl) stl)) iface.cl_implements;
 					let real_itl = gen.greal_type_param (TClassDecl iface) itl in
 					let real_itl = gen.greal_type_param (TClassDecl iface) itl in
 					let rec loop_f f =
 					let rec loop_f f =
 						List.iter loop_f f.cf_overloads;
 						List.iter loop_f f.cf_overloads;
-						let ftype = apply_params iface.cl_types itl f.cf_type in
-						let real_ftype = get_real_fun gen (apply_params iface.cl_types real_itl f.cf_type) in
+						let ftype = apply_params iface.cl_params itl f.cf_type in
+						let real_ftype = get_real_fun gen (apply_params iface.cl_params real_itl f.cf_type) in
 						replace_mono real_ftype;
 						replace_mono real_ftype;
 						let overloads = Typeload.get_overloads c f.cf_name in
 						let overloads = Typeload.get_overloads c f.cf_name in
 						try
 						try
@@ -10592,7 +10592,7 @@ struct
 										Typeload.same_overload_args ftype t f f2
 										Typeload.same_overload_args ftype t f f2
 									) overloads
 									) overloads
 								| _ :: _ ->
 								| _ :: _ ->
-									(match field_access gen (TInst(c, List.map snd c.cl_types)) f.cf_name with
+									(match field_access gen (TInst(c, List.map snd c.cl_params)) f.cf_name with
 									| FClassField(_,_,_,f2,false,t,_) -> t,f2 (* if it's not an overload, all functions should have the same signature *)
 									| FClassField(_,_,_,f2,false,t,_) -> t,f2 (* if it's not an overload, all functions should have the same signature *)
 									| _ -> raise Not_found)
 									| _ -> raise Not_found)
 								| [] -> raise Not_found
 								| [] -> raise Not_found
@@ -10704,7 +10704,7 @@ struct
 											eexpr = TCall(
 											eexpr = TCall(
 												{
 												{
 													eexpr = TField(
 													eexpr = TField(
-														{ eexpr = TConst TThis; etype = TInst(c, List.map snd c.cl_types); epos = p },
+														{ eexpr = TConst TThis; etype = TInst(c, List.map snd c.cl_params); epos = p },
 														FInstance(c,f));
 														FInstance(c,f));
 													etype = f.cf_type;
 													etype = f.cf_type;
 													epos = p
 													epos = p

+ 9 - 9
gencpp.ml

@@ -613,14 +613,14 @@ and type_string_suff suffix haxe_type =
          | [t] -> "const " ^ (type_string (follow t) ) ^ " *"
          | [t] -> "const " ^ (type_string (follow t) ) ^ " *"
          | _ -> assert false)
          | _ -> assert false)
       | ["cpp"] , "Function" -> "::cpp::Function< " ^ (cpp_function_signature_params params) ^ " >"
       | ["cpp"] , "Function" -> "::cpp::Function< " ^ (cpp_function_signature_params params) ^ " >"
-      | _ ->  type_string_suff suffix (apply_params type_def.t_types params type_def.t_type)
+      | _ ->  type_string_suff suffix (apply_params type_def.t_params params type_def.t_type)
       )
       )
    | TFun (args,haxe_type) -> "Dynamic" ^ suffix
    | TFun (args,haxe_type) -> "Dynamic" ^ suffix
    | TAnon a -> "Dynamic"
    | TAnon a -> "Dynamic"
       (*
       (*
       (match !(a.a_status) with
       (match !(a.a_status) with
-      | Statics c -> type_string_suff suffix (TInst (c,List.map snd c.cl_types))
-      | EnumStatics e -> type_string_suff suffix (TEnum (e,List.map snd e.e_types))
+      | Statics c -> type_string_suff suffix (TInst (c,List.map snd c.cl_params))
+      | EnumStatics e -> type_string_suff suffix (TEnum (e,List.map snd e.e_params))
       | _ -> "Dynamic"  ^ suffix )
       | _ -> "Dynamic"  ^ suffix )
       *)
       *)
    | TDynamic haxe_type -> "Dynamic" ^ suffix
    | TDynamic haxe_type -> "Dynamic" ^ suffix
@@ -2715,7 +2715,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
          visited := List.tl !visited;
          visited := List.tl !visited;
       end
       end
    in
    in
-   let rec visit_types expression =
+   let rec visit_params expression =
       begin
       begin
       let rec visit_expression = fun expression ->
       let rec visit_expression = fun expression ->
          (* Expand out TTypeExpr (ie, the name of a class, as used for static access etc ... *)
          (* Expand out TTypeExpr (ie, the name of a class, as used for static access etc ... *)
@@ -2770,7 +2770,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
       visit_type field.cf_type;
       visit_type field.cf_type;
       if (not header_only) then
       if (not header_only) then
          (match field.cf_expr with
          (match field.cf_expr with
-         | Some expression -> visit_types expression | _ -> ());
+         | Some expression -> visit_params expression | _ -> ());
    in
    in
    let visit_class class_def =
    let visit_class class_def =
       let fields = List.append class_def.cl_ordered_fields class_def.cl_ordered_statics in
       let fields = List.append class_def.cl_ordered_fields class_def.cl_ordered_statics in
@@ -2793,7 +2793,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
          ) enum_def.e_constrs;
          ) enum_def.e_constrs;
       if (not header_only) then begin
       if (not header_only) then begin
          let meta = Codegen.build_metadata ctx (TEnumDecl enum_def) in
          let meta = Codegen.build_metadata ctx (TEnumDecl enum_def) in
-         match meta with Some expr -> visit_types expr | _ -> ();
+         match meta with Some expr -> visit_params expr | _ -> ();
       end;
       end;
    in
    in
    let inc_cmp i1 i2 =
    let inc_cmp i1 i2 =
@@ -2803,7 +2803,7 @@ let find_referenced_types ctx obj super_deps constructor_deps header_only for_de
    (* Body of main function *)
    (* Body of main function *)
    (match obj with
    (match obj with
    | TClassDecl class_def -> visit_class class_def;
    | TClassDecl class_def -> visit_class class_def;
-      (match class_def.cl_init with Some expression -> visit_types expression | _ -> ())
+      (match class_def.cl_init with Some expression -> visit_params expression | _ -> ())
    | TEnumDecl enum_def -> visit_enum enum_def
    | TEnumDecl enum_def -> visit_enum enum_def
    | TTypeDecl _ | TAbstractDecl _ -> (* These are expanded *) ());
    | TTypeDecl _ | TAbstractDecl _ -> (* These are expanded *) ());
 
 
@@ -4286,7 +4286,7 @@ let gen_extern_class common_ctx class_def file_info =
    let c = class_def in
    let c = class_def in
    output ( "package " ^ (String.concat "." (fst path)) ^ ";\n" );
    output ( "package " ^ (String.concat "." (fst path)) ^ ";\n" );
    output ( "@:include extern " ^ (if c.cl_private then "private " else "") ^ (if c.cl_interface then "interface" else "class")
    output ( "@:include extern " ^ (if c.cl_private then "private " else "") ^ (if c.cl_interface then "interface" else "class")
-            ^ " " ^ (snd path) ^ (params c.cl_types) );
+            ^ " " ^ (snd path) ^ (params c.cl_params) );
    (match c.cl_super with None -> () | Some (c,pl) -> output (" extends " ^  (s_type (TInst (c,pl)))));
    (match c.cl_super with None -> () | Some (c,pl) -> output (" extends " ^  (s_type (TInst (c,pl)))));
    List.iter (fun (c,pl) -> output ( " implements " ^ (s_type (TInst (c,pl))))) (real_interfaces c.cl_implements);
    List.iter (fun (c,pl) -> output ( " implements " ^ (s_type (TInst (c,pl))))) (real_interfaces c.cl_implements);
    (match c.cl_dynamic with None -> () | Some t -> output (" implements Dynamic< " ^ (s_type t) ^ " >"));
    (match c.cl_dynamic with None -> () | Some t -> output (" implements Dynamic< " ^ (s_type t) ^ " >"));
@@ -4314,7 +4314,7 @@ let gen_extern_enum common_ctx enum_def file_info =
    let params = function [] -> "" | l ->  "< " ^ (String.concat "," (List.map (fun (n,t) -> n) l) ^ " >")  in
    let params = function [] -> "" | l ->  "< " ^ (String.concat "," (List.map (fun (n,t) -> n) l) ^ " >")  in
    output ( "package " ^ (String.concat "." (fst path)) ^ ";\n" );
    output ( "package " ^ (String.concat "." (fst path)) ^ ";\n" );
    output ( "@:include extern " ^ (if enum_def.e_private then "private " else "")
    output ( "@:include extern " ^ (if enum_def.e_private then "private " else "")
-            ^ " enum " ^ (snd path) ^ (params enum_def.e_types) );
+            ^ " enum " ^ (snd path) ^ (params enum_def.e_params) );
    output " {\n";
    output " {\n";
    let sorted_items = List.sort (fun f1 f2 -> (f1.ef_index - f2.ef_index ) ) (pmap_values enum_def.e_constrs) in
    let sorted_items = List.sort (fun f1 f2 -> (f1.ef_index - f2.ef_index ) ) (pmap_values enum_def.e_constrs) in
    List.iter (fun constructor ->
    List.iter (fun constructor ->

+ 35 - 35
gencs.ml

@@ -132,7 +132,7 @@ let rec is_null t =
 	match t with
 	match t with
 		| TInst( { cl_path = (["haxe"; "lang"], "Null") }, _ )
 		| TInst( { cl_path = (["haxe"; "lang"], "Null") }, _ )
 		| TType( { t_path = ([], "Null") }, _ ) -> true
 		| TType( { t_path = ([], "Null") }, _ ) -> true
-		| TType( t, tl ) -> is_null (apply_params t.t_types tl t.t_type)
+		| TType( t, tl ) -> is_null (apply_params t.t_params tl t.t_type)
 		| TMono r ->
 		| TMono r ->
 			(match !r with
 			(match !r with
 			| Some t -> is_null t
 			| Some t -> is_null t
@@ -817,10 +817,10 @@ let configure gen =
 	*)
 	*)
 	change_param_type md tl =
 	change_param_type md tl =
 		let types = match md with
 		let types = match md with
-			| TClassDecl c -> c.cl_types
+			| TClassDecl c -> c.cl_params
 			| TEnumDecl e -> []
 			| TEnumDecl e -> []
-			| TAbstractDecl a -> a.a_types
-			| TTypeDecl t -> t.t_types
+			| TAbstractDecl a -> a.a_params
+			| TTypeDecl t -> t.t_params
 		in
 		in
 		let is_hxgeneric = if types = [] then is_hxgen md else (TypeParams.RealTypeParams.is_hxgeneric md) in
 		let is_hxgeneric = if types = [] then is_hxgen md else (TypeParams.RealTypeParams.is_hxgeneric md) in
 		let ret t =
 		let ret t =
@@ -976,22 +976,22 @@ let configure gen =
 	let rec md_s md =
 	let rec md_s md =
 		let md = follow_module (gen.gfollow#run_f) md in
 		let md = follow_module (gen.gfollow#run_f) md in
 		match md with
 		match md with
-			| TClassDecl ({ cl_types = [] } as cl) ->
+			| TClassDecl ({ cl_params = [] } as cl) ->
 				t_s (TInst(cl,[]))
 				t_s (TInst(cl,[]))
 			| TClassDecl (cl) when not (is_hxgen md) ->
 			| TClassDecl (cl) when not (is_hxgen md) ->
-				t_s (TInst(cl,List.map (fun t -> t_dynamic) cl.cl_types))
-			| TEnumDecl ({ e_types = [] } as e) ->
+				t_s (TInst(cl,List.map (fun t -> t_dynamic) cl.cl_params))
+			| TEnumDecl ({ e_params = [] } as e) ->
 				t_s (TEnum(e,[]))
 				t_s (TEnum(e,[]))
 			| TEnumDecl (e) when not (is_hxgen md) ->
 			| TEnumDecl (e) when not (is_hxgen md) ->
-				t_s (TEnum(e,List.map (fun t -> t_dynamic) e.e_types))
+				t_s (TEnum(e,List.map (fun t -> t_dynamic) e.e_params))
 			| TClassDecl cl ->
 			| TClassDecl cl ->
 				t_s (TInst(cl,[]))
 				t_s (TInst(cl,[]))
 			| TEnumDecl e ->
 			| TEnumDecl e ->
 				t_s (TEnum(e,[]))
 				t_s (TEnum(e,[]))
 			| TTypeDecl t ->
 			| TTypeDecl t ->
-				t_s (TType(t, List.map (fun t -> t_dynamic) t.t_types))
+				t_s (TType(t, List.map (fun t -> t_dynamic) t.t_params))
 			| TAbstractDecl a ->
 			| TAbstractDecl a ->
-				t_s (TAbstract(a, List.map(fun t -> t_dynamic) a.a_types))
+				t_s (TAbstract(a, List.map(fun t -> t_dynamic) a.a_params))
 	in
 	in
 
 
 	let rec ensure_local e explain =
 	let rec ensure_local e explain =
@@ -1161,7 +1161,7 @@ let configure gen =
 						| TSuper -> write w "base")
 						| TSuper -> write w "base")
 				| TLocal { v_name = "__sbreak__" } -> write w "break"
 				| TLocal { v_name = "__sbreak__" } -> write w "break"
 				| TLocal { v_name = "__undefined__" } ->
 				| TLocal { v_name = "__undefined__" } ->
-					write w (t_s (TInst(runtime_cl, List.map (fun _ -> t_dynamic) runtime_cl.cl_types)));
+					write w (t_s (TInst(runtime_cl, List.map (fun _ -> t_dynamic) runtime_cl.cl_params)));
 					write w ".undefined";
 					write w ".undefined";
 				| TLocal { v_name = "__typeof__" } -> write w "typeof"
 				| TLocal { v_name = "__typeof__" } -> write w "typeof"
 				| TLocal { v_name = "__sizeof__" } -> write w "sizeof"
 				| TLocal { v_name = "__sizeof__" } -> write w "sizeof"
@@ -1186,10 +1186,10 @@ let configure gen =
 						| TClassDecl { cl_interface = true } ->
 						| TClassDecl { cl_interface = true } ->
 								write w ("global::" ^ module_s mt);
 								write w ("global::" ^ module_s mt);
 								write w "__Statics_";
 								write w "__Statics_";
-						| TClassDecl cl -> write w (t_s (TInst(cl, List.map (fun _ -> t_empty) cl.cl_types)))
-						| TEnumDecl en -> write w (t_s (TEnum(en, List.map (fun _ -> t_empty) en.e_types)))
-						| TTypeDecl td -> write w (t_s (gen.gfollow#run_f (TType(td, List.map (fun _ -> t_empty) td.t_types))))
-						| TAbstractDecl a -> write w (t_s (TAbstract(a, List.map (fun _ -> t_empty) a.a_types)))
+						| TClassDecl cl -> write w (t_s (TInst(cl, List.map (fun _ -> t_empty) cl.cl_params)))
+						| TEnumDecl en -> write w (t_s (TEnum(en, List.map (fun _ -> t_empty) en.e_params)))
+						| TTypeDecl td -> write w (t_s (gen.gfollow#run_f (TType(td, List.map (fun _ -> t_empty) td.t_params))))
+						| TAbstractDecl a -> write w (t_s (TAbstract(a, List.map (fun _ -> t_empty) a.a_params)))
 					);
 					);
 					write w ".";
 					write w ".";
 					write_field w (field_name s)
 					write_field w (field_name s)
@@ -1199,10 +1199,10 @@ let configure gen =
 					(match mt with
 					(match mt with
 						| TClassDecl { cl_path = (["haxe"], "Int64") } -> write w ("global::" ^ module_s mt)
 						| TClassDecl { cl_path = (["haxe"], "Int64") } -> write w ("global::" ^ module_s mt)
 						| TClassDecl { cl_path = (["haxe"], "Int32") } -> write w ("global::" ^ module_s mt)
 						| TClassDecl { cl_path = (["haxe"], "Int32") } -> write w ("global::" ^ module_s mt)
-						| TClassDecl cl -> write w (t_s (TInst(cl, List.map (fun _ -> t_dynamic) cl.cl_types)))
-						| TEnumDecl en -> write w (t_s (TEnum(en, List.map (fun _ -> t_dynamic) en.e_types)))
-						| TTypeDecl td -> write w (t_s (gen.gfollow#run_f (TType(td, List.map (fun _ -> t_dynamic) td.t_types))))
-						| TAbstractDecl a -> write w (t_s (TAbstract(a, List.map (fun _ -> t_dynamic) a.a_types)))
+						| TClassDecl cl -> write w (t_s (TInst(cl, List.map (fun _ -> t_dynamic) cl.cl_params)))
+						| TEnumDecl en -> write w (t_s (TEnum(en, List.map (fun _ -> t_dynamic) en.e_params)))
+						| TTypeDecl td -> write w (t_s (gen.gfollow#run_f (TType(td, List.map (fun _ -> t_dynamic) td.t_params))))
+						| TAbstractDecl a -> write w (t_s (TAbstract(a, List.map (fun _ -> t_dynamic) a.a_params)))
 					)
 					)
 				| TParenthesis e ->
 				| TParenthesis e ->
 					write w "("; expr_s w e; write w ")"
 					write w "("; expr_s w e; write w ")"
@@ -1632,12 +1632,12 @@ let configure gen =
 			ret
 			ret
 	in
 	in
 
 
-	let get_string_params cl_types =
-		match cl_types with
+	let get_string_params cl_params =
+		match cl_params with
 			| [] ->
 			| [] ->
 				("","")
 				("","")
 			| _ ->
 			| _ ->
-				let params = sprintf "<%s>" (String.concat ", " (List.map (fun (_, tcl) -> match follow tcl with | TInst(cl, _) -> snd cl.cl_path | _ -> assert false) cl_types)) in
+				let params = sprintf "<%s>" (String.concat ", " (List.map (fun (_, tcl) -> match follow tcl with | TInst(cl, _) -> snd cl.cl_path | _ -> assert false) cl_params)) in
 				let params_extends = List.fold_left (fun acc (name, t) ->
 				let params_extends = List.fold_left (fun acc (name, t) ->
 					match run_follow gen t with
 					match run_follow gen t with
 						| TInst (cl, p) ->
 						| TInst (cl, p) ->
@@ -1645,8 +1645,8 @@ let configure gen =
 								| [] -> acc
 								| [] -> acc
 								| _ -> acc) (* TODO
 								| _ -> acc) (* TODO
 								| _ -> (sprintf " where %s : %s" name (String.concat ", " (List.map (fun (cl,p) -> path_param_s (TClassDecl cl) cl.cl_path p) cl.cl_implements))) :: acc ) *)
 								| _ -> (sprintf " where %s : %s" name (String.concat ", " (List.map (fun (cl,p) -> path_param_s (TClassDecl cl) cl.cl_path p) cl.cl_implements))) :: acc ) *)
-						| _ -> trace (t_s t); assert false (* FIXME it seems that a cl_types will never be anything other than cl.cl_types. I'll take the risk and fail if not, just to see if that confirms *)
-				) [] cl_types in
+						| _ -> trace (t_s t); assert false (* FIXME it seems that a cl_params will never be anything other than cl.cl_params. I'll take the risk and fail if not, just to see if that confirms *)
+				) [] cl_params in
 				(params, String.concat " " params_extends)
 				(params, String.concat " " params_extends)
 	in
 	in
 
 
@@ -1787,7 +1787,7 @@ let configure gen =
 				let modifiers = modifiers @ modf in
 				let modifiers = modifiers @ modf in
 				let visibility, is_virtual = if is_explicit_iface then "",false else if visibility = "private" then "private",false else visibility, is_virtual in
 				let visibility, is_virtual = if is_explicit_iface then "",false else if visibility = "private" then "private",false else visibility, is_virtual in
 				let v_n = if is_static then "static " else if is_override && not is_interface then "override " else if is_virtual then "virtual " else "" in
 				let v_n = if is_static then "static " else if is_override && not is_interface then "override " else if is_virtual then "virtual " else "" in
-				let cf_type = if is_override && not is_overload && not (Meta.has Meta.Overload cf.cf_meta) then match field_access gen (TInst(cl, List.map snd cl.cl_types)) cf.cf_name with | FClassField(_,_,_,_,_,actual_t,_) -> actual_t | _ -> assert false else cf.cf_type in
+				let cf_type = if is_override && not is_overload && not (Meta.has Meta.Overload cf.cf_meta) then match field_access gen (TInst(cl, List.map snd cl.cl_params)) cf.cf_name with | FClassField(_,_,_,_,_,actual_t,_) -> actual_t | _ -> assert false else cf.cf_type in
 				let ret_type, args = match follow cf_type with | TFun (strbtl, t) -> (t, strbtl) | _ -> assert false in
 				let ret_type, args = match follow cf_type with | TFun (strbtl, t) -> (t, strbtl) | _ -> assert false in
 				let no_completion = if Meta.has Meta.NoCompletion cf.cf_meta then "[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] " else "" in
 				let no_completion = if Meta.has Meta.NoCompletion cf.cf_meta then "[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] " else "" in
 
 
@@ -1926,7 +1926,7 @@ let configure gen =
 				match cl.cl_array_access with
 				match cl.cl_array_access with
 					| None -> ()
 					| None -> ()
 					| Some t ->
 					| Some t ->
-						let changed_t = apply_params cl.cl_types (List.map (fun _ -> t_dynamic) cl.cl_types) t in
+						let changed_t = apply_params cl.cl_params (List.map (fun _ -> t_dynamic) cl.cl_params) t in
 						let t_as_s = t_s (run_follow gen changed_t) in
 						let t_as_s = t_s (run_follow gen changed_t) in
 						print w "%s %s.this[int key]" t_as_s (t_s (TInst(cl, args)));
 						print w "%s %s.this[int key]" t_as_s (t_s (TInst(cl, args)));
 							begin_block w;
 							begin_block w;
@@ -1944,7 +1944,7 @@ let configure gen =
 			) cl.cl_implements
 			) cl.cl_implements
 		with | Not_found -> ());
 		with | Not_found -> ());
 		if cl.cl_interface && is_hxgen (TClassDecl cl) && is_some cl.cl_array_access then begin
 		if cl.cl_interface && is_hxgen (TClassDecl cl) && is_some cl.cl_array_access then begin
-			let changed_t = apply_params cl.cl_types (List.map (fun _ -> t_dynamic) cl.cl_types) (get cl.cl_array_access) in
+			let changed_t = apply_params cl.cl_params (List.map (fun _ -> t_dynamic) cl.cl_params) (get cl.cl_array_access) in
 			print w "%s this[int key]" (t_s (run_follow gen changed_t));
 			print w "%s this[int key]" (t_s (run_follow gen changed_t));
 			begin_block w;
 			begin_block w;
 				write w "get;";
 				write w "get;";
@@ -1989,7 +1989,7 @@ let configure gen =
 					let this = if static then
 					let this = if static then
 						mk_classtype_access cl f.cf_pos
 						mk_classtype_access cl f.cf_pos
 					else
 					else
-						{ eexpr = TConst TThis; etype = TInst(cl,List.map snd cl.cl_types); epos = f.cf_pos }
+						{ eexpr = TConst TThis; etype = TInst(cl,List.map snd cl.cl_params); epos = f.cf_pos }
 					in
 					in
 					print w "public %s%s %s" (if static then "static " else "") (t_s f.cf_type) (netname_to_hx f.cf_name);
 					print w "public %s%s %s" (if static then "static " else "") (t_s f.cf_type) (netname_to_hx f.cf_name);
 					begin_block w;
 					begin_block w;
@@ -2057,7 +2057,7 @@ let configure gen =
 
 
 		print w "%s %s %s %s" access (String.concat " " modifiers) clt (change_clname (snd cl.cl_path));
 		print w "%s %s %s %s" access (String.concat " " modifiers) clt (change_clname (snd cl.cl_path));
 		(* type parameters *)
 		(* type parameters *)
-		let params, params_ext = get_string_params cl.cl_types in
+		let params, params_ext = get_string_params cl.cl_params in
 		let extends_implements = (match cl.cl_super with | None -> [] | Some (cl,p) -> [path_param_s (TClassDecl cl) cl.cl_path p]) @ (List.map (fun (cl,p) -> path_param_s (TClassDecl cl) cl.cl_path p) cl.cl_implements) in
 		let extends_implements = (match cl.cl_super with | None -> [] | Some (cl,p) -> [path_param_s (TClassDecl cl) cl.cl_path p]) @ (List.map (fun (cl,p) -> path_param_s (TClassDecl cl) cl.cl_path p) cl.cl_implements) in
 		(match extends_implements with
 		(match extends_implements with
 			| [] -> print w "%s %s" params params_ext
 			| [] -> print w "%s %s" params params_ext
@@ -2093,7 +2093,7 @@ let configure gen =
 
 
 		(* collect properties *)
 		(* collect properties *)
 		let partition_props cl cflist =
 		let partition_props cl cflist =
-			let t = TInst(cl, List.map snd cl.cl_types) in
+			let t = TInst(cl, List.map snd cl.cl_params) in
 			(* first get all vars declared as properties *)
 			(* first get all vars declared as properties *)
 			let props, nonprops = List.partition (fun v -> match v.cf_kind with
 			let props, nonprops = List.partition (fun v -> match v.cf_kind with
 				| Var { v_read = AccCall } | Var { v_write = AccCall } ->
 				| Var { v_read = AccCall } | Var { v_write = AccCall } ->
@@ -2105,7 +2105,7 @@ let configure gen =
 			let find_prop name = try
 			let find_prop name = try
 					List.assoc name !props
 					List.assoc name !props
 				with | Not_found -> match field_access gen t name with
 				with | Not_found -> match field_access gen t name with
-					| FClassField (_,_,decl,v,_,t,_) when is_extern_prop (TInst(cl,List.map snd cl.cl_types)) name ->
+					| FClassField (_,_,decl,v,_,t,_) when is_extern_prop (TInst(cl,List.map snd cl.cl_params)) name ->
 						let ret = ref (v,t,None,None) in
 						let ret = ref (v,t,None,None) in
 						props := (name, ret) :: !props;
 						props := (name, ret) :: !props;
 						ret
 						ret
@@ -3572,15 +3572,15 @@ let ilcls_with_params ctx cls params =
 			cimplements = List.map (fun s -> { s with snorm = ilapply_params params s.snorm } ) cls.cimplements;
 			cimplements = List.map (fun s -> { s with snorm = ilapply_params params s.snorm } ) cls.cimplements;
 		}
 		}
 
 
-let rec compatible_types t1 t2 = match t1,t2 with
-	| LManagedPointer(s1), LManagedPointer(s2) -> compatible_types s1 s2
+let rec compatible_params t1 t2 = match t1,t2 with
+	| LManagedPointer(s1), LManagedPointer(s2) -> compatible_params s1 s2
 	| LManagedPointer(s1), s2 | s1, LManagedPointer(s2) ->
 	| LManagedPointer(s1), s2 | s1, LManagedPointer(s2) ->
-		compatible_types s1 s2
+		compatible_params s1 s2
 	| _ -> t1 = t2
 	| _ -> t1 = t2
 
 
 let compatible_methods m1 m2 = match m1, m2 with
 let compatible_methods m1 m2 = match m1, m2 with
 	| LMethod(_,r1,a1), LMethod(_,r2,a2) -> (try
 	| LMethod(_,r1,a1), LMethod(_,r2,a2) -> (try
-		List.for_all2 (fun a1 a2 -> compatible_types a1 a2) a1 a2
+		List.for_all2 (fun a1 a2 -> compatible_params a1 a2) a1 a2
 	with | Invalid_argument _ ->
 	with | Invalid_argument _ ->
 		false)
 		false)
 	| _ -> false
 	| _ -> false

+ 12 - 12
genjava.ml

@@ -719,7 +719,7 @@ let rec handle_throws gen cf =
 			let wrap_static = mk_static_field_access (hx_exception) "wrap" (TFun([("obj",false,t_dynamic)], t_dynamic)) rethrow.epos in
 			let wrap_static = mk_static_field_access (hx_exception) "wrap" (TFun([("obj",false,t_dynamic)], t_dynamic)) rethrow.epos in
 			let wrapped = { rethrow with eexpr = TThrow { rethrow with eexpr = TCall(wrap_static, [rethrow]) }; } in
 			let wrapped = { rethrow with eexpr = TThrow { rethrow with eexpr = TCall(wrap_static, [rethrow]) }; } in
 			let map_throws cl =
 			let map_throws cl =
-				let var = alloc_var "typedException" (TInst(cl,List.map (fun _ -> t_dynamic) cl.cl_types)) in
+				let var = alloc_var "typedException" (TInst(cl,List.map (fun _ -> t_dynamic) cl.cl_params)) in
 				var, { tf.tf_expr with eexpr = TThrow (mk_local var e.epos) }
 				var, { tf.tf_expr with eexpr = TThrow (mk_local var e.epos) }
 			in
 			in
 			cf.cf_expr <- Some { e with
 			cf.cf_expr <- Some { e with
@@ -1197,7 +1197,7 @@ let configure gen =
 				| TLocal { v_name = "__fallback__" } -> ()
 				| TLocal { v_name = "__fallback__" } -> ()
 				| TLocal { v_name = "__sbreak__" } -> write w "break"
 				| TLocal { v_name = "__sbreak__" } -> write w "break"
 				| TLocal { v_name = "__undefined__" } ->
 				| TLocal { v_name = "__undefined__" } ->
-					write w (t_s e.epos (TInst(runtime_cl, List.map (fun _ -> t_dynamic) runtime_cl.cl_types)));
+					write w (t_s e.epos (TInst(runtime_cl, List.map (fun _ -> t_dynamic) runtime_cl.cl_params)));
 					write w ".undefined";
 					write w ".undefined";
 				| TLocal var ->
 				| TLocal var ->
 					write_id w var.v_name
 					write_id w var.v_name
@@ -1515,12 +1515,12 @@ let configure gen =
 		expr_s w e
 		expr_s w e
 	in
 	in
 
 
-	let get_string_params cl_types =
-		match cl_types with
+	let get_string_params cl_params =
+		match cl_params with
 			| [] ->
 			| [] ->
 				("","")
 				("","")
 			| _ ->
 			| _ ->
-				let params = sprintf "<%s>" (String.concat ", " (List.map (fun (_, tcl) -> match follow tcl with | TInst(cl, _) -> snd cl.cl_path | _ -> assert false) cl_types)) in
+				let params = sprintf "<%s>" (String.concat ", " (List.map (fun (_, tcl) -> match follow tcl with | TInst(cl, _) -> snd cl.cl_path | _ -> assert false) cl_params)) in
 				let params_extends = List.fold_left (fun acc (name, t) ->
 				let params_extends = List.fold_left (fun acc (name, t) ->
 					match run_follow gen t with
 					match run_follow gen t with
 						| TInst (cl, p) ->
 						| TInst (cl, p) ->
@@ -1528,8 +1528,8 @@ let configure gen =
 								| [] -> acc
 								| [] -> acc
 								| _ -> acc) (* TODO
 								| _ -> acc) (* TODO
 								| _ -> (sprintf " where %s : %s" name (String.concat ", " (List.map (fun (cl,p) -> path_param_s (TClassDecl cl) cl.cl_path p) cl.cl_implements))) :: acc ) *)
 								| _ -> (sprintf " where %s : %s" name (String.concat ", " (List.map (fun (cl,p) -> path_param_s (TClassDecl cl) cl.cl_path p) cl.cl_implements))) :: acc ) *)
-						| _ -> trace (t_s Ast.null_pos t); assert false (* FIXME it seems that a cl_types will never be anything other than cl.cl_types. I'll take the risk and fail if not, just to see if that confirms *)
-				) [] cl_types in
+						| _ -> trace (t_s Ast.null_pos t); assert false (* FIXME it seems that a cl_params will never be anything other than cl.cl_params. I'll take the risk and fail if not, just to see if that confirms *)
+				) [] cl_params in
 				(params, String.concat " " params_extends)
 				(params, String.concat " " params_extends)
 	in
 	in
 
 
@@ -1608,12 +1608,12 @@ let configure gen =
 				let visibility, modifiers = get_fun_modifiers cf.cf_meta visibility [] in
 				let visibility, modifiers = get_fun_modifiers cf.cf_meta visibility [] in
 				let visibility, is_virtual = if is_explicit_iface then "",false else visibility, is_virtual in
 				let visibility, is_virtual = if is_explicit_iface then "",false else visibility, is_virtual in
 				let v_n = if is_static then "static " else if is_override && not is_interface then "" else if not is_virtual then "final " else "" in
 				let v_n = if is_static then "static " else if is_override && not is_interface then "" else if not is_virtual then "final " else "" in
-				let cf_type = if is_override && not is_overload && not (Meta.has Meta.Overload cf.cf_meta) then match field_access gen (TInst(cl, List.map snd cl.cl_types)) cf.cf_name with | FClassField(_,_,_,_,_,actual_t,_) -> actual_t | _ -> assert false else cf.cf_type in
+				let cf_type = if is_override && not is_overload && not (Meta.has Meta.Overload cf.cf_meta) then match field_access gen (TInst(cl, List.map snd cl.cl_params)) cf.cf_name with | FClassField(_,_,_,_,_,actual_t,_) -> actual_t | _ -> assert false else cf.cf_type in
 
 
-				let params = List.map snd cl.cl_types in
+				let params = List.map snd cl.cl_params in
 				let ret_type, args = match follow cf_type, follow cf.cf_type with
 				let ret_type, args = match follow cf_type, follow cf.cf_type with
 					| TFun (strbtl, t), TFun(rargs, _) ->
 					| TFun (strbtl, t), TFun(rargs, _) ->
-							(apply_params cl.cl_types params (real_type t), List.map2 (fun(_,_,t) (n,o,_) -> (n,o,apply_params cl.cl_types params (real_type t))) strbtl rargs)
+							(apply_params cl.cl_params params (real_type t), List.map2 (fun(_,_,t) (n,o,_) -> (n,o,apply_params cl.cl_params params (real_type t))) strbtl rargs)
 					| _ -> assert false
 					| _ -> assert false
 				in
 				in
 
 
@@ -1727,7 +1727,7 @@ let configure gen =
 
 
 		print w "%s %s %s %s" access (String.concat " " modifiers) clt (change_clname (snd cl.cl_path));
 		print w "%s %s %s %s" access (String.concat " " modifiers) clt (change_clname (snd cl.cl_path));
 		(* type parameters *)
 		(* type parameters *)
-		let params, _ = get_string_params cl.cl_types in
+		let params, _ = get_string_params cl.cl_params in
 		let cl_p_to_string (c,p) =
 		let cl_p_to_string (c,p) =
 			let p = List.map (fun t -> match follow t with
 			let p = List.map (fun t -> match follow t with
 				| TMono _ | TDynamic _ -> t_empty
 				| TMono _ | TDynamic _ -> t_empty
@@ -2026,7 +2026,7 @@ let configure gen =
 		match field_access_esp gen (gen.greal_type t) field with
 		match field_access_esp gen (gen.greal_type t) field with
 			| FClassField (cl,p,_,_,_,t,_) ->
 			| FClassField (cl,p,_,_,_,t,_) ->
 				let p = change_param_type (TClassDecl cl) p in
 				let p = change_param_type (TClassDecl cl) p in
-				is_dynamic (apply_params cl.cl_types p t)
+				is_dynamic (apply_params cl.cl_params p t)
 			| FEnumField _ -> false
 			| FEnumField _ -> false
 			| _ -> true
 			| _ -> true
 	in
 	in

+ 3 - 3
genphp.ml

@@ -133,7 +133,7 @@ and type_string_suff suffix haxe_type =
 			(match params with
 			(match params with
 			| [t] -> "Array<" ^ (type_string (follow t) ) ^ " >"
 			| [t] -> "Array<" ^ (type_string (follow t) ) ^ " >"
 			| _ -> assert false)
 			| _ -> assert false)
-		| _ ->  type_string_suff suffix (apply_params type_def.t_types params type_def.t_type)
+		| _ ->  type_string_suff suffix (apply_params type_def.t_params params type_def.t_type)
 		)
 		)
 	| TFun (args,haxe_type) -> "Dynamic"
 	| TFun (args,haxe_type) -> "Dynamic"
 	| TAnon anon -> "Dynamic"
 	| TAnon anon -> "Dynamic"
@@ -1995,7 +1995,7 @@ let generate_inline_method ctx c m =
 let generate_class ctx c =
 let generate_class ctx c =
 	let requires_constructor = ref true in
 	let requires_constructor = ref true in
 	ctx.curclass <- c;
 	ctx.curclass <- c;
-	ctx.local_types <- List.map snd c.cl_types;
+	ctx.local_types <- List.map snd c.cl_params;
 
 
 	print ctx "%s %s " (if c.cl_interface then "interface" else "class") (s_path ctx c.cl_path c.cl_extern c.cl_pos);
 	print ctx "%s %s " (if c.cl_interface then "interface" else "class") (s_path ctx c.cl_path c.cl_extern c.cl_pos);
 	(match c.cl_super with
 	(match c.cl_super with
@@ -2138,7 +2138,7 @@ let generate_main ctx c =
 		newline ctx
 		newline ctx
 
 
 let generate_enum ctx e =
 let generate_enum ctx e =
-	ctx.local_types <- List.map snd e.e_types;
+	ctx.local_types <- List.map snd e.e_params;
 	let pack = open_block ctx in
 	let pack = open_block ctx in
 	let ename = s_path ctx e.e_path e.e_extern e.e_pos in
 	let ename = s_path ctx e.e_path e.e_extern e.e_pos in
 
 

+ 1 - 1
genpy.ml

@@ -1775,7 +1775,7 @@ module Generator = struct
 		let py_metas = filter_py_metas cf.cf_meta in
 		let py_metas = filter_py_metas cf.cf_meta in
 		begin match member_inits,cf.cf_expr with
 		begin match member_inits,cf.cf_expr with
 			| _,Some ({eexpr = TFunction f} as ef) ->
 			| _,Some ({eexpr = TFunction f} as ef) ->
-				let ethis = mk (TConst TThis) (TInst(c,List.map snd c.cl_types)) cf.cf_pos in
+				let ethis = mk (TConst TThis) (TInst(c,List.map snd c.cl_params)) cf.cf_pos in
 				let member_data = List.map (fun cf ->
 				let member_data = List.map (fun cf ->
 					let ef = mk (TField(ethis,FInstance(c, cf))) cf.cf_type cf.cf_pos in
 					let ef = mk (TField(ethis,FInstance(c, cf))) cf.cf_type cf.cf_pos in
 					mk (TBinop(OpAssign,ef,null ef.etype ef.epos)) ef.etype ef.epos
 					mk (TBinop(OpAssign,ef,null ef.etype ef.epos)) ef.etype ef.epos

+ 1 - 1
genswf.ml

@@ -643,7 +643,7 @@ let build_dependencies t =
 			match follow t with
 			match follow t with
 			| TInst (c,_) -> List.iter add_inherit c.cl_implements
 			| TInst (c,_) -> List.iter add_inherit c.cl_implements
 			| _ -> ()
 			| _ -> ()
-		) c.cl_types;
+		) c.cl_params;
 		List.iter add_inherit c.cl_implements;
 		List.iter add_inherit c.cl_implements;
 	| TEnumDecl e when not e.e_extern ->
 	| TEnumDecl e when not e.e_extern ->
 		PMap.iter (fun _ f -> add_type f.ef_type) e.e_constrs;
 		PMap.iter (fun _ f -> add_type f.ef_type) e.e_constrs;

+ 3 - 3
genswf9.ml

@@ -210,9 +210,9 @@ let rec follow_basic t =
 	| TType ({ t_path = [],"UInt" },[]) ->
 	| TType ({ t_path = [],"UInt" },[]) ->
 		t
 		t
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		follow_basic (apply_params t.t_types tl t.t_type)
+		follow_basic (apply_params t.t_params tl t.t_type)
 	| TAbstract (a,pl) when not (Meta.has Meta.CoreType a.a_meta) ->
 	| TAbstract (a,pl) when not (Meta.has Meta.CoreType a.a_meta) ->
-		follow_basic (apply_params a.a_types pl a.a_this)
+		follow_basic (apply_params a.a_params pl a.a_this)
 	| _ -> t
 	| _ -> t
 
 
 let rec type_id ctx t =
 let rec type_id ctx t =
@@ -354,7 +354,7 @@ let property ctx p t =
 		(* cast type when accessing an extension field *)
 		(* cast type when accessing an extension field *)
 		(try
 		(try
 			let f = PMap.find p c.cl_fields in
 			let f = PMap.find p c.cl_fields in
-			ident p, Some (classify ctx (apply_params c.cl_types params f.cf_type)), false
+			ident p, Some (classify ctx (apply_params c.cl_params params f.cf_type)), false
 		with Not_found ->
 		with Not_found ->
 			ident p, None, false)
 			ident p, None, false)
 	| TInst ({ cl_interface = true } as c,_) ->
 	| TInst ({ cl_interface = true } as c,_) ->

+ 9 - 9
genxml.ml

@@ -78,7 +78,7 @@ let rec follow_param t =
 		| Some t -> follow_param t
 		| Some t -> follow_param t
 		| _ -> t)
 		| _ -> t)
 	| TType ({ t_path = [],"Null" } as t,tl) ->
 	| TType ({ t_path = [],"Null" } as t,tl) ->
-		follow_param (apply_params t.t_types tl t.t_type)
+		follow_param (apply_params t.t_params tl t.t_type)
 	| _ ->
 	| _ ->
 		t
 		t
 
 
@@ -218,16 +218,16 @@ let rec gen_type_decl com pos t =
 			| None -> []
 			| None -> []
 			| Some t -> [node "haxe_dynamic" [] [gen_type t]]
 			| Some t -> [node "haxe_dynamic" [] [gen_type t]]
 		) in
 		) in
-		node "class" (gen_type_params pos c.cl_private (tpath t) c.cl_types c.cl_pos m @ ext @ interf) (tree @ stats @ fields @ constr @ doc @ meta @ dynamic)
+		node "class" (gen_type_params pos c.cl_private (tpath t) c.cl_params c.cl_pos m @ ext @ interf) (tree @ stats @ fields @ constr @ doc @ meta @ dynamic)
 	| TEnumDecl e ->
 	| TEnumDecl e ->
 		let doc = gen_doc_opt e.e_doc in
 		let doc = gen_doc_opt e.e_doc in
 		let meta = gen_meta e.e_meta in
 		let meta = gen_meta e.e_meta in
-		node "enum" (gen_type_params pos e.e_private (tpath t) e.e_types e.e_pos m) (gen_ordered_constr e  @ doc @ meta)
+		node "enum" (gen_type_params pos e.e_private (tpath t) e.e_params e.e_pos m) (gen_ordered_constr e  @ doc @ meta)
 	| TTypeDecl t ->
 	| TTypeDecl t ->
 		let doc = gen_doc_opt t.t_doc in
 		let doc = gen_doc_opt t.t_doc in
 		let meta = gen_meta t.t_meta in
 		let meta = gen_meta t.t_meta in
 		let tt = gen_type t.t_type in
 		let tt = gen_type t.t_type in
-		node "typedef" (gen_type_params pos t.t_private t.t_path t.t_types t.t_pos m) (tt :: doc @ meta)
+		node "typedef" (gen_type_params pos t.t_private t.t_path t.t_params t.t_pos m) (tt :: doc @ meta)
 	| TAbstractDecl a ->
 	| TAbstractDecl a ->
 		let doc = gen_doc_opt a.a_doc in
 		let doc = gen_doc_opt a.a_doc in
 		let meta = gen_meta a.a_meta in
 		let meta = gen_meta a.a_meta in
@@ -236,7 +236,7 @@ let rec gen_type_decl com pos t =
 		let super = (match a.a_to with [] -> [] | l -> [node "to" [] (List.map mk_cast l)]) in
 		let super = (match a.a_to with [] -> [] | l -> [node "to" [] (List.map mk_cast l)]) in
 		let impl = (match a.a_impl with None -> [] | Some c -> [node "impl" [] [gen_type_decl com pos (TClassDecl c)]]) in
 		let impl = (match a.a_impl with None -> [] | Some c -> [node "impl" [] [gen_type_decl com pos (TClassDecl c)]]) in
 		let this = [node "this" [] [gen_type a.a_this]] in
 		let this = [node "this" [] [gen_type a.a_this]] in
-		node "abstract" (gen_type_params pos a.a_private (tpath t) a.a_types a.a_pos m) (sub @ this @ super @ doc @ meta @ impl)
+		node "abstract" (gen_type_params pos a.a_private (tpath t) a.a_params a.a_pos m) (sub @ this @ super @ doc @ meta @ impl)
 
 
 let att_str att =
 let att_str att =
 	String.concat "" (List.map (fun (a,v) -> Printf.sprintf " %s=\"%s\"" a v) att)
 	String.concat "" (List.map (fun (a,v) -> Printf.sprintf " %s=\"%s\"" a v) att)
@@ -455,7 +455,7 @@ let generate_type com t =
 	(match t with
 	(match t with
 	| TClassDecl c ->
 	| TClassDecl c ->
 		print_meta c.cl_meta;
 		print_meta c.cl_meta;
-		p "extern %s %s" (if c.cl_interface then "interface" else "class") (stype (TInst (c,List.map snd c.cl_types)));
+		p "extern %s %s" (if c.cl_interface then "interface" else "class") (stype (TInst (c,List.map snd c.cl_params)));
 		let ext = (match c.cl_super with
 		let ext = (match c.cl_super with
 		| None -> []
 		| None -> []
 		| Some (c,pl) -> [" extends " ^ stype (TInst (c,pl))]
 		| Some (c,pl) -> [" extends " ^ stype (TInst (c,pl))]
@@ -496,7 +496,7 @@ let generate_type com t =
 		p "}\n";
 		p "}\n";
 	| TEnumDecl e ->
 	| TEnumDecl e ->
 		print_meta e.e_meta;
 		print_meta e.e_meta;
-		p "extern enum %s {\n" (stype (TEnum(e,List.map snd e.e_types)));
+		p "extern enum %s {\n" (stype (TEnum(e,List.map snd e.e_params)));
 		let sort l =
 		let sort l =
 			let a = Array.of_list l in
 			let a = Array.of_list l in
 			Array.sort compare a;
 			Array.sort compare a;
@@ -513,12 +513,12 @@ let generate_type com t =
 		p "}\n"
 		p "}\n"
 	| TTypeDecl t ->
 	| TTypeDecl t ->
 		print_meta t.t_meta;
 		print_meta t.t_meta;
-		p "typedef %s = " (stype (TType (t,List.map snd t.t_types)));
+		p "typedef %s = " (stype (TType (t,List.map snd t.t_params)));
 		p "%s" (stype t.t_type);
 		p "%s" (stype t.t_type);
 		p "\n";
 		p "\n";
 	| TAbstractDecl a ->
 	| TAbstractDecl a ->
 		print_meta a.a_meta;
 		print_meta a.a_meta;
-		p "abstract %s {}" (stype (TAbstract (a,List.map snd a.a_types)));
+		p "abstract %s {}" (stype (TAbstract (a,List.map snd a.a_params)));
 	);
 	);
 	IO.close_out ch
 	IO.close_out ch
 
 

+ 2 - 2
interp.ml

@@ -2474,7 +2474,7 @@ let macro_lib =
 				| TAbstract _ | TEnum _ | TInst _ | TFun _ | TAnon _ | TDynamic _ ->
 				| TAbstract _ | TEnum _ | TInst _ | TFun _ | TAnon _ | TDynamic _ ->
 					t
 					t
 				| TType (t,tl) ->
 				| TType (t,tl) ->
-					apply_params t.t_types tl t.t_type
+					apply_params t.t_params tl t.t_type
 				| TLazy f ->
 				| TLazy f ->
 					(!f)()
 					(!f)()
 			in
 			in
@@ -4246,7 +4246,7 @@ let rec encode_mtype t fields =
 		"isPrivate", VBool i.mt_private;
 		"isPrivate", VBool i.mt_private;
 		"meta", encode_meta i.mt_meta (fun m -> i.mt_meta <- m);
 		"meta", encode_meta i.mt_meta (fun m -> i.mt_meta <- m);
 		"doc", null enc_string i.mt_doc;
 		"doc", null enc_string i.mt_doc;
-		"params", encode_type_params i.mt_types;
+		"params", encode_type_params i.mt_params;
 	] @ fields)
 	] @ fields)
 
 
 and encode_type_params tl =
 and encode_type_params tl =

+ 18 - 18
matcher.ml

@@ -177,7 +177,7 @@ let mk_type_pat ctx mt t p =
 		| TEnumDecl _ -> "Enum"
 		| TEnumDecl _ -> "Enum"
 		| TAbstractDecl a when Meta.has Meta.RuntimeValue a.a_meta -> "Class"
 		| TAbstractDecl a when Meta.has Meta.RuntimeValue a.a_meta -> "Class"
 		| TTypeDecl t ->
 		| TTypeDecl t ->
-			begin match follow (monomorphs t.t_types t.t_type) with
+			begin match follow (monomorphs t.t_params t.t_type) with
 				| TInst(c,_) -> loop (TClassDecl c)
 				| TInst(c,_) -> loop (TClassDecl c)
 				| TEnum(en,_) -> loop (TEnumDecl en)
 				| TEnum(en,_) -> loop (TEnumDecl en)
 				| TAbstract(a,_) -> loop (TAbstractDecl a)
 				| TAbstract(a,_) -> loop (TAbstractDecl a)
@@ -192,9 +192,9 @@ let mk_type_pat ctx mt t p =
 
 
 let mk_subs st con =
 let mk_subs st con =
 	let map = match follow st.st_type with
 	let map = match follow st.st_type with
-		| TInst(c,pl) -> apply_params c.cl_types pl
-		| TEnum(en,pl) -> apply_params en.e_types pl
-		| TAbstract(a,pl) -> apply_params a.a_types pl
+		| TInst(c,pl) -> apply_params c.cl_params pl
+		| TEnum(en,pl) -> apply_params en.e_params pl
+		| TAbstract(a,pl) -> apply_params a.a_params pl
 		| _ -> fun t -> t
 		| _ -> fun t -> t
 	in
 	in
 	match con.c_def with
 	match con.c_def with
@@ -207,7 +207,7 @@ let mk_subs st con =
 			| _ -> []
 			| _ -> []
 		in
 		in
 		let pl = loop con.c_type in
 		let pl = loop con.c_type in
-		begin match apply_params en.e_types pl (monomorphs ef.ef_params ef.ef_type) with
+		begin match apply_params en.e_params pl (monomorphs ef.ef_params ef.ef_type) with
 			| TFun(args,r) ->
 			| TFun(args,r) ->
 				ExtList.List.mapi (fun i (_,_,t) ->
 				ExtList.List.mapi (fun i (_,_,t) ->
 					mk_st (SEnum(st,ef,i)) t st.st_pos
 					mk_st (SEnum(st,ef,i)) t st.st_pos
@@ -222,7 +222,7 @@ let mk_subs st con =
 	| CEnum _ | CConst _ | CType _ | CExpr _ | CAny ->
 	| CEnum _ | CConst _ | CType _ | CExpr _ | CAny ->
 		[]
 		[]
 
 
-let get_tuple_types t = match t with
+let get_tuple_params t = match t with
 	| TFun(tl,tr) when tr == fake_tuple_type -> Some tl
 	| TFun(tl,tr) when tr == fake_tuple_type -> Some tl
 	| _ -> None
 	| _ -> None
 
 
@@ -274,7 +274,7 @@ let unify_enum_field en pl ef t =
 		| TFun(_,r) -> r
 		| TFun(_,r) -> r
 		| t2 -> t2
 		| t2 -> t2
 	in
 	in
-	let t2 = (apply_params en.e_types pl (monomorphs ef.ef_params t2)) in
+	let t2 = (apply_params en.e_params pl (monomorphs ef.ef_params t2)) in
 	Type.unify t2 t
 	Type.unify t2 t
 
 
 let unify ctx a b p =
 let unify ctx a b p =
@@ -284,7 +284,7 @@ let rec is_value_type = function
 	| TMono r ->
 	| TMono r ->
 		(match !r with None -> false | Some t -> is_value_type t)
 		(match !r with None -> false | Some t -> is_value_type t)
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		is_value_type (apply_params t.t_types tl t.t_type)
+		is_value_type (apply_params t.t_params tl t.t_type)
 	| TInst({cl_path=[],"String"},[]) ->
 	| TInst({cl_path=[],"String"},[]) ->
 		true
 		true
 	| TAbstract _ ->
 	| TAbstract _ ->
@@ -302,7 +302,7 @@ let rec matches_null ctx t = match t with
 	| TLazy f ->
 	| TLazy f ->
 		matches_null ctx (!f())
 		matches_null ctx (!f())
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		matches_null ctx (apply_params t.t_types tl t.t_type)
+		matches_null ctx (apply_params t.t_params tl t.t_type)
 	| TFun _ | TEnum _ ->
 	| TFun _ | TEnum _ ->
 		false
 		false
 	| TAbstract (a,_) -> not (Meta.has Meta.NotNull a.a_meta)
 	| TAbstract (a,_) -> not (Meta.has Meta.NotNull a.a_meta)
@@ -361,7 +361,7 @@ let to_pattern ctx e t =
 				mk_con_pat (CExpr e) [] cf.cf_type p
 				mk_con_pat (CExpr e) [] cf.cf_type p
 			| TField(_, FEnum(en,ef)) ->
 			| TField(_, FEnum(en,ef)) ->
 				begin try
 				begin try
-					unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_types) ef t
+					unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_params) ef t
 				with Unify_error l ->
 				with Unify_error l ->
 					error (error_msg (Unify l)) p
 					error (error_msg (Unify l)) p
 				end;
 				end;
@@ -377,7 +377,7 @@ let to_pattern ctx e t =
 					| _ -> error ("Expected constructor for enum " ^ (s_type_path en.e_path)) p
 					| _ -> error ("Expected constructor for enum " ^ (s_type_path en.e_path)) p
 				in
 				in
 				let monos = List.map (fun _ -> mk_mono()) ef.ef_params in
 				let monos = List.map (fun _ -> mk_mono()) ef.ef_params in
-				let tl,r = match apply_params en.e_types pl (apply_params ef.ef_params monos ef.ef_type) with
+				let tl,r = match apply_params en.e_params pl (apply_params ef.ef_params monos ef.ef_type) with
 					| TFun(args,r) ->
 					| TFun(args,r) ->
 						unify ctx r t p;
 						unify ctx r t p;
 						List.map (fun (n,_,t) -> t) args,r
 						List.map (fun (n,_,t) -> t) args,r
@@ -403,7 +403,7 @@ let to_pattern ctx e t =
 				mk_con_pat (CEnum(en,ef)) el r p
 				mk_con_pat (CEnum(en,ef)) el r p
 			| _ -> perror p)
 			| _ -> perror p)
 		| EConst(Ident "_") ->
 		| EConst(Ident "_") ->
-			begin match get_tuple_types t with
+			begin match get_tuple_params t with
 			| Some tl ->
 			| Some tl ->
 				let pl = List.map (fun (_,_,t) -> mk_any t p) tl in
 				let pl = List.map (fun (_,_,t) -> mk_any t p) tl in
 				mk_pat (PTuple (Array.of_list pl)) t_dynamic p
 				mk_pat (PTuple (Array.of_list pl)) t_dynamic p
@@ -429,7 +429,7 @@ let to_pattern ctx e t =
 								error msg p
 								error msg p
 							| _ -> ());
 							| _ -> ());
 						let et = mk (TTypeExpr (TEnumDecl en)) (TAnon { a_fields = PMap.empty; a_status = ref (EnumStatics en) }) p in
 						let et = mk (TTypeExpr (TEnumDecl en)) (TAnon { a_fields = PMap.empty; a_status = ref (EnumStatics en) }) p in
-						mk (TField (et,FEnum (en,ef))) (apply_params en.e_types pl ef.ef_type) p
+						mk (TField (et,FEnum (en,ef))) (apply_params en.e_params pl ef.ef_type) p
 					| TAbstract({a_impl = Some c} as a,_) when Meta.has Meta.Enum a.a_meta ->
 					| TAbstract({a_impl = Some c} as a,_) when Meta.has Meta.Enum a.a_meta ->
 						let cf = PMap.find s c.cl_statics in
 						let cf = PMap.find s c.cl_statics in
 						Type.unify (follow cf.cf_type) t;
 						Type.unify (follow cf.cf_type) t;
@@ -450,7 +450,7 @@ let to_pattern ctx e t =
 					| TField (_,FEnum (en,ef)) ->
 					| TField (_,FEnum (en,ef)) ->
 						begin try unify_raise ctx ec.etype t ec.epos with Error (Unify _,_) -> raise Not_found end;
 						begin try unify_raise ctx ec.etype t ec.epos with Error (Unify _,_) -> raise Not_found end;
 						begin try
 						begin try
-							unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_types) ef t;
+							unify_enum_field en (List.map (fun _ -> mk_mono()) en.e_params) ef t;
 						with Unify_error l ->
 						with Unify_error l ->
 							error (error_msg (Unify l)) p
 							error (error_msg (Unify l)) p
 						end;
 						end;
@@ -464,7 +464,7 @@ let to_pattern ctx e t =
 					| _ ->
 					| _ ->
 						raise Not_found);
 						raise Not_found);
 			with Not_found ->
 			with Not_found ->
-				begin match get_tuple_types t with
+				begin match get_tuple_params t with
 					| Some tl ->
 					| Some tl ->
 						let s = String.concat "," (List.map (fun (_,_,t) -> s_type t) tl) in
 						let s = String.concat "," (List.map (fun (_,_,t) -> s_type t) tl) in
 						error ("Pattern should be tuple [" ^ s ^ "]") p
 						error ("Pattern should be tuple [" ^ s ^ "]") p
@@ -506,14 +506,14 @@ let to_pattern ctx e t =
 				| TAnon {a_fields = fields} ->
 				| TAnon {a_fields = fields} ->
 					fields,(fun cf -> cf.cf_type)
 					fields,(fun cf -> cf.cf_type)
 				| TInst(c,tl) ->
 				| TInst(c,tl) ->
-					c.cl_fields,(fun cf -> apply_params c.cl_types tl (monomorphs cf.cf_params cf.cf_type))
+					c.cl_fields,(fun cf -> apply_params c.cl_params tl (monomorphs cf.cf_params cf.cf_type))
 				| TAbstract({a_impl = Some c} as a,tl) ->
 				| TAbstract({a_impl = Some c} as a,tl) ->
 					let fields = List.fold_left (fun acc cf ->
 					let fields = List.fold_left (fun acc cf ->
 						if Meta.has Meta.Impl cf.cf_meta then
 						if Meta.has Meta.Impl cf.cf_meta then
 							PMap.add cf.cf_name cf acc
 							PMap.add cf.cf_name cf acc
 						else acc
 						else acc
 					) PMap.empty c.cl_ordered_statics in
 					) PMap.empty c.cl_ordered_statics in
-					fields,(fun cf -> apply_params a.a_types tl (monomorphs cf.cf_params cf.cf_type))
+					fields,(fun cf -> apply_params a.a_params tl (monomorphs cf.cf_params cf.cf_type))
 				| _ ->
 				| _ ->
 					error ((s_type t) ^ " cannot be matched against a structure") p
 					error ((s_type t) ^ " cannot be matched against a structure") p
 			in
 			in
@@ -792,7 +792,7 @@ let rec is_explicit_null = function
 	| TLazy f ->
 	| TLazy f ->
 		is_null (!f())
 		is_null (!f())
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		is_null (apply_params t.t_types tl t.t_type)
+		is_null (apply_params t.t_params tl t.t_type)
 	| _ ->
 	| _ ->
 		false
 		false
 
 

+ 7 - 7
optimizer.ml

@@ -193,14 +193,14 @@ let inline_default_config cf t =
 	(* type substitution on both class and function type parameters *)
 	(* type substitution on both class and function type parameters *)
 	let rec get_params c pl =
 	let rec get_params c pl =
 		match c.cl_super with
 		match c.cl_super with
-		| None -> c.cl_types, pl
+		| None -> c.cl_params, pl
 		| Some (csup,spl) ->
 		| Some (csup,spl) ->
-			let spl = (match apply_params c.cl_types pl (TInst (csup,spl)) with
+			let spl = (match apply_params c.cl_params pl (TInst (csup,spl)) with
 			| TInst (_,pl) -> pl
 			| TInst (_,pl) -> pl
 			| _ -> assert false
 			| _ -> assert false
 			) in
 			) in
 			let ct, cpl = get_params csup spl in
 			let ct, cpl = get_params csup spl in
-			c.cl_types @ ct, pl @ cpl
+			c.cl_params @ ct, pl @ cpl
 	in
 	in
 	let tparams = (match follow t with
 	let tparams = (match follow t with
 		| TInst (c,pl) -> get_params c pl
 		| TInst (c,pl) -> get_params c pl
@@ -674,12 +674,12 @@ let rec optimize_for_loop ctx i e1 e2 p =
 	| _ , TInst({ cl_path = ["flash"],"Vector" },[pt]) ->
 	| _ , TInst({ cl_path = ["flash"],"Vector" },[pt]) ->
 		gen_int_iter pt get_next_array_element get_array_length
 		gen_int_iter pt get_next_array_element get_array_length
 	| _ , TInst({ cl_array_access = Some pt } as c,pl) when (try match follow (PMap.find "length" c.cl_fields).cf_type with TAbstract ({ a_path = [],"Int" },[]) -> true | _ -> false with Not_found -> false) && not (PMap.mem "iterator" c.cl_fields) ->
 	| _ , TInst({ cl_array_access = Some pt } as c,pl) when (try match follow (PMap.find "length" c.cl_fields).cf_type with TAbstract ({ a_path = [],"Int" },[]) -> true | _ -> false with Not_found -> false) && not (PMap.mem "iterator" c.cl_fields) ->
-		gen_int_iter (apply_params c.cl_types pl pt) get_next_array_element get_array_length
+		gen_int_iter (apply_params c.cl_params pl pt) get_next_array_element get_array_length
 	| _, TAbstract({a_impl = Some c} as a,tl) ->
 	| _, TAbstract({a_impl = Some c} as a,tl) ->
 		begin try
 		begin try
 			let cf_length = PMap.find "get_length" c.cl_statics in
 			let cf_length = PMap.find "get_length" c.cl_statics in
 			let get_length e p =
 			let get_length e p =
-				make_static_call ctx c cf_length (apply_params a.a_types tl) [e] ctx.com.basic.tint p
+				make_static_call ctx c cf_length (apply_params a.a_params tl) [e] ctx.com.basic.tint p
 			in
 			in
 			begin match follow cf_length.cf_type with
 			begin match follow cf_length.cf_type with
 				| TFun(_,tr) ->
 				| TFun(_,tr) ->
@@ -694,7 +694,7 @@ let rec optimize_for_loop ctx i e1 e2 p =
 				(* first try: do we have an @:arrayAccess getter field? *)
 				(* first try: do we have an @:arrayAccess getter field? *)
 				let cf,tf,r = find_array_access a tl ctx.com.basic.tint (mk_mono()) false in
 				let cf,tf,r = find_array_access a tl ctx.com.basic.tint (mk_mono()) false in
 				let get_next e_base e_index t p =
 				let get_next e_base e_index t p =
-					make_static_call ctx c cf (apply_params a.a_types tl) [e_base;e_index] r p
+					make_static_call ctx c cf (apply_params a.a_params tl) [e_base;e_index] r p
 				in
 				in
 				gen_int_iter r get_next get_length
 				gen_int_iter r get_next get_length
 			with Not_found ->
 			with Not_found ->
@@ -805,7 +805,7 @@ let sanitize_expr com e =
 				| TMono _ -> () (* in these cases the null will cast to default value *)
 				| TMono _ -> () (* in these cases the null will cast to default value *)
 				| TFun _ -> () (* this is a bit a particular case, maybe flash-specific actually *)
 				| TFun _ -> () (* this is a bit a particular case, maybe flash-specific actually *)
 				(* TODO: this should use get_underlying_type, but we do not have access to Codegen here.  *)
 				(* TODO: this should use get_underlying_type, but we do not have access to Codegen here.  *)
-				| TAbstract(a,tl) when not (Meta.has Meta.CoreType a.a_meta) -> loop (apply_params a.a_types tl a.a_this)
+				| TAbstract(a,tl) when not (Meta.has Meta.CoreType a.a_meta) -> loop (apply_params a.a_params tl a.a_this)
 				| _ -> com.error ("On static platforms, null can't be used as basic type " ^ s_type (print_context()) e.etype) e.epos
 				| _ -> com.error ("On static platforms, null can't be used as basic type " ^ s_type (print_context()) e.etype) e.epos
 			in
 			in
 			loop e.etype
 			loop e.etype

+ 35 - 35
type.ml

@@ -178,7 +178,7 @@ and tinfos = {
 	mt_private : bool;
 	mt_private : bool;
 	mt_doc : Ast.documentation;
 	mt_doc : Ast.documentation;
 	mutable mt_meta : metadata;
 	mutable mt_meta : metadata;
-	mt_types : type_params;
+	mt_params : type_params;
 }
 }
 
 
 and tclass = {
 and tclass = {
@@ -188,7 +188,7 @@ and tclass = {
 	mutable cl_private : bool;
 	mutable cl_private : bool;
 	mutable cl_doc : Ast.documentation;
 	mutable cl_doc : Ast.documentation;
 	mutable cl_meta : metadata;
 	mutable cl_meta : metadata;
-	mutable cl_types : type_params;
+	mutable cl_params : type_params;
 	(* do not insert any fields above *)
 	(* do not insert any fields above *)
 	mutable cl_kind : tclass_kind;
 	mutable cl_kind : tclass_kind;
 	mutable cl_extern : bool;
 	mutable cl_extern : bool;
@@ -226,7 +226,7 @@ and tenum = {
 	e_private : bool;
 	e_private : bool;
 	e_doc : Ast.documentation;
 	e_doc : Ast.documentation;
 	mutable e_meta : metadata;
 	mutable e_meta : metadata;
-	mutable e_types : type_params;
+	mutable e_params : type_params;
 	(* do not insert any fields above *)
 	(* do not insert any fields above *)
 	e_type : tdef;
 	e_type : tdef;
 	mutable e_extern : bool;
 	mutable e_extern : bool;
@@ -241,7 +241,7 @@ and tdef = {
 	t_private : bool;
 	t_private : bool;
 	t_doc : Ast.documentation;
 	t_doc : Ast.documentation;
 	mutable t_meta : metadata;
 	mutable t_meta : metadata;
-	mutable t_types : type_params;
+	mutable t_params : type_params;
 	(* do not insert any fields above *)
 	(* do not insert any fields above *)
 	mutable t_type : t;
 	mutable t_type : t;
 }
 }
@@ -253,7 +253,7 @@ and tabstract = {
 	a_private : bool;
 	a_private : bool;
 	a_doc : Ast.documentation;
 	a_doc : Ast.documentation;
 	mutable a_meta : metadata;
 	mutable a_meta : metadata;
-	mutable a_types : type_params;
+	mutable a_params : type_params;
 	(* do not insert any fields above *)
 	(* do not insert any fields above *)
 	mutable a_ops : (Ast.binop * tclass_field) list;
 	mutable a_ops : (Ast.binop * tclass_field) list;
 	mutable a_unops : (Ast.unop * unop_flag * tclass_field) list;
 	mutable a_unops : (Ast.unop * unop_flag * tclass_field) list;
@@ -351,7 +351,7 @@ let mk_class m path pos =
 		cl_kind = KNormal;
 		cl_kind = KNormal;
 		cl_extern = false;
 		cl_extern = false;
 		cl_interface = false;
 		cl_interface = false;
-		cl_types = [];
+		cl_params = [];
 		cl_super = None;
 		cl_super = None;
 		cl_implements = [];
 		cl_implements = [];
 		cl_fields = PMap.empty;
 		cl_fields = PMap.empty;
@@ -545,7 +545,7 @@ let rec follow t =
 	| TLazy f ->
 	| TLazy f ->
 		follow (!f())
 		follow (!f())
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		follow (apply_params t.t_types tl t.t_type)
+		follow (apply_params t.t_params tl t.t_type)
 	| _ -> t
 	| _ -> t
 
 
 let rec is_nullable ?(no_lazy=false) = function
 let rec is_nullable ?(no_lazy=false) = function
@@ -556,7 +556,7 @@ let rec is_nullable ?(no_lazy=false) = function
 	| TLazy f ->
 	| TLazy f ->
 		if no_lazy then raise Exit else is_nullable (!f())
 		if no_lazy then raise Exit else is_nullable (!f())
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		is_nullable (apply_params t.t_types tl t.t_type)
+		is_nullable (apply_params t.t_params tl t.t_type)
 	| TFun _ ->
 	| TFun _ ->
 		false
 		false
 (*
 (*
@@ -571,7 +571,7 @@ let rec is_nullable ?(no_lazy=false) = function
 	| TAbstract (a,_) when Meta.has Meta.CoreType a.a_meta ->
 	| TAbstract (a,_) when Meta.has Meta.CoreType a.a_meta ->
 		not (Meta.has Meta.NotNull a.a_meta)
 		not (Meta.has Meta.NotNull a.a_meta)
 	| TAbstract (a,tl) ->
 	| TAbstract (a,tl) ->
-		is_nullable (apply_params a.a_types tl a.a_this)
+		is_nullable (apply_params a.a_params tl a.a_this)
 	| _ ->
 	| _ ->
 		true
 		true
 
 
@@ -583,7 +583,7 @@ let rec is_null = function
 	| TLazy f ->
 	| TLazy f ->
 		is_null (!f())
 		is_null (!f())
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		is_null (apply_params t.t_types tl t.t_type)
+		is_null (apply_params t.t_params tl t.t_type)
 	| _ ->
 	| _ ->
 		false
 		false
 
 
@@ -648,7 +648,7 @@ let rec raw_class_field build_type c i =
 			raise Not_found
 			raise Not_found
 		| Some (c,tl) ->
 		| Some (c,tl) ->
 			let c2 , t , f = raw_class_field build_type c i in
 			let c2 , t , f = raw_class_field build_type c i in
-			c2, apply_params c.cl_types tl t , f
+			c2, apply_params c.cl_params tl t , f
 	with Not_found ->
 	with Not_found ->
 		match c.cl_kind with
 		match c.cl_kind with
 		| KTypeParameter tl ->
 		| KTypeParameter tl ->
@@ -666,7 +666,7 @@ let rec raw_class_field build_type c i =
 					| TInst (c,pl) ->
 					| TInst (c,pl) ->
 						(try
 						(try
 							let c2, t , f = raw_class_field build_type c i in
 							let c2, t , f = raw_class_field build_type c i in
-							c2, apply_params c.cl_types pl t, f
+							c2, apply_params c.cl_params pl t, f
 						with
 						with
 							Not_found -> loop ctl)
 							Not_found -> loop ctl)
 					| _ ->
 					| _ ->
@@ -685,7 +685,7 @@ let rec raw_class_field build_type c i =
 				| (c,tl) :: l ->
 				| (c,tl) :: l ->
 					try
 					try
 						let c2, t , f = raw_class_field build_type c i in
 						let c2, t , f = raw_class_field build_type c i in
-						c2, apply_params c.cl_types tl t, f
+						c2, apply_params c.cl_params tl t, f
 					with
 					with
 						Not_found -> loop l
 						Not_found -> loop l
 			in
 			in
@@ -732,7 +732,7 @@ let rec get_constructor build_type c =
 	| None, None -> raise Not_found
 	| None, None -> raise Not_found
 	| None, Some (csup,cparams) ->
 	| None, Some (csup,cparams) ->
 		let t, c = get_constructor build_type csup in
 		let t, c = get_constructor build_type csup in
-		apply_params csup.cl_types cparams t, c
+		apply_params csup.cl_params cparams t, c
 
 
 (* ======= Printing ======= *)
 (* ======= Printing ======= *)
 
 
@@ -1174,14 +1174,14 @@ let rec type_eq param a b =
 	| TType (t1,tl1), TType (t2,tl2) when (t1 == t2 || (param = EqCoreType && t1.t_path = t2.t_path)) && List.length tl1 = List.length tl2 ->
 	| TType (t1,tl1), TType (t2,tl2) when (t1 == t2 || (param = EqCoreType && t1.t_path = t2.t_path)) && List.length tl1 = List.length tl2 ->
 		List.iter2 (type_eq param) tl1 tl2
 		List.iter2 (type_eq param) tl1 tl2
 	| TType (t,tl) , _ when param <> EqCoreType ->
 	| TType (t,tl) , _ when param <> EqCoreType ->
-		type_eq param (apply_params t.t_types tl t.t_type) b
+		type_eq param (apply_params t.t_params tl t.t_type) b
 	| _ , TType (t,tl) when param <> EqCoreType ->
 	| _ , TType (t,tl) when param <> EqCoreType ->
 		if List.exists (fun (a2,b2) -> fast_eq a a2 && fast_eq b b2) (!eq_stack) then
 		if List.exists (fun (a2,b2) -> fast_eq a a2 && fast_eq b b2) (!eq_stack) then
 			()
 			()
 		else begin
 		else begin
 			eq_stack := (a,b) :: !eq_stack;
 			eq_stack := (a,b) :: !eq_stack;
 			try
 			try
-				type_eq param a (apply_params t.t_types tl t.t_type);
+				type_eq param a (apply_params t.t_params tl t.t_type);
 				eq_stack := List.tl !eq_stack;
 				eq_stack := List.tl !eq_stack;
 			with
 			with
 				Unify_error l ->
 				Unify_error l ->
@@ -1269,7 +1269,7 @@ let rec unify a b =
 		if not (List.exists (fun (a2,b2) -> fast_eq a a2 && fast_eq b b2) (!unify_stack)) then begin
 		if not (List.exists (fun (a2,b2) -> fast_eq a a2 && fast_eq b b2) (!unify_stack)) then begin
 			try
 			try
 				unify_stack := (a,b) :: !unify_stack;
 				unify_stack := (a,b) :: !unify_stack;
-				unify (apply_params t.t_types tl t.t_type) b;
+				unify (apply_params t.t_params tl t.t_type) b;
 				unify_stack := List.tl !unify_stack;
 				unify_stack := List.tl !unify_stack;
 			with
 			with
 				Unify_error l ->
 				Unify_error l ->
@@ -1280,7 +1280,7 @@ let rec unify a b =
 		if not (List.exists (fun (a2,b2) -> fast_eq a a2 && fast_eq b b2) (!unify_stack)) then begin
 		if not (List.exists (fun (a2,b2) -> fast_eq a a2 && fast_eq b b2) (!unify_stack)) then begin
 			try
 			try
 				unify_stack := (a,b) :: !unify_stack;
 				unify_stack := (a,b) :: !unify_stack;
-				unify a (apply_params t.t_types tl t.t_type);
+				unify a (apply_params t.t_params tl t.t_type);
 				unify_stack := List.tl !unify_stack;
 				unify_stack := List.tl !unify_stack;
 			with
 			with
 				Unify_error l ->
 				Unify_error l ->
@@ -1308,12 +1308,12 @@ let rec unify a b =
 			end else (match c.cl_super with
 			end else (match c.cl_super with
 				| None -> false
 				| None -> false
 				| Some (cs,tls) ->
 				| Some (cs,tls) ->
-					loop cs (List.map (apply_params c.cl_types tl) tls)
+					loop cs (List.map (apply_params c.cl_params tl) tls)
 			) || List.exists (fun (cs,tls) ->
 			) || List.exists (fun (cs,tls) ->
-				loop cs (List.map (apply_params c.cl_types tl) tls)
+				loop cs (List.map (apply_params c.cl_params tl) tls)
 			) c.cl_implements
 			) c.cl_implements
 			|| (match c.cl_kind with
 			|| (match c.cl_kind with
-			| KTypeParameter pl -> List.exists (fun t -> match follow t with TInst (cs,tls) -> loop cs (List.map (apply_params c.cl_types tl) tls) | _ -> false) pl
+			| KTypeParameter pl -> List.exists (fun t -> match follow t with TInst (cs,tls) -> loop cs (List.map (apply_params c.cl_params tl) tls) | _ -> false) pl
 			| _ -> false)
 			| _ -> false)
 		in
 		in
 		if not (loop c1 tl1) then error [cannot_unify a b]
 		if not (loop c1 tl1) then error [cannot_unify a b]
@@ -1344,7 +1344,7 @@ let rec unify a b =
 				if not (unify_kind f1.cf_kind f2.cf_kind) then error [invalid_kind n f1.cf_kind f2.cf_kind];
 				if not (unify_kind f1.cf_kind f2.cf_kind) then error [invalid_kind n f1.cf_kind f2.cf_kind];
 				if f2.cf_public && not f1.cf_public then error [invalid_visibility n];
 				if f2.cf_public && not f1.cf_public then error [invalid_visibility n];
 				(try
 				(try
-					unify_with_access (apply_params c.cl_types tl ft) f2
+					unify_with_access (apply_params c.cl_params tl ft) f2
 				with
 				with
 					Unify_error l -> error (invalid_field n :: l));
 					Unify_error l -> error (invalid_field n :: l));
 				List.iter (fun f2o ->
 				List.iter (fun f2o ->
@@ -1409,11 +1409,11 @@ let rec unify a b =
 			Unify_error l -> error (cannot_unify a b :: l))
 			Unify_error l -> error (cannot_unify a b :: l))
 	| TAnon an, TAbstract ({ a_path = [],"Class" },[pt]) ->
 	| TAnon an, TAbstract ({ a_path = [],"Class" },[pt]) ->
 		(match !(an.a_status) with
 		(match !(an.a_status) with
-		| Statics cl -> unify (TInst (cl,List.map (fun _ -> mk_mono()) cl.cl_types)) pt
+		| Statics cl -> unify (TInst (cl,List.map (fun _ -> mk_mono()) cl.cl_params)) pt
 		| _ -> error [cannot_unify a b])
 		| _ -> error [cannot_unify a b])
 	| TAnon an, TAbstract ({ a_path = [],"Enum" },[pt]) ->
 	| TAnon an, TAbstract ({ a_path = [],"Enum" },[pt]) ->
 		(match !(an.a_status) with
 		(match !(an.a_status) with
-		| EnumStatics e -> unify (TEnum (e,List.map (fun _ -> mk_mono()) e.e_types)) pt
+		| EnumStatics e -> unify (TEnum (e,List.map (fun _ -> mk_mono()) e.e_params)) pt
 		| _ -> error [cannot_unify a b])
 		| _ -> error [cannot_unify a b])
 	| TEnum _, TAbstract ({ a_path = [],"EnumValue" },[]) ->
 	| TEnum _, TAbstract ({ a_path = [],"EnumValue" },[]) ->
 		()
 		()
@@ -1464,7 +1464,7 @@ let rec unify a b =
 	| TInst ({ cl_kind = KTypeParameter ctl } as c,pl), TAbstract (bb,tl) ->
 	| TInst ({ cl_kind = KTypeParameter ctl } as c,pl), TAbstract (bb,tl) ->
 		(* one of the constraints must satisfy the abstract *)
 		(* one of the constraints must satisfy the abstract *)
 		if not (List.exists (fun t ->
 		if not (List.exists (fun t ->
-			let t = apply_params c.cl_types pl t in
+			let t = apply_params c.cl_params pl t in
 			try unify t b; true with Unify_error _ -> false
 			try unify t b; true with Unify_error _ -> false
 		) ctl) && not (List.exists (unify_from_field bb tl a b) bb.a_from) then error [cannot_unify a b];
 		) ctl) && not (List.exists (unify_from_field bb tl a b) bb.a_from) then error [cannot_unify a b];
 	| _, TAbstract (bb,tl) ->
 	| _, TAbstract (bb,tl) ->
@@ -1480,7 +1480,7 @@ and unify_from_field ab tl a b ?(allow_transitive_cast=true) (t,cfo) =
 		| Some cf -> (match follow cf.cf_type with
 		| Some cf -> (match follow cf.cf_type with
 			| TFun(_,r) ->
 			| TFun(_,r) ->
 				let monos = List.map (fun _ -> mk_mono()) cf.cf_params in
 				let monos = List.map (fun _ -> mk_mono()) cf.cf_params in
-				let map t = apply_params ab.a_types tl (apply_params cf.cf_params monos t) in
+				let map t = apply_params ab.a_params tl (apply_params cf.cf_params monos t) in
 				unify_func a (map t);
 				unify_func a (map t);
 				List.iter2 (fun m (name,t) -> match follow t with
 				List.iter2 (fun m (name,t) -> match follow t with
 					| TInst ({ cl_kind = KTypeParameter constr },_) when constr <> [] ->
 					| TInst ({ cl_kind = KTypeParameter constr },_) when constr <> [] ->
@@ -1490,7 +1490,7 @@ and unify_from_field ab tl a b ?(allow_transitive_cast=true) (t,cfo) =
 				unify (map r) b;
 				unify (map r) b;
 			| _ -> assert false)
 			| _ -> assert false)
 		| _ ->
 		| _ ->
-			unify_func a (apply_params ab.a_types tl t)
+			unify_func a (apply_params ab.a_params tl t)
 		end;
 		end;
 		true
 		true
 	with Unify_error _ -> false
 	with Unify_error _ -> false
@@ -1513,7 +1513,7 @@ and unify_to_field ab tl b ?(allow_transitive_cast=true) (t,cfo) =
 		| Some cf -> (match follow cf.cf_type with
 		| Some cf -> (match follow cf.cf_type with
 			| TFun((_,_,ta) :: _,_) ->
 			| TFun((_,_,ta) :: _,_) ->
 				let monos = List.map (fun _ -> mk_mono()) cf.cf_params in
 				let monos = List.map (fun _ -> mk_mono()) cf.cf_params in
-				let map t = apply_params ab.a_types tl (apply_params cf.cf_params monos t) in
+				let map t = apply_params ab.a_params tl (apply_params cf.cf_params monos t) in
 				let athis = map ab.a_this in
 				let athis = map ab.a_this in
 				(* we cannot allow implicit casts when the this type is not completely known yet *)
 				(* we cannot allow implicit casts when the this type is not completely known yet *)
 				(* if has_mono athis then raise (Unify_error []); *)
 				(* if has_mono athis then raise (Unify_error []); *)
@@ -1527,7 +1527,7 @@ and unify_to_field ab tl b ?(allow_transitive_cast=true) (t,cfo) =
 				unify_func (map t) b;
 				unify_func (map t) b;
 			| _ -> assert false)
 			| _ -> assert false)
 		| _ ->
 		| _ ->
-			unify_func (apply_params ab.a_types tl t) b;
+			unify_func (apply_params ab.a_params tl t) b;
 		end;
 		end;
 		true
 		true
 	with Unify_error _ -> false
 	with Unify_error _ -> false
@@ -1550,17 +1550,17 @@ and unify_with_variance f t1 t2 =
 		List.iter2 f tl1 tl2
 		List.iter2 f tl1 tl2
 	| TAbstract(a1,pl1),TAbstract(a2,pl2) ->
 	| TAbstract(a1,pl1),TAbstract(a2,pl2) ->
 		if (Meta.has Meta.CoreType a1.a_meta) && (Meta.has Meta.CoreType a2.a_meta) then begin
 		if (Meta.has Meta.CoreType a1.a_meta) && (Meta.has Meta.CoreType a2.a_meta) then begin
-			let ta1 = apply_params a1.a_types pl1 a1.a_this in
-			let ta2 = apply_params a2.a_types pl2 a2.a_this in
+			let ta1 = apply_params a1.a_params pl1 a1.a_this in
+			let ta2 = apply_params a2.a_params pl2 a2.a_this in
 			type_eq EqStrict ta1 ta2;
 			type_eq EqStrict ta1 ta2;
 		end;
 		end;
 		if not (List.exists (allows_variance_to t2) a1.a_to) && not (List.exists (allows_variance_to t1) a2.a_from) then
 		if not (List.exists (allows_variance_to t2) a1.a_to) && not (List.exists (allows_variance_to t1) a2.a_from) then
 			error [cannot_unify t1 t2]
 			error [cannot_unify t1 t2]
 	| TAbstract(a,pl),t ->
 	| TAbstract(a,pl),t ->
-		type_eq EqStrict (apply_params a.a_types pl a.a_this) t;
+		type_eq EqStrict (apply_params a.a_params pl a.a_this) t;
 		if not (List.exists (allows_variance_to t) a.a_to) then error [cannot_unify t1 t2]
 		if not (List.exists (allows_variance_to t) a.a_to) then error [cannot_unify t1 t2]
 	| t,TAbstract(a,pl) ->
 	| t,TAbstract(a,pl) ->
-		type_eq EqStrict t (apply_params a.a_types pl a.a_this);
+		type_eq EqStrict t (apply_params a.a_params pl a.a_this);
 		if not (List.exists (allows_variance_to t) a.a_from) then error [cannot_unify t1 t2]
 		if not (List.exists (allows_variance_to t) a.a_from) then error [cannot_unify t1 t2]
 	| _ ->
 	| _ ->
 		error [cannot_unify t1 t2]
 		error [cannot_unify t1 t2]
@@ -1847,13 +1847,13 @@ let map_expr_type f ft fv e =
 (* ======= Miscellaneous ======= *)
 (* ======= Miscellaneous ======= *)
 
 
 let find_array_access a pl t1 t2 is_set =
 let find_array_access a pl t1 t2 is_set =
-	let ta = apply_params a.a_types pl a.a_this in
+	let ta = apply_params a.a_params pl a.a_this in
 	let rec loop cfl = match cfl with
 	let rec loop cfl = match cfl with
 		| [] -> raise Not_found
 		| [] -> raise Not_found
 		| cf :: cfl when not (Meta.has Meta.ArrayAccess cf.cf_meta) ->
 		| cf :: cfl when not (Meta.has Meta.ArrayAccess cf.cf_meta) ->
 			loop cfl
 			loop cfl
 		| cf :: cfl ->
 		| cf :: cfl ->
-			match follow (apply_params a.a_types pl (monomorphs cf.cf_params cf.cf_type)) with
+			match follow (apply_params a.a_params pl (monomorphs cf.cf_params cf.cf_type)) with
 			| TFun([(_,_,tab);(_,_,ta1);(_,_,ta2)],r) as tf when is_set ->
 			| TFun([(_,_,tab);(_,_,ta1);(_,_,ta2)],r) as tf when is_set ->
 				begin try
 				begin try
 					unify tab ta;
 					unify tab ta;

+ 1 - 1
typecore.ml

@@ -82,7 +82,7 @@ type typer_globals = {
 
 
 and typer_module = {
 and typer_module = {
 	curmod : module_def;
 	curmod : module_def;
-	mutable module_types : module_type list;
+	mutable module_params : module_type list;
 	mutable module_using : tclass list;
 	mutable module_using : tclass list;
 	mutable module_globals : (string, (module_type * string)) PMap.t;
 	mutable module_globals : (string, (module_type * string)) PMap.t;
 	mutable wildcard_packages : string list list;
 	mutable wildcard_packages : string list list;

+ 60 - 60
typeload.ml

@@ -71,7 +71,7 @@ let make_module ctx mpath file tdecls loadp =
 				e_pos = p;
 				e_pos = p;
 				e_doc = d.d_doc;
 				e_doc = d.d_doc;
 				e_meta = d.d_meta;
 				e_meta = d.d_meta;
-				e_types = [];
+				e_params = [];
 				e_private = priv;
 				e_private = priv;
 				e_extern = List.mem EExtern d.d_flags;
 				e_extern = List.mem EExtern d.d_flags;
 				e_constrs = PMap.empty;
 				e_constrs = PMap.empty;
@@ -83,7 +83,7 @@ let make_module ctx mpath file tdecls loadp =
 					t_pos = p;
 					t_pos = p;
 					t_type = mk_mono();
 					t_type = mk_mono();
 					t_private = true;
 					t_private = true;
-					t_types = [];
+					t_params = [];
 					t_meta = [];
 					t_meta = [];
 				};
 				};
 			} in
 			} in
@@ -99,7 +99,7 @@ let make_module ctx mpath file tdecls loadp =
 				t_pos = p;
 				t_pos = p;
 				t_doc = d.d_doc;
 				t_doc = d.d_doc;
 				t_private = priv;
 				t_private = priv;
-				t_types = [];
+				t_params = [];
 				t_type = mk_mono();
 				t_type = mk_mono();
 				t_meta = d.d_meta;
 				t_meta = d.d_meta;
 			} in
 			} in
@@ -114,7 +114,7 @@ let make_module ctx mpath file tdecls loadp =
 				a_module = m;
 				a_module = m;
 				a_pos = p;
 				a_pos = p;
 				a_doc = d.d_doc;
 				a_doc = d.d_doc;
-				a_types = [];
+				a_params = [];
 				a_meta = d.d_meta;
 				a_meta = d.d_meta;
 				a_from = [];
 				a_from = [];
 				a_to = [];
 				a_to = [];
@@ -257,7 +257,7 @@ let rec load_type_def ctx p t =
 		List.find (fun t2 ->
 		List.find (fun t2 ->
 			let tp = t_path t2 in
 			let tp = t_path t2 in
 			tp = (t.tpackage,tname) || (no_pack && snd tp = tname)
 			tp = (t.tpackage,tname) || (no_pack && snd tp = tname)
-		) (ctx.m.curmod.m_types @ ctx.m.module_types)
+		) (ctx.m.curmod.m_types @ ctx.m.module_params)
 	with
 	with
 		Not_found ->
 		Not_found ->
 			let next() =
 			let next() =
@@ -611,13 +611,13 @@ and init_meta_overloads ctx cf =
 	) cf.cf_meta;
 	) cf.cf_meta;
 	cf.cf_overloads <- List.map (fun (args,ret,params) -> { cf with cf_type = TFun (args,ret); cf_params = params }) (List.rev !overloads)
 	cf.cf_overloads <- List.map (fun (args,ret,params) -> { cf with cf_type = TFun (args,ret); cf_params = params }) (List.rev !overloads)
 
 
-let hide_types ctx =
+let hide_params ctx =
 	let old_m = ctx.m in
 	let old_m = ctx.m in
 	let old_type_params = ctx.type_params in
 	let old_type_params = ctx.type_params in
 	let old_deps = ctx.g.std.m_extra.m_deps in
 	let old_deps = ctx.g.std.m_extra.m_deps in
 	ctx.m <- {
 	ctx.m <- {
 		curmod = ctx.g.std;
 		curmod = ctx.g.std;
-		module_types = [];
+		module_params = [];
 		module_using = [];
 		module_using = [];
 		module_globals = PMap.empty;
 		module_globals = PMap.empty;
 		wildcard_packages = [];
 		wildcard_packages = [];
@@ -634,7 +634,7 @@ let hide_types ctx =
 	load a type while ignoring the current imports or local types
 	load a type while ignoring the current imports or local types
 *)
 *)
 let load_core_type ctx name =
 let load_core_type ctx name =
-	let show = hide_types ctx in
+	let show = hide_params ctx in
 	let t = load_instance ctx { tpackage = []; tname = name; tparams = []; tsub = None; } null_pos false in
 	let t = load_instance ctx { tpackage = []; tname = name; tparams = []; tsub = None; } null_pos false in
 	show();
 	show();
 	add_dependency ctx.m.curmod (match t with
 	add_dependency ctx.m.curmod (match t with
@@ -646,14 +646,14 @@ let load_core_type ctx name =
 	t
 	t
 
 
 let t_iterator ctx =
 let t_iterator ctx =
-	let show = hide_types ctx in
+	let show = hide_params ctx in
 	match load_type_def ctx null_pos { tpackage = []; tname = "Iterator"; tparams = []; tsub = None } with
 	match load_type_def ctx null_pos { tpackage = []; tname = "Iterator"; tparams = []; tsub = None } with
 	| TTypeDecl t ->
 	| TTypeDecl t ->
 		show();
 		show();
 		add_dependency ctx.m.curmod t.t_module;
 		add_dependency ctx.m.curmod t.t_module;
-		if List.length t.t_types <> 1 then assert false;
+		if List.length t.t_params <> 1 then assert false;
 		let pt = mk_mono() in
 		let pt = mk_mono() in
-		apply_params t.t_types [pt] t.t_type, pt
+		apply_params t.t_params [pt] t.t_type, pt
 	| _ ->
 	| _ ->
 		assert false
 		assert false
 
 
@@ -686,8 +686,8 @@ let valid_redefinition ctx f1 t1 f2 t2 =
 						let check monos =
 						let check monos =
 							List.iter2 (fun t1 t2  ->
 							List.iter2 (fun t1 t2  ->
 								try
 								try
-									let t1 = apply_params l1 monos (apply_params c1.cl_types pl1 t1) in
-									let t2 = apply_params l2 monos (apply_params c2.cl_types pl2 t2) in
+									let t1 = apply_params l1 monos (apply_params c1.cl_params pl1 t1) in
+									let t2 = apply_params l2 monos (apply_params c2.cl_params pl2 t2) in
 									type_eq EqStrict t1 t2
 									type_eq EqStrict t1 t2
 								with Unify_error l ->
 								with Unify_error l ->
 									raise (Unify_error (Unify_custom "Constraints differ" :: l))
 									raise (Unify_error (Unify_custom "Constraints differ" :: l))
@@ -740,7 +740,7 @@ let same_overload_args t1 t2 f1 f2 =
 		| TType ({ t_path = [],"Null" } as t, [p]) ->
 		| TType ({ t_path = [],"Null" } as t, [p]) ->
 			TType(t,[follow p])
 			TType(t,[follow p])
 		| TType (t,tl) ->
 		| TType (t,tl) ->
-			follow_skip_null (apply_params t.t_types tl t.t_type)
+			follow_skip_null (apply_params t.t_params tl t.t_type)
 		| _ -> t
 		| _ -> t
 	in
 	in
 	let same_arg t1 t2 =
 	let same_arg t1 t2 =
@@ -772,12 +772,12 @@ let rec get_overloads c i =
 	let rsup = match c.cl_super with
 	let rsup = match c.cl_super with
 	| None when c.cl_interface ->
 	| None when c.cl_interface ->
 			let ifaces = List.concat (List.map (fun (c,tl) ->
 			let ifaces = List.concat (List.map (fun (c,tl) ->
-				List.map (fun (t,f) -> apply_params c.cl_types tl t, f) (get_overloads c i)
+				List.map (fun (t,f) -> apply_params c.cl_params tl t, f) (get_overloads c i)
 			) c.cl_implements) in
 			) c.cl_implements) in
 			ret @ ifaces
 			ret @ ifaces
 	| None -> ret
 	| None -> ret
 	| Some (c,tl) ->
 	| Some (c,tl) ->
-			ret @ ( List.map (fun (t,f) -> apply_params c.cl_types tl t, f) (get_overloads c i) )
+			ret @ ( List.map (fun (t,f) -> apply_params c.cl_params tl t, f) (get_overloads c i) )
 	in
 	in
 	ret @ (List.filter (fun (t,f) -> not (List.exists (fun (t2,f2) -> same_overload_args t t2 f f2) ret)) rsup)
 	ret @ (List.filter (fun (t,f) -> not (List.exists (fun (t2,f2) -> same_overload_args t t2 f f2) ret)) rsup)
 
 
@@ -826,7 +826,7 @@ let check_overriding ctx c =
 				| _ ->
 				| _ ->
 					display_error ctx ("Field " ^ i ^ " has different property access than in superclass") p);
 					display_error ctx ("Field " ^ i ^ " has different property access than in superclass") p);
 				try
 				try
-					let t = apply_params csup.cl_types params t in
+					let t = apply_params csup.cl_params params t in
 					valid_redefinition ctx f f.cf_type f2 t
 					valid_redefinition ctx f f.cf_type f2 t
 				with
 				with
 					Unify_error l ->
 					Unify_error l ->
@@ -855,7 +855,7 @@ let check_overriding ctx c =
 					(* find the exact field being overridden *)
 					(* find the exact field being overridden *)
 					check_field f (fun csup i ->
 					check_field f (fun csup i ->
 						List.find (fun (t,f2) ->
 						List.find (fun (t,f2) ->
-							same_overload_args f.cf_type (apply_params csup.cl_types params t) f f2
+							same_overload_args f.cf_type (apply_params csup.cl_params params t) f f2
 						) overloads
 						) overloads
 					) true
 					) true
 				) f.cf_overloads
 				) f.cf_overloads
@@ -876,7 +876,7 @@ let class_field_no_interf c i =
 		| Some (c,tl) ->
 		| Some (c,tl) ->
 			(* rec over class_field *)
 			(* rec over class_field *)
 			let _, t , f = raw_class_field (fun f -> f.cf_type) c i in
 			let _, t , f = raw_class_field (fun f -> f.cf_type) c i in
-			apply_params c.cl_types tl t , f
+			apply_params c.cl_params tl t , f
 
 
 let rec check_interface ctx c intf params =
 let rec check_interface ctx c intf params =
 	let p = c.cl_pos in
 	let p = c.cl_pos in
@@ -893,7 +893,7 @@ let rec check_interface ctx c intf params =
 				if ctx.com.config.pf_overload && (f2.cf_overloads <> [] || Meta.has Meta.Overload f2.cf_meta) then
 				if ctx.com.config.pf_overload && (f2.cf_overloads <> [] || Meta.has Meta.Overload f2.cf_meta) then
 					let overloads = get_overloads c i in
 					let overloads = get_overloads c i in
 					is_overload := true;
 					is_overload := true;
-					let t = (apply_params intf.cl_types params f.cf_type) in
+					let t = (apply_params intf.cl_params params f.cf_type) in
 					List.find (fun (t1,f1) -> same_overload_args t t1 f f1) overloads
 					List.find (fun (t1,f1) -> same_overload_args t t1 f f1) overloads
 				else
 				else
 					t2, f2
 					t2, f2
@@ -911,7 +911,7 @@ let rec check_interface ctx c intf params =
 			else if not (unify_kind f2.cf_kind f.cf_kind) || not (match f.cf_kind, f2.cf_kind with Var _ , Var _ -> true | Method m1, Method m2 -> mkind m1 = mkind m2 | _ -> false) then
 			else if not (unify_kind f2.cf_kind f.cf_kind) || not (match f.cf_kind, f2.cf_kind with Var _ , Var _ -> true | Method m1, Method m2 -> mkind m1 = mkind m2 | _ -> false) then
 				display_error ctx ("Field " ^ i ^ " has different property access than in " ^ s_type_path intf.cl_path ^ " (" ^ s_kind f2.cf_kind ^ " should be " ^ s_kind f.cf_kind ^ ")") p
 				display_error ctx ("Field " ^ i ^ " has different property access than in " ^ s_type_path intf.cl_path ^ " (" ^ s_kind f2.cf_kind ^ " should be " ^ s_kind f.cf_kind ^ ")") p
 			else try
 			else try
-				valid_redefinition ctx f2 t2 f (apply_params intf.cl_types params f.cf_type)
+				valid_redefinition ctx f2 t2 f (apply_params intf.cl_params params f.cf_type)
 			with
 			with
 				Unify_error l ->
 				Unify_error l ->
 					if not (Meta.has Meta.CsNative c.cl_meta && c.cl_extern) then begin
 					if not (Meta.has Meta.CsNative c.cl_meta && c.cl_extern) then begin
@@ -932,7 +932,7 @@ let rec check_interface ctx c intf params =
 	in
 	in
 	PMap.iter check_field intf.cl_fields;
 	PMap.iter check_field intf.cl_fields;
 	List.iter (fun (i2,p2) ->
 	List.iter (fun (i2,p2) ->
-		check_interface ctx c i2 (List.map (apply_params intf.cl_types params) p2)
+		check_interface ctx c i2 (List.map (apply_params intf.cl_params params) p2)
 	) intf.cl_implements
 	) intf.cl_implements
 
 
 let check_interfaces ctx c =
 let check_interfaces ctx c =
@@ -1059,7 +1059,7 @@ let rec add_constructor ctx c force_constructor p =
 					| _ -> assert false
 					| _ -> assert false
 			) in
 			) in
 			let p = c.cl_pos in
 			let p = c.cl_pos in
-			let vars = List.map (fun (v,def) -> alloc_var v.v_name (apply_params csup.cl_types cparams v.v_type), def) args in
+			let vars = List.map (fun (v,def) -> alloc_var v.v_name (apply_params csup.cl_params cparams v.v_type), def) args in
 			let super_call = mk (TCall (mk (TConst TSuper) (TInst (csup,cparams)) p,List.map (fun (v,_) -> mk (TLocal v) v.v_type p) vars)) ctx.t.tvoid p in
 			let super_call = mk (TCall (mk (TConst TSuper) (TInst (csup,cparams)) p,List.map (fun (v,_) -> mk (TLocal v) v.v_type p) vars)) ctx.t.tvoid p in
 			let constr = mk (TFunction {
 			let constr = mk (TFunction {
 				tf_args = vars;
 				tf_args = vars;
@@ -1091,7 +1091,7 @@ let rec add_constructor ctx c force_constructor p =
 		()
 		()
 
 
 let set_heritance ctx c herits p =
 let set_heritance ctx c herits p =
-	let ctx = { ctx with curclass = c; type_params = c.cl_types; } in
+	let ctx = { ctx with curclass = c; type_params = c.cl_params; } in
 	let process_meta csup =
 	let process_meta csup =
 		List.iter (fun m ->
 		List.iter (fun m ->
 			match m with
 			match m with
@@ -1153,7 +1153,7 @@ let set_heritance ctx c herits p =
 		| [] ->
 		| [] ->
 			try
 			try
 				let find = List.find (fun lt -> snd (t_path lt) = t.tname) in
 				let find = List.find (fun lt -> snd (t_path lt) = t.tname) in
-				let lt = try find ctx.m.curmod.m_types with Not_found -> find ctx.m.module_types in
+				let lt = try find ctx.m.curmod.m_types with Not_found -> find ctx.m.module_params in
 				{ t with tpackage = fst (t_path lt) }
 				{ t with tpackage = fst (t_path lt) }
 			with
 			with
 				Not_found -> t
 				Not_found -> t
@@ -1168,10 +1168,10 @@ let set_heritance ctx c herits p =
 let rec type_type_params ?(enum_constructor=false) ctx path get_params p tp =
 let rec type_type_params ?(enum_constructor=false) ctx path get_params p tp =
 	let n = tp.tp_name in
 	let n = tp.tp_name in
 	let c = mk_class ctx.m.curmod (fst path @ [snd path],n) p in
 	let c = mk_class ctx.m.curmod (fst path @ [snd path],n) p in
-	c.cl_types <- List.map (type_type_params ctx c.cl_path get_params p) tp.tp_params;
+	c.cl_params <- List.map (type_type_params ctx c.cl_path get_params p) tp.tp_params;
 	c.cl_kind <- KTypeParameter [];
 	c.cl_kind <- KTypeParameter [];
 	if enum_constructor then c.cl_meta <- (Meta.EnumConstructorParam,[],c.cl_pos) :: c.cl_meta;
 	if enum_constructor then c.cl_meta <- (Meta.EnumConstructorParam,[],c.cl_pos) :: c.cl_meta;
-	let t = TInst (c,List.map snd c.cl_types) in
+	let t = TInst (c,List.map snd c.cl_params) in
 	match tp.tp_constraints with
 	match tp.tp_constraints with
 	| [] ->
 	| [] ->
 		n, t
 		n, t
@@ -1424,7 +1424,7 @@ let init_core_api ctx c =
 			| t1,t2 ->
 			| t1,t2 ->
 				Printf.printf "%s %s" (s_type (print_context()) t1) (s_type (print_context()) t2);
 				Printf.printf "%s %s" (s_type (print_context()) t1) (s_type (print_context()) t2);
 				assert false
 				assert false
-		) ccore.cl_types c.cl_types;
+		) ccore.cl_params c.cl_params;
 	with Invalid_argument _ ->
 	with Invalid_argument _ ->
 		error "Class must have the same number of type parameters as core type" c.cl_pos
 		error "Class must have the same number of type parameters as core type" c.cl_pos
 	end;
 	end;
@@ -1434,7 +1434,7 @@ let init_core_api ctx c =
 	let compare_fields f f2 =
 	let compare_fields f f2 =
 		let p = (match f2.cf_expr with None -> c.cl_pos | Some e -> e.epos) in
 		let p = (match f2.cf_expr with None -> c.cl_pos | Some e -> e.epos) in
 		(try
 		(try
-			type_eq EqCoreType (apply_params ccore.cl_types (List.map snd c.cl_types) f.cf_type) f2.cf_type
+			type_eq EqCoreType (apply_params ccore.cl_params (List.map snd c.cl_params) f.cf_type) f2.cf_type
 		with Unify_error l ->
 		with Unify_error l ->
 			display_error ctx ("Field " ^ f.cf_name ^ " has different type than in core type") p;
 			display_error ctx ("Field " ^ f.cf_name ^ " has different type than in core type") p;
 			display_error ctx (error_msg (Unify l)) p);
 			display_error ctx (error_msg (Unify l)) p);
@@ -1555,7 +1555,7 @@ let build_module_def ctx mt meta fvars context_init fbuild =
 			let s = try String.concat "." (List.rev (string_list_of_expr_path epath)) with Error (_,p) -> error "Build call parameter must be a class path" p in
 			let s = try String.concat "." (List.rev (string_list_of_expr_path epath)) with Error (_,p) -> error "Build call parameter must be a class path" p in
 			if ctx.in_macro then error "You cannot use @:build inside a macro : make sure that your enum is not used in macro" p;
 			if ctx.in_macro then error "You cannot use @:build inside a macro : make sure that your enum is not used in macro" p;
 			let old = ctx.g.get_build_infos in
 			let old = ctx.g.get_build_infos in
-			ctx.g.get_build_infos <- (fun() -> Some (mt, List.map snd (t_infos mt).mt_types, fvars()));
+			ctx.g.get_build_infos <- (fun() -> Some (mt, List.map snd (t_infos mt).mt_params, fvars()));
 			context_init();
 			context_init();
 			let r = try apply_macro ctx MBuild s el p with e -> ctx.g.get_build_infos <- old; raise e in
 			let r = try apply_macro ctx MBuild s el p with e -> ctx.g.get_build_infos <- old; raise e in
 			ctx.g.get_build_infos <- old;
 			ctx.g.get_build_infos <- old;
@@ -1582,14 +1582,14 @@ let init_class ctx c p context_init herits fields =
 	let ctx = {
 	let ctx = {
 		ctx with
 		ctx with
 		curclass = c;
 		curclass = c;
-		type_params = c.cl_types;
+		type_params = c.cl_params;
 		pass = PBuildClass;
 		pass = PBuildClass;
 		tthis = (match c.cl_kind with
 		tthis = (match c.cl_kind with
 			| KAbstractImpl a ->
 			| KAbstractImpl a ->
 				(match a.a_this with
 				(match a.a_this with
-				| TMono r when !r = None -> TAbstract (a,List.map snd c.cl_types)
+				| TMono r when !r = None -> TAbstract (a,List.map snd c.cl_params)
 				| t -> t)
 				| t -> t)
-			| _ -> TInst (c,List.map snd c.cl_types));
+			| _ -> TInst (c,List.map snd c.cl_params));
 		on_error = (fun ctx msg ep ->
 		on_error = (fun ctx msg ep ->
 			ctx.com.error msg ep;
 			ctx.com.error msg ep;
 			(* macros expressions might reference other code, let's recall which class we are actually compiling *)
 			(* macros expressions might reference other code, let's recall which class we are actually compiling *)
@@ -1775,7 +1775,7 @@ let init_class ctx c p context_init herits fields =
 						let e = require_constant_expression e "Inline variable initialization must be a constant value" in
 						let e = require_constant_expression e "Inline variable initialization must be a constant value" in
 						begin match c.cl_kind with
 						begin match c.cl_kind with
 							| KAbstractImpl a when Meta.has Meta.Enum cf.cf_meta && Meta.has Meta.Enum a.a_meta ->
 							| KAbstractImpl a when Meta.has Meta.Enum cf.cf_meta && Meta.has Meta.Enum a.a_meta ->
-								unify ctx (TAbstract(a,(List.map (fun _ -> mk_mono()) a.a_types))) t p;
+								unify ctx (TAbstract(a,(List.map (fun _ -> mk_mono()) a.a_params))) t p;
 								begin match e.eexpr with
 								begin match e.eexpr with
 									| TCast(e1,None) -> unify ctx e1.etype a.a_this e1.epos
 									| TCast(e1,None) -> unify ctx e1.etype a.a_this e1.epos
 									| _ -> assert false
 									| _ -> assert false
@@ -1918,7 +1918,7 @@ let init_class ctx c p context_init herits fields =
 			if inline && dynamic then error (f.cff_name ^ ": You can't have both 'inline' and 'dynamic'") p;
 			if inline && dynamic then error (f.cff_name ^ ": You can't have both 'inline' and 'dynamic'") p;
 			ctx.type_params <- (match c.cl_kind with
 			ctx.type_params <- (match c.cl_kind with
 				| KAbstractImpl a when Meta.has Meta.Impl f.cff_meta || Meta.has Meta.From f.cff_meta || Meta.has Meta.MultiType a.a_meta && Meta.has Meta.To f.cff_meta ->
 				| KAbstractImpl a when Meta.has Meta.Impl f.cff_meta || Meta.has Meta.From f.cff_meta || Meta.has Meta.MultiType a.a_meta && Meta.has Meta.To f.cff_meta ->
-					params @ a.a_types
+					params @ a.a_params
 				| _ ->
 				| _ ->
 					if stat then params else params @ ctx.type_params);
 					if stat then params else params @ ctx.type_params);
 			let constr = (name = "new") in
 			let constr = (name = "new") in
@@ -1966,8 +1966,8 @@ let init_class ctx c p context_init herits fields =
 			(match c.cl_kind with
 			(match c.cl_kind with
 				| KAbstractImpl a ->
 				| KAbstractImpl a ->
 					let m = mk_mono() in
 					let m = mk_mono() in
-					let ta = TAbstract(a, List.map (fun _ -> mk_mono()) a.a_types) in
-					let tthis = if Meta.has Meta.Impl f.cff_meta || Meta.has Meta.To f.cff_meta then monomorphs a.a_types a.a_this else a.a_this in
+					let ta = TAbstract(a, List.map (fun _ -> mk_mono()) a.a_params) in
+					let tthis = if Meta.has Meta.Impl f.cff_meta || Meta.has Meta.To f.cff_meta then monomorphs a.a_params a.a_this else a.a_this in
 					let check_bind () =
 					let check_bind () =
 						if fd.f_expr = None then begin
 						if fd.f_expr = None then begin
 							if inline then error (f.cff_name ^ ": Inline functions must have an expression") f.cff_pos;
 							if inline then error (f.cff_name ^ ": Inline functions must have an expression") f.cff_pos;
@@ -2007,7 +2007,7 @@ let init_class ctx c p context_init herits fields =
 								in
 								in
 								(fun () ->
 								(fun () ->
 									delay ctx PFinal (fun () -> unify ctx m tthis f.cff_pos);
 									delay ctx PFinal (fun () -> unify ctx m tthis f.cff_pos);
-									let args = match follow (monomorphs a.a_types ctor.cf_type) with
+									let args = match follow (monomorphs a.a_params ctor.cf_type) with
 										| TFun(args,_) -> List.map (fun (_,_,t) -> t) args
 										| TFun(args,_) -> List.map (fun (_,_,t) -> t) args
 										| _ -> assert false
 										| _ -> assert false
 									in
 									in
@@ -2090,7 +2090,7 @@ let init_class ctx c p context_init herits fields =
 		| FProp (get,set,t,eo) ->
 		| FProp (get,set,t,eo) ->
 			(match c.cl_kind with
 			(match c.cl_kind with
 			| KAbstractImpl a when Meta.has Meta.Impl f.cff_meta ->
 			| KAbstractImpl a when Meta.has Meta.Impl f.cff_meta ->
-				ctx.type_params <- a.a_types;
+				ctx.type_params <- a.a_params;
 			| _ -> ());
 			| _ -> ());
 			let ret = (match t, eo with
 			let ret = (match t, eo with
 				| None, None -> error (f.cff_name ^ ": Property must either define a type or a default value") p;
 				| None, None -> error (f.cff_name ^ ": Property must either define a type or a default value") p;
@@ -2100,7 +2100,7 @@ let init_class ctx c p context_init herits fields =
 			let t_get,t_set = match c.cl_kind with
 			let t_get,t_set = match c.cl_kind with
 				| KAbstractImpl a when Meta.has Meta.Impl f.cff_meta ->
 				| KAbstractImpl a when Meta.has Meta.Impl f.cff_meta ->
 					if Meta.has Meta.IsVar f.cff_meta then error (f.cff_name ^ ": Abstract properties cannot be real variables") f.cff_pos;
 					if Meta.has Meta.IsVar f.cff_meta then error (f.cff_name ^ ": Abstract properties cannot be real variables") f.cff_pos;
-					let ta = apply_params a.a_types (List.map snd a.a_types) a.a_this in
+					let ta = apply_params a.a_params (List.map snd a.a_params) a.a_this in
 					tfun [ta] ret, tfun [ta;ret] ret
 					tfun [ta] ret, tfun [ta;ret] ret
 				| _ -> tfun [] ret, tfun [ret] ret
 				| _ -> tfun [] ret, tfun [ret] ret
 			in
 			in
@@ -2349,8 +2349,8 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 					t_private = true;
 					t_private = true;
 					t_doc = None;
 					t_doc = None;
 					t_meta = [];
 					t_meta = [];
-					t_types = (t_infos t).mt_types;
-					t_type = f (List.map snd (t_infos t).mt_types);
+					t_params = (t_infos t).mt_params;
+					t_type = f (List.map snd (t_infos t).mt_params);
 				}
 				}
 			in
 			in
 			let add_static_init t name s =
 			let add_static_init t name s =
@@ -2373,15 +2373,15 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 				| [] ->
 				| [] ->
 					(match name with
 					(match name with
 					| None ->
 					| None ->
-						ctx.m.module_types <- List.filter no_private types @ ctx.m.module_types
+						ctx.m.module_params <- List.filter no_private types @ ctx.m.module_params
 					| Some newname ->
 					| Some newname ->
-						ctx.m.module_types <- rebind (get_type tname) newname :: ctx.m.module_types);
+						ctx.m.module_params <- rebind (get_type tname) newname :: ctx.m.module_params);
 				| [tsub,p2] ->
 				| [tsub,p2] ->
 					let p = punion p1 p2 in
 					let p = punion p1 p2 in
 					(try
 					(try
 						let tsub = List.find (has_name tsub) types in
 						let tsub = List.find (has_name tsub) types in
 						chk_private tsub p;
 						chk_private tsub p;
-						ctx.m.module_types <- (match name with None -> tsub | Some n -> rebind tsub n) :: ctx.m.module_types
+						ctx.m.module_params <- (match name with None -> tsub | Some n -> rebind tsub n) :: ctx.m.module_params
 					with Not_found ->
 					with Not_found ->
 						(* this might be a static property, wait later to check *)
 						(* this might be a static property, wait later to check *)
 						let tmain = get_type tname in
 						let tmain = get_type tname in
@@ -2427,11 +2427,11 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 			| None ->
 			| None ->
 				let md = ctx.g.do_load_module ctx (t.tpackage,t.tname) p in
 				let md = ctx.g.do_load_module ctx (t.tpackage,t.tname) p in
 				let types = List.filter (fun t -> not (t_infos t).mt_private) md.m_types in
 				let types = List.filter (fun t -> not (t_infos t).mt_private) md.m_types in
-				ctx.m.module_types <- types @ ctx.m.module_types;
+				ctx.m.module_params <- types @ ctx.m.module_params;
 				types
 				types
 			| Some _ ->
 			| Some _ ->
 				let t = load_type_def ctx p t in
 				let t = load_type_def ctx p t in
-				ctx.m.module_types <- t :: ctx.m.module_types;
+				ctx.m.module_params <- t :: ctx.m.module_params;
 				[t]
 				[t]
 		) in
 		) in
 		(* delay the using since we need to resolve typedefs *)
 		(* delay the using since we need to resolve typedefs *)
@@ -2452,7 +2452,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 	| EClass d ->
 	| EClass d ->
 		let c = (match get_type d.d_name with TClassDecl c -> c | _ -> assert false) in
 		let c = (match get_type d.d_name with TClassDecl c -> c | _ -> assert false) in
 		let herits = d.d_flags in
 		let herits = d.d_flags in
-		if Meta.has Meta.Generic c.cl_meta && c.cl_types <> [] then c.cl_kind <- KGeneric;
+		if Meta.has Meta.Generic c.cl_meta && c.cl_params <> [] then c.cl_kind <- KGeneric;
 		if Meta.has Meta.GenericBuild c.cl_meta then c.cl_kind <- KGenericBuild d.d_data;
 		if Meta.has Meta.GenericBuild c.cl_meta then c.cl_kind <- KGenericBuild d.d_data;
 		if c.cl_path = (["haxe";"macro"],"MacroType") then c.cl_kind <- KMacroType;
 		if c.cl_path = (["haxe";"macro"],"MacroType") then c.cl_kind <- KMacroType;
 		c.cl_extern <- List.mem HExtern herits;
 		c.cl_extern <- List.mem HExtern herits;
@@ -2470,7 +2470,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 		delay ctx PBuildClass (fun() -> c.cl_build());
 		delay ctx PBuildClass (fun() -> c.cl_build());
 	| EEnum d ->
 	| EEnum d ->
 		let e = (match get_type d.d_name with TEnumDecl e -> e | _ -> assert false) in
 		let e = (match get_type d.d_name with TEnumDecl e -> e | _ -> assert false) in
-		let ctx = { ctx with type_params = e.e_types } in
+		let ctx = { ctx with type_params = e.e_params } in
 		let h = (try Some (Hashtbl.find ctx.g.type_patches e.e_path) with Not_found -> None) in
 		let h = (try Some (Hashtbl.find ctx.g.type_patches e.e_path) with Not_found -> None) in
 		(match h with
 		(match h with
 		| None -> ()
 		| None -> ()
@@ -2517,7 +2517,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 				) fields
 				) fields
 			| _ -> error "Enum build macro must return a single variable with anonymous object fields" p
 			| _ -> error "Enum build macro must return a single variable with anonymous object fields" p
 		);
 		);
-		let et = TEnum (e,List.map snd e.e_types) in
+		let et = TEnum (e,List.map snd e.e_params) in
 		let names = ref [] in
 		let names = ref [] in
 		let index = ref 0 in
 		let index = ref 0 in
 		let is_flat = ref true in
 		let is_flat = ref true in
@@ -2583,7 +2583,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 		) (!constructs);
 		) (!constructs);
 		e.e_names <- List.rev !names;
 		e.e_names <- List.rev !names;
 		e.e_extern <- e.e_extern;
 		e.e_extern <- e.e_extern;
-		e.e_type.t_types <- e.e_types;
+		e.e_type.t_params <- e.e_params;
 		e.e_type.t_type <- TAnon {
 		e.e_type.t_type <- TAnon {
 			a_fields = !fields;
 			a_fields = !fields;
 			a_status = ref (EnumStatics e);
 			a_status = ref (EnumStatics e);
@@ -2591,7 +2591,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 		if !is_flat then e.e_meta <- (Meta.FlatEnum,[],e.e_pos) :: e.e_meta;
 		if !is_flat then e.e_meta <- (Meta.FlatEnum,[],e.e_pos) :: e.e_meta;
 	| ETypedef d ->
 	| ETypedef d ->
 		let t = (match get_type d.d_name with TTypeDecl t -> t | _ -> assert false) in
 		let t = (match get_type d.d_name with TTypeDecl t -> t | _ -> assert false) in
-		let ctx = { ctx with type_params = t.t_types } in
+		let ctx = { ctx with type_params = t.t_params } in
 		let tt = load_complex_type ctx p d.d_data in
 		let tt = load_complex_type ctx p d.d_data in
 		(*
 		(*
 			we exceptionnaly allow follow here because we don't care the type we get as long as it's not our own
 			we exceptionnaly allow follow here because we don't care the type we get as long as it's not our own
@@ -2608,14 +2608,14 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 		| _ -> assert false);
 		| _ -> assert false);
 	| EAbstract d ->
 	| EAbstract d ->
 		let a = (match get_type d.d_name with TAbstractDecl a -> a | _ -> assert false) in
 		let a = (match get_type d.d_name with TAbstractDecl a -> a | _ -> assert false) in
-		let ctx = { ctx with type_params = a.a_types } in
+		let ctx = { ctx with type_params = a.a_params } in
 		let is_type = ref false in
 		let is_type = ref false in
 		let load_type t from =
 		let load_type t from =
 			let t = load_complex_type ctx p t in
 			let t = load_complex_type ctx p t in
 			if not (Meta.has Meta.CoreType a.a_meta) then begin
 			if not (Meta.has Meta.CoreType a.a_meta) then begin
 				if !is_type then begin
 				if !is_type then begin
 					delay ctx PFinal (fun () ->
 					delay ctx PFinal (fun () ->
-						let at = monomorphs a.a_types a.a_this in
+						let at = monomorphs a.a_params a.a_this in
 						(try (if from then Type.unify t at else Type.unify at t) with Unify_error _ -> error "You can only declare from/to with compatible types" p)
 						(try (if from then Type.unify t at else Type.unify at t) with Unify_error _ -> error "You can only declare from/to with compatible types" p)
 					);
 					);
 				end else
 				end else
@@ -2637,7 +2637,7 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 		) d.d_flags;
 		) d.d_flags;
 		if not !is_type then begin
 		if not !is_type then begin
 			if Meta.has Meta.CoreType a.a_meta then
 			if Meta.has Meta.CoreType a.a_meta then
-				a.a_this <- TAbstract(a,List.map snd a.a_types)
+				a.a_this <- TAbstract(a,List.map snd a.a_params)
 			else
 			else
 				error "Abstract is missing underlying type declaration" a.a_pos
 				error "Abstract is missing underlying type declaration" a.a_pos
 		end
 		end
@@ -2652,7 +2652,7 @@ let type_module ctx m file tdecls p =
 		t = ctx.t;
 		t = ctx.t;
 		m = {
 		m = {
 			curmod = m;
 			curmod = m;
-			module_types = ctx.g.std.m_types;
+			module_params = ctx.g.std.m_types;
 			module_using = [];
 			module_using = [];
 			module_globals = PMap.empty;
 			module_globals = PMap.empty;
 			wildcard_packages = [];
 			wildcard_packages = [];
@@ -2689,13 +2689,13 @@ let type_module ctx m file tdecls p =
 	List.iter (fun d ->
 	List.iter (fun d ->
 		match d with
 		match d with
 		| (TClassDecl c, (EClass d, p)) ->
 		| (TClassDecl c, (EClass d, p)) ->
-			c.cl_types <- List.map (type_type_params ctx c.cl_path (fun() -> c.cl_types) p) d.d_params;
+			c.cl_params <- List.map (type_type_params ctx c.cl_path (fun() -> c.cl_params) p) d.d_params;
 		| (TEnumDecl e, (EEnum d, p)) ->
 		| (TEnumDecl e, (EEnum d, p)) ->
-			e.e_types <- List.map (type_type_params ctx e.e_path (fun() -> e.e_types) p) d.d_params;
+			e.e_params <- List.map (type_type_params ctx e.e_path (fun() -> e.e_params) p) d.d_params;
 		| (TTypeDecl t, (ETypedef d, p)) ->
 		| (TTypeDecl t, (ETypedef d, p)) ->
-			t.t_types <- List.map (type_type_params ctx t.t_path (fun() -> t.t_types) p) d.d_params;
+			t.t_params <- List.map (type_type_params ctx t.t_path (fun() -> t.t_params) p) d.d_params;
 		| (TAbstractDecl a, (EAbstract d, p)) ->
 		| (TAbstractDecl a, (EAbstract d, p)) ->
-			a.a_types <- List.map (type_type_params ctx a.a_path (fun() -> a.a_types) p) d.d_params;
+			a.a_params <- List.map (type_type_params ctx a.a_path (fun() -> a.a_params) p) d.d_params;
 		| _ ->
 		| _ ->
 			assert false
 			assert false
 	) decls;
 	) decls;

+ 64 - 64
typer.ml

@@ -174,7 +174,7 @@ let rec is_pos_infos = function
 	| TType ({ t_path = ["haxe"] , "PosInfos" },[]) ->
 	| TType ({ t_path = ["haxe"] , "PosInfos" },[]) ->
 		true
 		true
 	| TType (t,tl) ->
 	| TType (t,tl) ->
-		is_pos_infos (apply_params t.t_types tl t.t_type)
+		is_pos_infos (apply_params t.t_params tl t.t_type)
 	| _ ->
 	| _ ->
 		false
 		false
 
 
@@ -200,9 +200,9 @@ let check_constraints ctx tname tpl tl map delayed p =
 	) tl tpl
 	) tl tpl
 
 
 let enum_field_type ctx en ef tl_en tl_ef p =
 let enum_field_type ctx en ef tl_en tl_ef p =
-	let map t = apply_params en.e_types tl_en (apply_params ef.ef_params tl_ef t) in
+	let map t = apply_params en.e_params tl_en (apply_params ef.ef_params tl_ef t) in
 	begin try
 	begin try
-		check_constraints ctx (s_type_path en.e_path) en.e_types tl_en map true p;
+		check_constraints ctx (s_type_path en.e_path) en.e_params tl_en map true p;
 		check_constraints ctx ef.ef_name ef.ef_params tl_ef map true p;
 		check_constraints ctx ef.ef_name ef.ef_params tl_ef map true p;
 	with Unify_error l ->
 	with Unify_error l ->
 		display_error ctx (error_msg (Unify l)) p
 		display_error ctx (error_msg (Unify l)) p
@@ -236,7 +236,7 @@ let field_type ctx c pl f p =
 	| [] -> f.cf_type
 	| [] -> f.cf_type
 	| l ->
 	| l ->
 		let monos = List.map (fun _ -> mk_mono()) l in
 		let monos = List.map (fun _ -> mk_mono()) l in
-		if not (Meta.has Meta.Generic f.cf_meta) then add_constraint_checks ctx c.cl_types pl f monos p;
+		if not (Meta.has Meta.Generic f.cf_meta) then add_constraint_checks ctx c.cl_params pl f monos p;
 		apply_params l monos f.cf_type
 		apply_params l monos f.cf_type
 
 
 let class_field ctx c pl name p =
 let class_field ctx c pl name p =
@@ -413,7 +413,7 @@ let collect_toplevel_identifiers ctx =
 			) e.e_constrs;
 			) e.e_constrs;
 	in
 	in
 	List.iter enum_ctors ctx.m.curmod.m_types;
 	List.iter enum_ctors ctx.m.curmod.m_types;
-	List.iter enum_ctors ctx.m.module_types;
+	List.iter enum_ctors ctx.m.module_params;
 
 
 	(* imported globals *)
 	(* imported globals *)
 	PMap.iter (fun _ (mt,s) ->
 	PMap.iter (fun _ (mt,s) ->
@@ -429,18 +429,18 @@ let collect_toplevel_identifiers ctx =
 			()
 			()
 	) ctx.m.module_globals;
 	) ctx.m.module_globals;
 
 
-	let module_types = ref [] in
+	let module_params = ref [] in
 
 
 	let add_type mt =
 	let add_type mt =
 		let path = (t_infos mt).mt_path in
 		let path = (t_infos mt).mt_path in
-		if not (List.exists (fun mt2 -> (t_infos mt2).mt_path = path) !module_types) then module_types := mt :: !module_types
+		if not (List.exists (fun mt2 -> (t_infos mt2).mt_path = path) !module_params) then module_params := mt :: !module_params
 	in
 	in
 
 
 	(* module types *)
 	(* module types *)
 	List.iter add_type ctx.m.curmod.m_types;
 	List.iter add_type ctx.m.curmod.m_types;
 
 
 	(* module imports *)
 	(* module imports *)
-	List.iter add_type ctx.m.module_types;
+	List.iter add_type ctx.m.module_params;
 
 
 	(* module using *)
 	(* module using *)
 	List.iter (fun c ->
 	List.iter (fun c ->
@@ -498,14 +498,14 @@ let collect_toplevel_identifiers ctx =
 
 
 	List.iter (fun mt ->
 	List.iter (fun mt ->
 		DynArray.add acc (ITType mt)
 		DynArray.add acc (ITType mt)
-	) !module_types;
+	) !module_params;
 
 
 	raise (DisplayToplevel (DynArray.to_list acc))
 	raise (DisplayToplevel (DynArray.to_list acc))
 
 
 (* ---------------------------------------------------------------------- *)
 (* ---------------------------------------------------------------------- *)
 (* PASS 3 : type expression & check structure *)
 (* PASS 3 : type expression & check structure *)
 
 
-let rec base_types t =
+let rec base_params t =
 	let tl = ref [] in
 	let tl = ref [] in
 	let rec loop t = (match t with
 	let rec loop t = (match t with
 		| TInst(cl, params) ->
 		| TInst(cl, params) ->
@@ -513,18 +513,18 @@ let rec base_types t =
 			| KTypeParameter tl -> List.iter loop tl
 			| KTypeParameter tl -> List.iter loop tl
 			| _ -> ());
 			| _ -> ());
 			List.iter (fun (ic, ip) ->
 			List.iter (fun (ic, ip) ->
-				let t = apply_params cl.cl_types params (TInst (ic,ip)) in
+				let t = apply_params cl.cl_params params (TInst (ic,ip)) in
 				loop t
 				loop t
 			) cl.cl_implements;
 			) cl.cl_implements;
 			(match cl.cl_super with None -> () | Some (csup, pl) ->
 			(match cl.cl_super with None -> () | Some (csup, pl) ->
-				let t = apply_params cl.cl_types params (TInst (csup,pl)) in
+				let t = apply_params cl.cl_params params (TInst (csup,pl)) in
 				loop t);
 				loop t);
 			tl := t :: !tl;
 			tl := t :: !tl;
 		| TEnum(en,(_ :: _ as tl2)) ->
 		| TEnum(en,(_ :: _ as tl2)) ->
 			tl := (TEnum(en,List.map (fun _ -> t_dynamic) tl2)) :: !tl;
 			tl := (TEnum(en,List.map (fun _ -> t_dynamic) tl2)) :: !tl;
 			tl := t :: !tl;
 			tl := t :: !tl;
 		| TType (td,pl) ->
 		| TType (td,pl) ->
-			loop (apply_params td.t_types pl td.t_type);
+			loop (apply_params td.t_params pl td.t_type);
 			(* prioritize the most generic definition *)
 			(* prioritize the most generic definition *)
 			tl := t :: !tl;
 			tl := t :: !tl;
 		| TLazy f -> loop (!f())
 		| TLazy f -> loop (!f())
@@ -597,7 +597,7 @@ let rec unify_min_raise ctx (el:texpr list) : t =
 		with Not_found ->
 		with Not_found ->
 			(* Second pass: Get all base types (interfaces, super classes and their interfaces) of most general type.
 			(* Second pass: Get all base types (interfaces, super classes and their interfaces) of most general type.
 			   Then for each additional type filter all types that do not unify. *)
 			   Then for each additional type filter all types that do not unify. *)
-			let common_types = base_types t in
+			let common_types = base_params t in
 			let dyn_types = List.fold_left (fun acc t ->
 			let dyn_types = List.fold_left (fun acc t ->
 				let rec loop c =
 				let rec loop c =
 					Meta.has Meta.UnifyMinDynamic c.cl_meta || (match c.cl_super with None -> false | Some (c,_) -> loop c)
 					Meta.has Meta.UnifyMinDynamic c.cl_meta || (match c.cl_super with None -> false | Some (c,_) -> loop c)
@@ -663,7 +663,7 @@ let rec unify_call_params ctx ?(overloads=None) cf el args r p inline =
 		match cf, overloads with
 		match cf, overloads with
 		| Some (TInst(c,pl),_), (ft,o) :: l ->
 		| Some (TInst(c,pl),_), (ft,o) :: l ->
 			let o = { o with cf_type = ft } in
 			let o = { o with cf_type = ft } in
-			let args, ret = (match follow (apply_params c.cl_types pl (field_type ctx c pl o p)) with (* I'm getting non-followed types here. Should it happen? *)
+			let args, ret = (match follow (apply_params c.cl_params pl (field_type ctx c pl o p)) with (* I'm getting non-followed types here. Should it happen? *)
 				| TFun (tl,t) -> tl, t
 				| TFun (tl,t) -> tl, t
 				| _ -> assert false
 				| _ -> assert false
 			) in
 			) in
@@ -793,10 +793,10 @@ let fast_enum_field e ef p =
 	TField (et,FEnum (e,ef))
 	TField (et,FEnum (e,ef))
 
 
 let type_of_module_type = function
 let type_of_module_type = function
-	| TClassDecl c -> TInst (c,List.map snd c.cl_types)
-	| TEnumDecl e -> TEnum (e,List.map snd e.e_types)
-	| TTypeDecl t -> TType (t,List.map snd t.t_types)
-	| TAbstractDecl a -> TAbstract (a,List.map snd a.a_types)
+	| TClassDecl c -> TInst (c,List.map snd c.cl_params)
+	| TEnumDecl e -> TEnum (e,List.map snd e.e_params)
+	| TTypeDecl t -> TType (t,List.map snd t.t_params)
+	| TAbstractDecl a -> TAbstract (a,List.map snd a.a_params)
 
 
 let rec type_module_type ctx t tparams p =
 let rec type_module_type ctx t tparams p =
 	match t with
 	match t with
@@ -811,15 +811,15 @@ let rec type_module_type ctx t tparams p =
 				a_status = ref (Statics c);
 				a_status = ref (Statics c);
 			};
 			};
 			t_private = true;
 			t_private = true;
-			t_types = [];
+			t_params = [];
 			t_meta = no_meta;
 			t_meta = no_meta;
 		} in
 		} in
 		mk (TTypeExpr (TClassDecl c)) (TType (t_tmp,[])) p
 		mk (TTypeExpr (TClassDecl c)) (TType (t_tmp,[])) p
 	| TEnumDecl e ->
 	| TEnumDecl e ->
-		let types = (match tparams with None -> List.map (fun _ -> mk_mono()) e.e_types | Some l -> l) in
+		let types = (match tparams with None -> List.map (fun _ -> mk_mono()) e.e_params | Some l -> l) in
 		mk (TTypeExpr (TEnumDecl e)) (TType (e.e_type,types)) p
 		mk (TTypeExpr (TEnumDecl e)) (TType (e.e_type,types)) p
 	| TTypeDecl s ->
 	| TTypeDecl s ->
-		let t = apply_params s.t_types (List.map (fun _ -> mk_mono()) s.t_types) s.t_type in
+		let t = apply_params s.t_params (List.map (fun _ -> mk_mono()) s.t_params) s.t_type in
 		Codegen.DeprecationCheck.check_typedef ctx.com s p;
 		Codegen.DeprecationCheck.check_typedef ctx.com s p;
 		(match follow t with
 		(match follow t with
 		| TEnum (e,params) ->
 		| TEnum (e,params) ->
@@ -844,7 +844,7 @@ let rec type_module_type ctx t tparams p =
 				a_status = ref (AbstractStatics a);
 				a_status = ref (AbstractStatics a);
 			};
 			};
 			t_private = true;
 			t_private = true;
-			t_types = [];
+			t_params = [];
 			t_meta = no_meta;
 			t_meta = no_meta;
 		} in
 		} in
 		mk (TTypeExpr (TAbstractDecl a)) (TType (t_tmp,[])) p
 		mk (TTypeExpr (TAbstractDecl a)) (TType (t_tmp,[])) p
@@ -857,10 +857,10 @@ let get_constructor ctx c params p =
 	| KAbstractImpl a ->
 	| KAbstractImpl a ->
 		let f = (try PMap.find "_new" c.cl_statics with Not_found -> error (s_type_path a.a_path ^ " does not have a constructor") p) in
 		let f = (try PMap.find "_new" c.cl_statics with Not_found -> error (s_type_path a.a_path ^ " does not have a constructor") p) in
 		let ct = field_type ctx c params f p in
 		let ct = field_type ctx c params f p in
-		apply_params a.a_types params ct, f
+		apply_params a.a_params params ct, f
 	| _ ->
 	| _ ->
 		let ct, f = (try Type.get_constructor (fun f -> field_type ctx c params f p) c with Not_found -> error (s_type_path c.cl_path ^ " does not have a constructor") p) in
 		let ct, f = (try Type.get_constructor (fun f -> field_type ctx c params f p) c with Not_found -> error (s_type_path c.cl_path ^ " does not have a constructor") p) in
-		apply_params c.cl_types params ct, f
+		apply_params c.cl_params params ct, f
 
 
 let make_call ctx e params t p =
 let make_call ctx e params t p =
 	try
 	try
@@ -882,9 +882,9 @@ let make_call ctx e params t p =
 				in
 				in
 				begin match t with
 				begin match t with
 					| TAbstract(a,pl) ->
 					| TAbstract(a,pl) ->
-						let has_params = a.a_types <> [] || f.cf_params <> [] in
+						let has_params = a.a_params <> [] || f.cf_params <> [] in
 						let monos = List.map (fun _ -> mk_mono()) f.cf_params in
 						let monos = List.map (fun _ -> mk_mono()) f.cf_params in
-						let map_type = fun t -> apply_params a.a_types pl (apply_params f.cf_params monos t) in
+						let map_type = fun t -> apply_params a.a_params pl (apply_params f.cf_params monos t) in
 						Some (has_params,map_type)
 						Some (has_params,map_type)
 					| _ ->
 					| _ ->
 						None
 						None
@@ -1068,7 +1068,7 @@ let field_access ctx mode f fmode t e p =
 		| (FunMemberAbstract | FunMemberAbstractLocal),TTypeExpr(TClassDecl ({cl_kind = KAbstractImpl a} as c)) when c == ctx.curclass && Meta.has Meta.Impl f.cf_meta ->
 		| (FunMemberAbstract | FunMemberAbstractLocal),TTypeExpr(TClassDecl ({cl_kind = KAbstractImpl a} as c)) when c == ctx.curclass && Meta.has Meta.Impl f.cf_meta ->
 			let e = mk (TField(e,fmode)) t p in
 			let e = mk (TField(e,fmode)) t p in
 			let ethis = get_this ctx p in
 			let ethis = get_this ctx p in
-			let ethis = {ethis with etype = TAbstract(a,List.map snd a.a_types)} in
+			let ethis = {ethis with etype = TAbstract(a,List.map snd a.a_params)} in
 			AKUsing(e,ctx.curclass,f,ethis)
 			AKUsing(e,ctx.curclass,f,ethis)
 		| _ ->
 		| _ ->
 			(match m, mode with
 			(match m, mode with
@@ -1131,7 +1131,7 @@ let field_access ctx mode f fmode t e p =
 					let c,a = match ctx.curclass with {cl_kind = KAbstractImpl a} as c -> c,a | _ -> assert false in
 					let c,a = match ctx.curclass with {cl_kind = KAbstractImpl a} as c -> c,a | _ -> assert false in
 					let f = PMap.find m c.cl_statics in
 					let f = PMap.find m c.cl_statics in
 					(* we don't have access to the type parameters here, right? *)
 					(* we don't have access to the type parameters here, right? *)
-					(* let t = apply_params a.a_types pl (field_type ctx c [] f p) in *)
+					(* let t = apply_params a.a_params pl (field_type ctx c [] f p) in *)
 					let t = (field_type ctx c [] f p) in
 					let t = (field_type ctx c [] f p) in
 					let ef = mk (TField (e,FStatic (c,f))) t p in
 					let ef = mk (TField (e,FStatic (c,f))) t p in
 					AKUsing (ef,c,f,this)
 					AKUsing (ef,c,f,this)
@@ -1313,13 +1313,13 @@ let rec type_ident_raise ?(imported_enums=true) ctx i p mode =
 					try
 					try
 						let ef = PMap.find i e.e_constrs in
 						let ef = PMap.find i e.e_constrs in
 						let et = type_module_type ctx t None p in
 						let et = type_module_type ctx t None p in
-						let monos = List.map (fun _ -> mk_mono()) e.e_types in
+						let monos = List.map (fun _ -> mk_mono()) e.e_params in
 						let monos2 = List.map (fun _ -> mk_mono()) ef.ef_params in
 						let monos2 = List.map (fun _ -> mk_mono()) ef.ef_params in
 						wrap (mk (TField (et,FEnum (e,ef))) (enum_field_type ctx e ef monos monos2 p) p)
 						wrap (mk (TField (et,FEnum (e,ef))) (enum_field_type ctx e ef monos monos2 p) p)
 					with
 					with
 						Not_found -> loop l
 						Not_found -> loop l
 		in
 		in
-		(try loop (List.rev ctx.m.curmod.m_types) with Not_found -> loop ctx.m.module_types)
+		(try loop (List.rev ctx.m.curmod.m_types) with Not_found -> loop ctx.m.module_params)
 	with Not_found ->
 	with Not_found ->
 		(* lookup imported globals *)
 		(* lookup imported globals *)
 		let t, name = PMap.find i ctx.m.module_globals in
 		let t, name = PMap.find i ctx.m.module_globals in
@@ -1356,7 +1356,7 @@ and type_field ?(resume=false) ctx e i p mode =
 		let rec loop_dyn c params =
 		let rec loop_dyn c params =
 			match c.cl_dynamic with
 			match c.cl_dynamic with
 			| Some t ->
 			| Some t ->
-				let t = apply_params c.cl_types params t in
+				let t = apply_params c.cl_params params t in
 				if (mode = MGet || mode = MCall) && PMap.mem "resolve" c.cl_fields then begin
 				if (mode = MGet || mode = MCall) && PMap.mem "resolve" c.cl_fields then begin
 					let f = PMap.find "resolve" c.cl_fields in
 					let f = PMap.find "resolve" c.cl_fields in
 					begin match f.cf_kind with
 					begin match f.cf_kind with
@@ -1364,7 +1364,7 @@ and type_field ?(resume=false) ctx e i p mode =
 						| _ -> ()
 						| _ -> ()
 					end;
 					end;
 					let texpect = tfun [ctx.t.tstring] t in
 					let texpect = tfun [ctx.t.tstring] t in
-					let tfield = apply_params c.cl_types params (monomorphs f.cf_params f.cf_type) in
+					let tfield = apply_params c.cl_params params (monomorphs f.cf_params f.cf_type) in
 					(try Type.unify tfield texpect
 					(try Type.unify tfield texpect
 					with Unify_error l ->
 					with Unify_error l ->
 						display_error ctx "Field resolve has an invalid type" f.cf_pos;
 						display_error ctx "Field resolve has an invalid type" f.cf_pos;
@@ -1396,7 +1396,7 @@ and type_field ?(resume=false) ctx e i p mode =
 				| _ ->
 				| _ ->
 					display_error ctx "Normal variables cannot be accessed with 'super', use 'this' instead" p);
 					display_error ctx "Normal variables cannot be accessed with 'super', use 'this' instead" p);
 			if not (can_access ctx c f false) && not ctx.untyped then display_error ctx ("Cannot access private field " ^ i) p;
 			if not (can_access ctx c f false) && not ctx.untyped then display_error ctx ("Cannot access private field " ^ i) p;
-			field_access ctx mode f (match c2 with None -> FAnon f | Some c -> FInstance (c,f)) (apply_params c.cl_types params t) e p
+			field_access ctx mode f (match c2 with None -> FAnon f | Some c -> FInstance (c,f)) (apply_params c.cl_params params t) e p
 		with Not_found -> try
 		with Not_found -> try
 			using_field ctx mode e i p
 			using_field ctx mode e i p
 		with Not_found -> try
 		with Not_found -> try
@@ -1491,7 +1491,7 @@ and type_field ?(resume=false) ctx e i p mode =
 			if not (can_access ctx c f true) && not ctx.untyped then display_error ctx ("Cannot access private field " ^ i) p;
 			if not (can_access ctx c f true) && not ctx.untyped then display_error ctx ("Cannot access private field " ^ i) p;
 			let field_type f =
 			let field_type f =
 				let t = field_type ctx c [] f p in
 				let t = field_type ctx c [] f p in
-				apply_params a.a_types pl t
+				apply_params a.a_params pl t
 			in
 			in
 			let et = type_module_type ctx (TClassDecl c) None p in
 			let et = type_module_type ctx (TClassDecl c) None p in
 			let field_expr f t = mk (TField (et,FStatic (c,f))) t p in
 			let field_expr f t = mk (TField (et,FStatic (c,f))) t p in
@@ -1526,12 +1526,12 @@ and type_field ?(resume=false) ctx e i p mode =
 				| EConst(Ident s | String s) -> s = i
 				| EConst(Ident s | String s) -> s = i
 				| _ -> error "Identifier or string expected as argument to @:forward" (pos e)
 				| _ -> error "Identifier or string expected as argument to @:forward" (pos e)
 			) el) && el <> [] then raise Not_found;
 			) el) && el <> [] then raise Not_found;
-			type_field ctx {e with etype = apply_params a.a_types pl a.a_this} i p mode;
+			type_field ctx {e with etype = apply_params a.a_params pl a.a_this} i p mode;
 		with Not_found -> try
 		with Not_found -> try
 			using_field ctx mode e i p
 			using_field ctx mode e i p
 		with Not_found -> try
 		with Not_found -> try
 			(match ctx.curfun, e.eexpr with
 			(match ctx.curfun, e.eexpr with
-			| FunMemberAbstract, TConst (TThis) -> type_field ctx {e with etype = apply_params a.a_types pl a.a_this} i p mode;
+			| FunMemberAbstract, TConst (TThis) -> type_field ctx {e with etype = apply_params a.a_params pl a.a_this} i p mode;
 			| _ -> raise Not_found)
 			| _ -> raise Not_found)
 		with Not_found ->
 		with Not_found ->
 			no_field())
 			no_field())
@@ -1627,7 +1627,7 @@ let unify_int ctx e k =
 		| TAnon a ->
 		| TAnon a ->
 			(try is_dynamic (PMap.find f a.a_fields).cf_type with Not_found -> false)
 			(try is_dynamic (PMap.find f a.a_fields).cf_type with Not_found -> false)
 		| TInst (c,pl) ->
 		| TInst (c,pl) ->
-			(try is_dynamic (apply_params c.cl_types pl ((let _,t,_ = Type.class_field c f in t))) with Not_found -> false)
+			(try is_dynamic (apply_params c.cl_params pl ((let _,t,_ = Type.class_field c f in t))) with Not_found -> false)
 		| _ ->
 		| _ ->
 			true
 			true
 	in
 	in
@@ -1672,7 +1672,7 @@ let type_generic_function ctx (e,cf) el ?(using_param=None) with_type p =
 		| _ -> assert false
 		| _ -> assert false
 	in
 	in
 	let t = apply_params cf.cf_params monos cf.cf_type in
 	let t = apply_params cf.cf_params monos cf.cf_type in
-	add_constraint_checks ctx c.cl_types [] cf monos p;
+	add_constraint_checks ctx c.cl_params [] cf monos p;
 	let args,ret = match t,using_param with
 	let args,ret = match t,using_param with
 		| TFun((_,_,ta) :: args,ret),Some e ->
 		| TFun((_,_,ta) :: args,ret),Some e ->
 			let ta = if not (Meta.has Meta.Impl cf.cf_meta) then ta
 			let ta = if not (Meta.has Meta.Impl cf.cf_meta) then ta
@@ -1830,7 +1830,7 @@ let rec type_binop ctx op e1 e2 is_assign_op with_type p =
 			]) t p
 			]) t p
 		| AKUsing(ef,c,cf,et) ->
 		| AKUsing(ef,c,cf,et) ->
 			(* abstract setter + getter *)
 			(* abstract setter + getter *)
-			let ta = match c.cl_kind with KAbstractImpl a -> TAbstract(a, List.map (fun _ -> mk_mono()) a.a_types) | _ -> assert false in
+			let ta = match c.cl_kind with KAbstractImpl a -> TAbstract(a, List.map (fun _ -> mk_mono()) a.a_params) | _ -> assert false in
 			let ret = match follow ef.etype with
 			let ret = match follow ef.etype with
 				| TFun([_;_],ret) -> ret
 				| TFun([_;_],ret) -> ret
 				| _ ->  error "Invalid field type for abstract setter" p
 				| _ ->  error "Invalid field type for abstract setter" p
@@ -2095,7 +2095,7 @@ let rec type_binop ctx op e1 e2 is_assign_op with_type p =
 				let impl = Meta.has Meta.Impl cf.cf_meta in
 				let impl = Meta.has Meta.Impl cf.cf_meta in
 				let monos = List.map (fun _ -> mk_mono()) cf.cf_params in
 				let monos = List.map (fun _ -> mk_mono()) cf.cf_params in
 				let tcf = apply_params cf.cf_params monos cf.cf_type in
 				let tcf = apply_params cf.cf_params monos cf.cf_type in
-				let tcf = if impl then apply_params a.a_types pl tcf else tcf in
+				let tcf = if impl then apply_params a.a_params pl tcf else tcf in
 				(match follow tcf with
 				(match follow tcf with
 				| TFun([(_,_,t1);(_,_,t2)],r) ->
 				| TFun([(_,_,t1);(_,_,t2)],r) ->
 					(* implementation fields can only be used in left mode (issue #2130) *)
 					(* implementation fields can only be used in left mode (issue #2130) *)
@@ -2117,7 +2117,7 @@ let rec type_binop ctx op e1 e2 is_assign_op with_type p =
 									()
 									()
 							end;
 							end;
 							Type.unify t t2;
 							Type.unify t t2;
-							check_constraints ctx "" cf.cf_params monos (apply_params a.a_types pl) false cf.cf_pos;
+							check_constraints ctx "" cf.cf_params monos (apply_params a.a_params pl) false cf.cf_pos;
 							cf,t2,r,o = OpAssignOp(op),Meta.has Meta.Commutative cf.cf_meta
 							cf,t2,r,o = OpAssignOp(op),Meta.has Meta.Commutative cf.cf_meta
 						with Unify_error _ ->
 						with Unify_error _ ->
 							loop ops
 							loop ops
@@ -2131,7 +2131,7 @@ let rec type_binop ctx op e1 e2 is_assign_op with_type p =
 	in
 	in
 	let mk_cast_op c f a pl e1 e2 r assign =
 	let mk_cast_op c f a pl e1 e2 r assign =
 		let t = field_type ctx c [] f p in
 		let t = field_type ctx c [] f p in
-		let t = apply_params a.a_types pl t in
+		let t = apply_params a.a_params pl t in
 		let et = type_module_type ctx (TClassDecl c) None p in
 		let et = type_module_type ctx (TClassDecl c) None p in
 		let ef = mk (TField (et,FStatic (c,f))) t p in
 		let ef = mk (TField (et,FStatic (c,f))) t p in
 		let ec = make_call ctx ef [e1;e2] r p in
 		let ec = make_call ctx ef [e1;e2] r p in
@@ -2161,8 +2161,8 @@ let rec type_binop ctx op e1 e2 is_assign_op with_type p =
 			let e2 = Codegen.Abstract.check_cast ctx t2 e2 e2.epos in
 			let e2 = Codegen.Abstract.check_cast ctx t2 e2 e2.epos in
 			begin match f.cf_expr with
 			begin match f.cf_expr with
 				| None ->
 				| None ->
-					let e2 = match follow e2.etype with TAbstract(a,pl) -> {e2 with etype = apply_params a.a_types pl a.a_this} | _ -> e2 in
-					cast_rec {e1 with etype = apply_params a.a_types pl a.a_this} e2 r (Meta.has Meta.CoreType a.a_meta)
+					let e2 = match follow e2.etype with TAbstract(a,pl) -> {e2 with etype = apply_params a.a_params pl a.a_this} | _ -> e2 in
+					cast_rec {e1 with etype = apply_params a.a_params pl a.a_this} e2 r (Meta.has Meta.CoreType a.a_meta)
 				| Some _ ->
 				| Some _ ->
 					mk_cast_op c f a pl e1 e2 r assign
 					mk_cast_op c f a pl e1 e2 r assign
 			end
 			end
@@ -2187,8 +2187,8 @@ let rec type_binop ctx op e1 e2 is_assign_op with_type p =
 			end in
 			end in
 			let e = match f.cf_expr with
 			let e = match f.cf_expr with
 				| None ->
 				| None ->
-					let e1 = match follow e1.etype with TAbstract(a,pl) -> {e1 with etype = apply_params a.a_types pl a.a_this} | _ -> e1 in
-					cast_rec e1 {e2 with etype = apply_params a.a_types pl a.a_this} r (Meta.has Meta.CoreType a.a_meta)
+					let e1 = match follow e1.etype with TAbstract(a,pl) -> {e1 with etype = apply_params a.a_params pl a.a_this} | _ -> e1 in
+					cast_rec e1 {e2 with etype = apply_params a.a_params pl a.a_this} r (Meta.has Meta.CoreType a.a_meta)
 				| Some _ ->
 				| Some _ ->
 					mk_cast_op c f a pl e1 e2 r assign
 					mk_cast_op c f a pl e1 e2 r assign
 			in
 			in
@@ -2238,9 +2238,9 @@ and type_unop ctx op flag e p =
 					| [] -> raise Not_found
 					| [] -> raise Not_found
 					| (op2,flag2,cf) :: opl when op == op2 && flag == flag2 ->
 					| (op2,flag2,cf) :: opl when op == op2 && flag == flag2 ->
 						let m = mk_mono() in
 						let m = mk_mono() in
-						let tcf = apply_params c.cl_types pl (monomorphs cf.cf_params cf.cf_type) in
+						let tcf = apply_params c.cl_params pl (monomorphs cf.cf_params cf.cf_type) in
 						if Meta.has Meta.Impl cf.cf_meta then begin
 						if Meta.has Meta.Impl cf.cf_meta then begin
-							if type_iseq (tfun [apply_params a.a_types pl a.a_this] m) tcf then cf,tcf,m else loop opl
+							if type_iseq (tfun [apply_params a.a_params pl a.a_this] m) tcf then cf,tcf,m else loop opl
 						end else
 						end else
 							if type_iseq (tfun [e.etype] m) tcf then cf,tcf,m else loop opl
 							if type_iseq (tfun [e.etype] m) tcf then cf,tcf,m else loop opl
 					| _ :: opl -> loop opl
 					| _ :: opl -> loop opl
@@ -2248,7 +2248,7 @@ and type_unop ctx op flag e p =
 				let cf,t,r = try loop a.a_unops with Not_found -> error "Invalid operation" p in
 				let cf,t,r = try loop a.a_unops with Not_found -> error "Invalid operation" p in
 				(match cf.cf_expr with
 				(match cf.cf_expr with
 				| None ->
 				| None ->
-					let e = {e with etype = apply_params a.a_types pl a.a_this} in
+					let e = {e with etype = apply_params a.a_params pl a.a_this} in
 					let e = mk (TUnop(op,flag,e)) r p in
 					let e = mk (TUnop(op,flag,e)) r p in
 					(* unify ctx r e.etype p; *) (* TODO: I'm not sure why this was here (related to #2295) *)
 					(* unify ctx r e.etype p; *) (* TODO: I'm not sure why this was here (related to #2295) *)
 					e
 					e
@@ -2393,7 +2393,7 @@ and type_access ctx e p mode =
 			| TTypeExpr (TClassDecl c) ->
 			| TTypeExpr (TClassDecl c) ->
 				if mode = MSet then error "Cannot set constructor" p;
 				if mode = MSet then error "Cannot set constructor" p;
 				if mode = MCall then error ("Cannot call constructor like this, use 'new " ^ (s_type_path c.cl_path) ^ "()' instead") p;
 				if mode = MCall then error ("Cannot call constructor like this, use 'new " ^ (s_type_path c.cl_path) ^ "()' instead") p;
-				let monos = List.map (fun _ -> mk_mono()) c.cl_types in
+				let monos = List.map (fun _ -> mk_mono()) c.cl_params in
 				let ct, _ = get_constructor ctx c monos p in
 				let ct, _ = get_constructor ctx c monos p in
 				let args = match follow ct with TFun(args,ret) -> args | _ -> assert false in
 				let args = match follow ct with TFun(args,ret) -> args | _ -> assert false in
 				let vl = List.map (fun (n,_,t) -> alloc_var n t) args in
 				let vl = List.map (fun (n,_,t) -> alloc_var n t) args in
@@ -2492,7 +2492,7 @@ and type_access ctx e p mode =
 						(match pack with
 						(match pack with
 						| [] ->
 						| [] ->
 							(try
 							(try
-								let t = List.find (fun t -> snd (t_infos t).mt_path = name) (ctx.m.curmod.m_types @ ctx.m.module_types) in
+								let t = List.find (fun t -> snd (t_infos t).mt_path = name) (ctx.m.curmod.m_types @ ctx.m.module_params) in
 								(* if the static is not found, look for a subtype instead - #1916 *)
 								(* if the static is not found, look for a subtype instead - #1916 *)
 								get_static true t
 								get_static true t
 							with Not_found ->
 							with Not_found ->
@@ -2549,14 +2549,14 @@ and type_access ctx e p mode =
 		unify ctx e2.etype ctx.t.tint e2.epos;
 		unify ctx e2.etype ctx.t.tint e2.epos;
 		let rec loop et =
 		let rec loop et =
 			match follow et with
 			match follow et with
-			| TInst ({ cl_array_access = Some t; cl_types = pl },tl) ->
+			| TInst ({ cl_array_access = Some t; cl_params = pl },tl) ->
 				apply_params pl tl t
 				apply_params pl tl t
-			| TInst ({ cl_super = Some (c,stl); cl_types = pl },tl) ->
+			| TInst ({ cl_super = Some (c,stl); cl_params = pl },tl) ->
 				apply_params pl tl (loop (TInst (c,stl)))
 				apply_params pl tl (loop (TInst (c,stl)))
 			| TInst ({ cl_path = [],"ArrayAccess" },[t]) ->
 			| TInst ({ cl_path = [],"ArrayAccess" },[t]) ->
 				t
 				t
 			| TAbstract(a,tl) when Meta.has Meta.ArrayAccess a.a_meta ->
 			| TAbstract(a,tl) when Meta.has Meta.ArrayAccess a.a_meta ->
-				loop (apply_params a.a_types tl a.a_this)
+				loop (apply_params a.a_params tl a.a_this)
 			| _ ->
 			| _ ->
 				let pt = mk_mono() in
 				let pt = mk_mono() in
 				let t = ctx.t.tarray pt in
 				let t = ctx.t.tarray pt in
@@ -3231,7 +3231,7 @@ and type_expr ctx (e,p) (with_type:with_type) =
 			(* Try to infer generic parameters from the argument list (issue #2044) *)
 			(* Try to infer generic parameters from the argument list (issue #2044) *)
 			match Typeload.load_type_def ctx p t with
 			match Typeload.load_type_def ctx p t with
 			| TClassDecl ({cl_constructor = Some cf} as c) ->
 			| TClassDecl ({cl_constructor = Some cf} as c) ->
-				let monos = List.map (fun _ -> mk_mono()) c.cl_types in
+				let monos = List.map (fun _ -> mk_mono()) c.cl_params in
 				let ct, f = get_constructor ctx c monos p in
 				let ct, f = get_constructor ctx c monos p in
 				ignore (unify_constructor_call c monos f ct);
 				ignore (unify_constructor_call c monos f ct);
 				Codegen.build_generic ctx c p monos
 				Codegen.build_generic ctx c p monos
@@ -3559,7 +3559,7 @@ and handle_display ctx e_ast iscall p =
 						| KTypeParameter pl -> List.fold_left (fun acc t -> merge acc (get_fields t)) m pl
 						| KTypeParameter pl -> List.fold_left (fun acc t -> merge acc (get_fields t)) m pl
 						| _ -> m
 						| _ -> m
 					) in
 					) in
-					PMap.map (fun f -> { f with cf_type = apply_params c.cl_types params (opt_type f.cf_type); cf_public = true; }) m
+					PMap.map (fun f -> { f with cf_type = apply_params c.cl_params params (opt_type f.cf_type); cf_public = true; }) m
 				in
 				in
 				loop c params
 				loop c params
 			| TAbstract({a_impl = Some c} as a,pl) ->
 			| TAbstract({a_impl = Some c} as a,pl) ->
@@ -3571,7 +3571,7 @@ and handle_display ctx e_ast iscall p =
 						| EConst(Ident s) -> Some s
 						| EConst(Ident s) -> Some s
 						| _ -> None
 						| _ -> None
 					) el in
 					) el in
-					let fields = get_fields (apply_params a.a_types pl a.a_this) in
+					let fields = get_fields (apply_params a.a_params pl a.a_this) in
 					if sl = [] then fields else PMap.fold (fun cf acc ->
 					if sl = [] then fields else PMap.fold (fun cf acc ->
 						if List.mem cf.cf_name sl then
 						if List.mem cf.cf_name sl then
 							PMap.add cf.cf_name cf acc
 							PMap.add cf.cf_name cf acc
@@ -3584,7 +3584,7 @@ and handle_display ctx e_ast iscall p =
 				PMap.fold (fun f acc ->
 				PMap.fold (fun f acc ->
 					if f.cf_name <> "_new" && can_access ctx c f true && Meta.has Meta.Impl f.cf_meta && not (Meta.has Meta.Enum f.cf_meta) then begin
 					if f.cf_name <> "_new" && can_access ctx c f true && Meta.has Meta.Impl f.cf_meta && not (Meta.has Meta.Enum f.cf_meta) then begin
 						let f = prepare_using_field f in
 						let f = prepare_using_field f in
-						let t = apply_params a.a_types pl (follow f.cf_type) in
+						let t = apply_params a.a_params pl (follow f.cf_type) in
 						PMap.add f.cf_name { f with cf_public = true; cf_type = opt_type t } acc
 						PMap.add f.cf_name { f with cf_public = true; cf_type = opt_type t } acc
 					end else
 					end else
 						acc
 						acc
@@ -3758,7 +3758,7 @@ and type_call ctx e el (with_type:with_type) p =
 and build_call ctx acc el (with_type:with_type) p =
 and build_call ctx acc el (with_type:with_type) p =
 	let fopts t f = match follow t with
 	let fopts t f = match follow t with
 		| (TInst (c,pl) as t) -> Some (t,f)
 		| (TInst (c,pl) as t) -> Some (t,f)
-		| (TAnon a) as t -> (match !(a.a_status) with Statics c -> Some (TInst(c,List.map snd c.cl_types),f) | _ -> Some (t,f))
+		| (TAnon a) as t -> (match !(a.a_status) with Statics c -> Some (TInst(c,List.map snd c.cl_params),f) | _ -> Some (t,f))
 		| _ -> None
 		| _ -> None
 	in
 	in
 	let push_this e =
 	let push_this e =
@@ -3798,7 +3798,7 @@ and build_call ctx acc el (with_type:with_type) p =
 			let t = follow (field_type ctx cl [] ef p) in
 			let t = follow (field_type ctx cl [] ef p) in
 			(* for abstracts we have to apply their parameters to the static function *)
 			(* for abstracts we have to apply their parameters to the static function *)
 			let t,tthis,is_abstract_impl_call = match follow eparam.etype with
 			let t,tthis,is_abstract_impl_call = match follow eparam.etype with
-				| TAbstract(a,tl) when Meta.has Meta.Impl ef.cf_meta -> apply_params a.a_types tl t,apply_params a.a_types tl a.a_this,true
+				| TAbstract(a,tl) when Meta.has Meta.Impl ef.cf_meta -> apply_params a.a_params tl t,apply_params a.a_params tl a.a_this,true
 				| te -> t,te,false
 				| te -> t,te,false
 			in
 			in
 			let params,args,r,eparam = match t with
 			let params,args,r,eparam = match t with
@@ -4478,7 +4478,7 @@ let load_macro ctx cpath f p =
 	let mloaded = Typeload.load_module mctx m p in
 	let mloaded = Typeload.load_module mctx m p in
 	mctx.m <- {
 	mctx.m <- {
 		curmod = mloaded;
 		curmod = mloaded;
-		module_types = [];
+		module_params = [];
 		module_using = [];
 		module_using = [];
 		module_globals = PMap.empty;
 		module_globals = PMap.empty;
 		wildcard_packages = [];
 		wildcard_packages = [];
@@ -4725,7 +4725,7 @@ let rec create com =
 		};
 		};
 		m = {
 		m = {
 			curmod = null_module;
 			curmod = null_module;
-			module_types = [];
+			module_params = [];
 			module_using = [];
 			module_using = [];
 			module_globals = PMap.empty;
 			module_globals = PMap.empty;
 			wildcard_packages = [];
 			wildcard_packages = [];
@@ -4758,7 +4758,7 @@ let rec create com =
 		Error (Module_not_found ([],"StdTypes"),_) -> error "Standard library not found" null_pos
 		Error (Module_not_found ([],"StdTypes"),_) -> error "Standard library not found" null_pos
 	);
 	);
 	(* We always want core types to be available so we add them as default imports (issue #1904 and #3131). *)
 	(* We always want core types to be available so we add them as default imports (issue #1904 and #3131). *)
-	ctx.m.module_types <- ctx.g.std.m_types;
+	ctx.m.module_params <- ctx.g.std.m_types;
 	List.iter (fun t ->
 	List.iter (fun t ->
 		match t with
 		match t with
 		| TAbstractDecl a ->
 		| TAbstractDecl a ->