Parcourir la source

fixed bug with Enum.construct when Enum have type parameters

Nicolas Cannasse il y a 18 ans
Parent
commit
df59e3fe90
2 fichiers modifiés avec 6 ajouts et 2 suppressions
  1. 3 0
      doc/CHANGES.txt
  2. 3 2
      typer.ml

+ 3 - 0
doc/CHANGES.txt

@@ -1,3 +1,6 @@
+2007-??-??: 1.15
+	fixed bug with Enum.construct when Enum have type parameters
+
 2007-07-25: 1.14
 	fixed no error when invalid "catch" expression
 	remove variance

+ 3 - 2
typer.ml

@@ -910,6 +910,7 @@ let type_type ctx tpath p =
 		} in
 		mk (TTypeExpr (TClassDecl c)) (TType (t_tmp,[])) p
 	| TEnumDecl e ->
+		let types = (match tparams with None -> List.map (fun _ -> mk_mono()) e.e_types | Some l -> l) in
 		let fl = PMap.fold (fun f acc ->
 			PMap.add f.ef_name {
 				cf_name = f.ef_name;
@@ -929,9 +930,9 @@ let type_type ctx tpath p =
 			t_type = mk_anon fl;
 			t_private = true;
 			t_static = None;
-			t_types = [];
+			t_types = e.e_types;
 		} in
-		mk (TTypeExpr (TEnumDecl e)) (TType (t_tmp,[])) p
+		mk (TTypeExpr (TEnumDecl e)) (TType (t_tmp,types)) p
 	| TTypeDecl s ->
 		match follow s.t_type with
 		| TEnum (e,params) ->