Browse Source

[java] Null<T>'s real_type must be Dynamic. Closes #3023

Cauê Waneck 11 years ago
parent
commit
98fb89864b
2 changed files with 21 additions and 2 deletions
  1. 2 2
      genjava.ml
  2. 19 0
      tests/unit/issues/Issue3023.hx

+ 2 - 2
genjava.ml

@@ -916,8 +916,8 @@ let configure gen =
 			| TType({ t_path = ([], "Null") }, [t]) ->
 				(match follow t with
 					| TInst( { cl_kind = KTypeParameter _ }, []) ->
-							(* t_dynamic *)
-							real_type t
+							t_dynamic
+							(* real_type t *)
 					| _ -> real_type t
 				)
 			| TType _ | TAbstract _ -> t

+ 19 - 0
tests/unit/issues/Issue3023.hx

@@ -0,0 +1,19 @@
+package unit.issues;
+
+class Issue3023 extends Test {
+    function test() {
+			var x:Array<Null<Map<Int,CTest>>> = [];
+			x.push([ 0 => new CTest() ]);
+			eq(x[0].get(0).x, 10);
+			var y = x[0].get(0).x;
+			eq(y,10);
+		}
+}
+
+private class CTest
+{
+	public var x:Int = 10;
+	public function new()
+	{
+	}
+}