Browse Source

[As3/Swf9] generate flash.Vector<T> as Object to avoid variance problems (fixed issue #1210)

Simon Krajewski 13 years ago
parent
commit
9ff2d10206
2 changed files with 6 additions and 2 deletions
  1. 3 1
      genas3.ml
  2. 3 1
      genswf9.ml

+ 3 - 1
genas3.ml

@@ -233,7 +233,9 @@ let rec type_str ctx t p =
 		) else
 			s_path ctx true e.e_path p
 	| TInst ({ cl_path = ["flash"],"Vector" },[pt]) ->
-		"Vector.<" ^ type_str ctx pt p ^ ">"
+		(match pt with
+		| TInst({cl_kind = KTypeParameter _},_) -> "*"
+		| _ -> "Vector.<" ^ type_str ctx pt p ^ ">")
 	| TInst (c,_) ->
 		(match c.cl_kind with
 		| KNormal | KGeneric | KGenericInstance _ -> s_path ctx false c.cl_path p

+ 3 - 1
genswf9.ml

@@ -206,7 +206,9 @@ let rec type_id ctx t =
 	| TInst ({ cl_path = ["haxe"],"Int32" },_) ->
 		type_path ctx ([],"Int")
 	| TInst ({ cl_path = ["flash"],"Vector" } as c,pl) ->
-		HMParams (type_path ctx c.cl_path,List.map (type_id ctx) pl)
+		(match pl with
+		| [TInst({cl_kind = KTypeParameter _},_)] -> type_path ctx ([],"Object")
+		| _ -> HMParams (type_path ctx c.cl_path,List.map (type_id ctx) pl))
 	| TInst (c,_) ->
 		(match c.cl_kind with
 		| KTypeParameter l ->